1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

save prefs DB error message added, e_model - another 'data has changed' fix

This commit is contained in:
secretr
2009-08-27 23:37:24 +00:00
parent 4418d94cd0
commit c9d5a940bd
2 changed files with 14 additions and 9 deletions

View File

@@ -9,8 +9,8 @@
* e107 Base Model * e107 Base Model
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
* $Revision: 1.2 $ * $Revision: 1.3 $
* $Date: 2009-08-21 22:17:59 $ * $Date: 2009-08-27 23:37:24 $
* $Author: secretr $ * $Author: secretr $
*/ */
@@ -707,7 +707,7 @@ class e_model
//data has changed - optimized //data has changed - optimized
if('_data' === $data_src && !$this->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->_parsed_keys[$data_src.'/'.$key] = $value; $this->_parsed_keys[$data_src.'/'.$key] = $value;
$data = $value; $data = $value;
@@ -721,7 +721,7 @@ class e_model
} }
if('_data' === $data_src && !$this->data_has_changed) 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; $this->{$data_src}[$key] = $value;
} }
@@ -746,7 +746,7 @@ class e_model
//data has changed //data has changed
if('_data' === $data_src && !$this->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; $this->{$data_src}[$key] = $value;
return $this; return $this;
@@ -756,7 +756,7 @@ class e_model
{ {
if('_data' === $data_src && !$this->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; $this->{$data_src}[$key] = $value;
} }

View File

@@ -9,8 +9,8 @@
* e107 Preference Handler * e107 Preference Handler
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/pref_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/pref_class.php,v $
* $Revision: 1.13 $ * $Revision: 1.14 $
* $Date: 2009-08-27 23:03:34 $ * $Date: 2009-08-27 23:37:24 $
* $Author: secretr $ * $Author: secretr $
*/ */
@@ -508,7 +508,12 @@ class e_pref extends e_model
} }
return true; 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()) if($this->isError())