Skip to content

Commit

Permalink
fix #2718
Browse files Browse the repository at this point in the history
  • Loading branch information
zoic21 committed Jun 29, 2024
1 parent 59d2fc8 commit 340e61b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/ajax/update.ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@

if (init('action') == 'saves') {
unautorizedInDemo();
utils::processJsonObject('update', init('updates'));
utils::processJsonObject('update', init('updates'),null,false);
ajax::success();
}

Expand Down
10 changes: 6 additions & 4 deletions core/class/utils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static function a2o(&$_object, $_data) {
}
}

public static function processJsonObject($_class, $_ajaxList, $_dbList = null) {
public static function processJsonObject($_class, $_ajaxList, $_dbList = null,$_remove = true) {
if (!is_array($_ajaxList)) {
if (is_json($_ajaxList)) {
$_ajaxList = json_decode($_ajaxList, true);
Expand All @@ -139,9 +139,11 @@ public static function processJsonObject($_class, $_ajaxList, $_dbList = null) {
$object->save();
$enableList[$object->getId()] = true;
}
foreach ($_dbList as $dbObject) {
if (!isset($enableList[$dbObject->getId()])) {
$dbObject->remove();
if($_remove){
foreach ($_dbList as $dbObject) {
if (!isset($enableList[$dbObject->getId()])) {
$dbObject->remove();
}
}
}
}
Expand Down

0 comments on commit 340e61b

Please sign in to comment.