Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/helpers/priority_helper.php
Show First 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | |||||
{ | { | ||||
// TODO: no need pass external $constrain, since the one from $pair is used | // TODO: no need pass external $constrain, since the one from $pair is used | ||||
if ( !$changes ) { | if ( !$changes ) { | ||||
// no changes to process | // no changes to process | ||||
return Array (); | return Array (); | ||||
} | } | ||||
list ($id, $pair) = each($changes); | |||||
if ( !$id && !isset($pair['constrain']) ) { | |||||
// adding new item without constrain -> priority stays the same | |||||
return Array ($id); | |||||
} | |||||
$id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); | $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); | ||||
$table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); | $table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); | ||||
if ( $this->Application->IsTempMode($event->Prefix, $event->Special) ) { | if ( $this->Application->IsTempMode($event->Prefix, $event->Special) ) { | ||||
$table_name = $this->Application->GetTempName($table_name, 'prefix:' . $event->Prefix); | $table_name = $this->Application->GetTempName($table_name, 'prefix:' . $event->Prefix); | ||||
} | } | ||||
$ids = Array (); | $ids = Array (); | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Line(s) | |||||
WHERE ' . $dummy->TableName . '.' . $dummy->IDField . ' IN (' . implode(',', $ids) . ')'; | WHERE ' . $dummy->TableName . '.' . $dummy->IDField . ' IN (' . implode(',', $ids) . ')'; | ||||
$records = $this->Conn->Query($sql); | $records = $this->Conn->Query($sql); | ||||
foreach ($records as $record) { | foreach ($records as $record) { | ||||
$dummy->LoadFromHash($record); | $dummy->LoadFromHash($record); | ||||
$dummy->Update(); | $dummy->Update(); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
No newline at end of file |