FIX Linked elements not up to date (#32118)

* FIX Linked elements not up to date 

If you add a linked element, it won't appear without this correction, and if you delete an element, it won't disappear. You're forced to refresh the page to have the links updated, which is rather unpleasant.

* Update actions_dellink.inc.php

* Update actions_dellink.inc.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Zephyriony 2024-11-28 11:16:34 +01:00 committed by GitHub
parent 1b6ee9e654
commit d343807a04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,6 +50,7 @@ if ($action == 'addlink' && !empty($permissiondellink) && !$cancellink && $id >
foreach ($addlinkids as $addlinkid) {
$result = $object->add_object_linked($addlink, $addlinkid);
}
$object->clearObjectLinkedCache();
}
// Link by reference
@ -69,6 +70,7 @@ if ($action == 'addlinkbyref' && !empty($permissiondellink) && !$cancellink && $
if (isset($_POST['reftolinkto'])) {
unset($_POST['reftolinkto']);
}
$object->clearObjectLinkedCache();
} elseif ($ret < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else {
@ -81,6 +83,7 @@ if ($action == 'addlinkbyref' && !empty($permissiondellink) && !$cancellink && $
// Delete link in table llx_element_element
if ($action == 'dellink' && !empty($permissiondellink) && !$cancellink && $dellinkid > 0) {
$result = $object->deleteObjectLinked(0, '', 0, '', $dellinkid);
$object->clearObjectLinkedCache();
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}