From c9d5a940bd908b2d7ab2264df11a409cacf0eb80 Mon Sep 17 00:00:00 2001 From: secretr Date: Thu, 27 Aug 2009 23:37:24 +0000 Subject: [PATCH] save prefs DB error message added, e_model - another 'data has changed' fix --- e107_handlers/model_class.php | 12 ++++++------ e107_handlers/pref_class.php | 11 ++++++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index 66ea595cc..168cc4648 100644 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -9,8 +9,8 @@ * e107 Base Model * * $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $ - * $Revision: 1.2 $ - * $Date: 2009-08-21 22:17:59 $ + * $Revision: 1.3 $ + * $Date: 2009-08-27 23:37:24 $ * $Author: secretr $ */ @@ -707,7 +707,7 @@ class e_model //data has changed - optimized if('_data' === $data_src && !$this->data_has_changed) { - $this->data_has_changed = (isset($this->_data[$key]) && $this->_data[$key] != $value); + $this->data_has_changed = (!isset($this->_data[$key]) || $this->_data[$key] != $value); } $this->_parsed_keys[$data_src.'/'.$key] = $value; $data = $value; @@ -721,7 +721,7 @@ class e_model } if('_data' === $data_src && !$this->data_has_changed) { - $this->data_has_changed = (isset($this->_data[$key]) && $this->{$data_src}[$key] != $value); + $this->data_has_changed = (!isset($this->_data[$key]) || $this->{$data_src}[$key] != $value); } $this->{$data_src}[$key] = $value; } @@ -746,7 +746,7 @@ class e_model //data has changed if('_data' === $data_src && !$this->data_has_changed) { - $this->data_has_changed = (isset($this->_data[$key]) && $this->_data[$key] != $value); + $this->data_has_changed = (!isset($this->_data[$key]) || $this->_data[$key] != $value); } $this->{$data_src}[$key] = $value; return $this; @@ -756,7 +756,7 @@ class e_model { if('_data' === $data_src && !$this->data_has_changed) { - $this->data_has_changed = (isset($this->_data[$key]) && $this->_data[$key] != $value); + $this->data_has_changed = (!isset($this->_data[$key]) || $this->_data[$key] != $value); } $this->{$data_src}[$key] = $value; } diff --git a/e107_handlers/pref_class.php b/e107_handlers/pref_class.php index 793093447..773a3b81f 100644 --- a/e107_handlers/pref_class.php +++ b/e107_handlers/pref_class.php @@ -9,8 +9,8 @@ * e107 Preference Handler * * $Source: /cvs_backup/e107_0.8/e107_handlers/pref_class.php,v $ - * $Revision: 1.13 $ - * $Date: 2009-08-27 23:03:34 $ + * $Revision: 1.14 $ + * $Date: 2009-08-27 23:37:24 $ * $Author: secretr $ */ @@ -508,7 +508,12 @@ class e_pref extends e_model } return true; } - //TODO - DB error messages + elseif(e107::getDb()->mySQLlastErrNum) + { + $emessage->add('mySQL error #'.e107::getDb()->$mySQLlastErrNum.': '.e107::getDb()->mySQLlastErrText, E_MESSAGE_ERROR, $session_messages); + $emessage->add('Settings not saved.', E_MESSAGE_ERROR, $session_messages); + return false; + } } if($this->isError())