Index: trunk/kernel/include/itemdb.php =================================================================== diff -u -N -r810 -r822 --- trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 810) +++ trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 822) @@ -269,6 +269,9 @@ $this->SetModified($UpdatedBy); $sql = "UPDATE ".$this->tablename ." SET "; $first = 1; + + $this->DetectChanges(); + foreach ($this->m_dirtyFieldsMap as $key => $value) { if(!is_numeric($key) && $key != $this->IdField() && $key!='ResourceId') @@ -288,12 +291,7 @@ else $sql = sprintf("%s, %s=%s",$sql,$key,$this->adodbConnection->qstr(stripslashes($value))); } - } - if (!(($value == '' || $value == 0) && ($this->Data[$key] == 'NULL' || $this->Data[$key] == '0' || $this->Data[$key] == ''))) { - if (!strstr($key, 'Modif') && $key != 'CreatedOn') { - $objSession->SetVariable("HasChanges", 1); - } - } + } } $sql = sprintf("%s WHERE %s = '%s'",$sql, $this->IdField(), $this->UniqueId()); @@ -376,6 +374,19 @@ return $sql; } + function DetectChanges() + { + global $objSession; +print_pre($this->m_dirtyFieldsMap); + foreach ($this->m_dirtyFieldsMap as $key => $value) { + //if ($this->Data[$key] != $this->m_dirtyFieldsMap[$key]) { + if ((!strstr($key, 'Modif') && $key != 'CreatedOn')) { + $objSession->SetVariable("HasChanges", 1); + } + //} + } + } + function Create() { global $Errors, $objSession; @@ -398,10 +409,10 @@ $this->SetUniqueId($this->adodbConnection->Insert_ID()); - - if ($this->adodbConnection->Affected_Rows() > 0) { + $this->DetectChanges(); + /*if ($this->adodbConnection->Affected_Rows() > 0) { $objSession->SetVariable("HasChanges", 1); - } + } */ return true; }