Index: branches/RC/core/units/general/helpers/priority_helper.php =================================================================== diff -u -N -r11610 -r11668 --- branches/RC/core/units/general/helpers/priority_helper.php (.../priority_helper.php) (revision 11610) +++ branches/RC/core/units/general/helpers/priority_helper.php (.../priority_helper.php) (revision 11668) @@ -64,15 +64,23 @@ */ function updatePriorities(&$event, $changes, $new_ids, $constrain = '') { + if (!$changes) { + // no changes to process + return Array (); + } + list ($id, $pair) = each($changes); + + if (!$id && !array_key_exists('parent', $pair)) { + // adding new item without constrain -> priority stays the same + return Array ($id); + } + $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); $table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); + $ids = array(); $not_processed = array_keys($changes); - if(!$not_processed || !getArrayValue($not_processed, 0)) { - return $not_processed; - } - $ids = array(); foreach ($changes as $id => $pair) { array_push($ids, $id); $constrain = isset($pair['parent']) ? 'ParentId = '.$pair['parent'].' AND ' : '';