Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/db/dbitem.php
Show First 20 Lines • Show All 1142 Lines • ▼ Show 20 Line(s) | |||||
$changes = $this->Application->RecallVar($ses_var_name); | $changes = $this->Application->RecallVar($ses_var_name); | ||||
$changes = $changes ? unserialize($changes) : Array (); | $changes = $changes ? unserialize($changes) : Array (); | ||||
if ( $changes ) { | if ( $changes ) { | ||||
foreach ($changes as $key => $rec) { | foreach ($changes as $key => $rec) { | ||||
if ( $rec['Prefix'] == $this->Prefix && $rec['ItemId'] == $this->GetID() ) { | if ( $rec['Prefix'] == $this->Prefix && $rec['ItemId'] == $this->GetID() ) { | ||||
// change log for record, that's ID was just updated -> update in change log record too | // change log for record, that's ID was just updated -> update in change log record too | ||||
$changes[$key]['ItemId'] = $new_id; | $changes[$key]['ItemId'] = $new_id; | ||||
$changed_data = unserialize($rec['Changes']); | |||||
if ( isset($changed_data[$this->IDField]) ) { | |||||
$changed_data[$this->IDField] = $new_id; | |||||
} | |||||
$changes[$key]['Changes'] = serialize($changed_data); | |||||
} | } | ||||
if ( $rec['MasterPrefix'] == $this->Prefix && $rec['MasterId'] == $this->GetID() ) { | if ( $rec['MasterPrefix'] == $this->Prefix && $rec['MasterId'] == $this->GetID() ) { | ||||
// master item id was changed | // master item id was changed | ||||
$changes[$key]['MasterId'] = $new_id; | $changes[$key]['MasterId'] = $new_id; | ||||
} | } | ||||
if ( in_array($this->Prefix, $rec['ParentPrefix']) && $rec['ParentId'][$this->Prefix] == $this->GetID() ) { | if ( in_array($this->Prefix, $rec['ParentPrefix']) && $rec['ParentId'][$this->Prefix] == $this->GetID() ) { | ||||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Line(s) | |||||
} | } | ||||
switch ( $mode ) { | switch ( $mode ) { | ||||
case ChangeLog::UPDATE: | case ChangeLog::UPDATE: | ||||
$to_save = array_merge($this->GetTitleField(), $this->GetChangedFields()); | $to_save = array_merge($this->GetTitleField(), $this->GetChangedFields()); | ||||
break; | break; | ||||
case ChangeLog::CREATE: | case ChangeLog::CREATE: | ||||
if ( $this->Application->ConfigValue('StoreAddedRecordsDataInTheChangeLog') ) { | |||||
$to_save = array_merge($this->GetTitleField(), $this->GetRealFields()); | |||||
} | |||||
else { | |||||
$to_save = $this->GetTitleField(); | $to_save = $this->GetTitleField(); | ||||
} | |||||
break; | break; | ||||
case ChangeLog::DELETE: | case ChangeLog::DELETE: | ||||
$to_save = array_merge($this->GetTitleField(), $this->GetRealFields()); | $to_save = array_merge($this->GetTitleField(), $this->GetRealFields()); | ||||
break; | break; | ||||
default: | default: | ||||
$to_save = Array (); | $to_save = Array (); | ||||
▲ Show 20 Lines • Show All 311 Lines • Show Last 20 Lines |