From c635b185e4026bd3703c407a85c828ecc2849366 Mon Sep 17 00:00:00 2001 From: avl Date: Tue, 2 Dec 2008 14:23:36 +0200 Subject: [PATCH] misc fixes --- ipf/admin/model.php | 1 - ipf/admin/models/AdminLog.php | 10 +++++----- ipf/form/field/image.php | 1 - ipf/form/model.php | 1 + ipf/orm/record.php | 3 ++- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ipf/admin/model.php b/ipf/admin/model.php index 3df342d..f8d962c 100644 --- a/ipf/admin/model.php +++ b/ipf/admin/model.php @@ -258,7 +258,6 @@ class IPF_Admin_Model{ $this->setInlines($o, &$data); if ( ($form->isValid()) && ($this->isValidInlines()) ) { - #print_r($form->cleaned_data); $item = $form->save(); $this->saveInlines($item); AdminLog::logAction($request, $item, AdminLog::CHANGE); diff --git a/ipf/admin/models/AdminLog.php b/ipf/admin/models/AdminLog.php index f84c33d..85d9acc 100644 --- a/ipf/admin/models/AdminLog.php +++ b/ipf/admin/models/AdminLog.php @@ -5,19 +5,19 @@ class AdminLog extends BaseAdminLog const ADDITION = 1; const CHANGE = 2; const DELETION = 3; - + public static function logAction($request, $object, $action_flag, $message=''){ $log = new AdminLog(); $log->username = $request->user->username; $log->user_id = $request->user->id; - $log->object_id = $object->id; + $log->object_id = (int)$object[$object->getTable()->getIdentifier()]; $log->object_class = get_class($object); $log->object_repr = (string)$object; $log->action_flag = $action_flag; $log->change_message = $message; $log->save(); } - + public function is_addition(){ if ($this->action_flag==AdminLog::ADDITION) return true; @@ -35,10 +35,10 @@ class AdminLog extends BaseAdminLog return true; return false; } - + public function GetAdminUrl(){ return IPF_HTTP_URL_urlForView('IPF_Admin_Views_Index').IPF_Utils::appLabelByModel($this->object_class).'/'.strtolower($this->object_class).'/'.$this->object_id.'/'; } - + } diff --git a/ipf/form/field/image.php b/ipf/form/field/image.php index ee75ee8..d9a4018 100644 --- a/ipf/form/field/image.php +++ b/ipf/form/field/image.php @@ -13,7 +13,6 @@ function IPF_Form_Field_moveImageToUploadFolder($value, $params=array()) if(!getimagesize($image)) throw new IPF_Exception_Form(__('An error occured when upload the image.')); - return $name; } diff --git a/ipf/form/model.php b/ipf/form/model.php index 1a25420..1b43ed8 100644 --- a/ipf/form/model.php +++ b/ipf/form/model.php @@ -131,6 +131,7 @@ class IPF_Form_Model extends IPF_Form $errors = $erecords[0]->getErrorStack(); foreach($errors as $k=>$v){ print($k); + print_r($v); } } } diff --git a/ipf/orm/record.php b/ipf/orm/record.php index 8521f5c..3bbf766 100644 --- a/ipf/orm/record.php +++ b/ipf/orm/record.php @@ -1272,8 +1272,9 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab if (($val!==null) && ($val=='')) continue; } - if (array_search($key,$names)) + if (array_search($key,$names)){ $this->$key = $val; + } } } -- 2.49.0