Index: trunk/kernel/include/itemdb.php
===================================================================
diff -u -r826 -r836
--- trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 826)
+++ trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 836)
@@ -162,8 +162,9 @@
$var = "m_" . $name[$i];
if( !$this->HasField($name[$i]) || ($this->Data[$name[$i]] != $value[$i]))
{
+ $this->DetectChanges($name[$i], $value[$i]);
$this->Data[$name[$i]] = $value[$i];
- $this->m_dirtyFieldsMap[$name[$i]] = $value[$i];
+ $this->m_dirtyFieldsMap[$name[$i]] = $value[$i];
}
}
}
@@ -172,6 +173,7 @@
$var = "m_" . $name;
if( !$this->HasField($name) || $this->Data[$name] != $value )
{
+ $this->DetectChanges($name, $value);
$this->Data[$name] = $value;
$this->m_dirtyFieldsMap[$name] = $value;
}
@@ -270,8 +272,6 @@
$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')
@@ -374,17 +374,17 @@
return $sql;
}
- function DetectChanges()
+ function DetectChanges($name, $value)
{
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);
- }
- //}
- }
+ //print_pre($_POST);
+ //echo "$name: $value
";
+ if ($this->Data[$name] != $value && !strstr($name, 'Modif') && !strstr($name, 'Created')) {
+ //echo "$name Modified ".$this->Data[$name]." $value
";
+ if (!strstr($name, 'Hot') && !strstr($name, 'Pop')) {
+ $objSession->SetVariable("HasChanges", 1);
+ }
+ }
}
function Create()
@@ -409,7 +409,6 @@
$this->SetUniqueId($this->adodbConnection->Insert_ID());
- $this->DetectChanges();
/*if ($this->adodbConnection->Affected_Rows() > 0) {
$objSession->SetVariable("HasChanges", 1);
} */