Skip to content
Permalink
Browse files
Merge pull request #705 from ai91/alpha
Редактор простых устройств: не менять класс связанного объекта если он является подклассом выбранного типа
  • Loading branch information
sergejey committed Mar 9, 2020
2 parents 5fc210f + fac2f43 commit 3d2d13b4e07d664c9650ddf197f1a77fe435d37d
Showing 1 changed file with 12 additions and 2 deletions.
@@ -388,7 +388,17 @@
$object_rec['DESCRIPTION'] = $rec['TITLE'];
$object_rec['LOCATION_ID'] = $rec['LOCATION_ID'];
$class_changed = 0;
if ($object_rec['CLASS_ID'] != $class_id) {

$class_2b_changed = 1;
$tmp_class_id = $object_rec['CLASS_ID'];
while(IsSet($tmp_class_id)) {
if ($tmp_class_id == $class_id) {
$class_2b_changed = 0;
break;
}
$tmp_class_id = current(SQLSelectOne("SELECT PARENT_ID FROM classes WHERE ID=" . (int)$tmp_class_id));
}
if ($class_2b_changed) {
//move object to new class
$object_rec['CLASS_ID'] = $class_id;
$class_changed = 1;
@@ -479,4 +489,4 @@
if ($rec['TYPE']) {
$other_devices_type = SQLSelect("SELECT ID, TITLE FROM devices WHERE TYPE='" . $rec['TYPE'] . "'");
$out['OTHER_DEVICES_TYPE'] = $other_devices_type;
}
}

0 comments on commit 3d2d13b

Please sign in to comment.