From feaee97d9917a35935d3bbfaae286ee1ceaeba5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Tue, 10 Apr 2018 11:35:25 +0200 Subject: [PATCH] :ambulance: fix(mail) Fix foreign key on mail server oldvalue is now tested upon initialValue in case of SelectAttribute which refused a value not in the choices anymore. Errors when applying foreignKeys are displayed instead of ignored. issue #5810 --- include/simpleplugin/class_Attribute.inc | 4 ++-- include/simpleplugin/class_simplePlugin.inc | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc index 730b2a82a..52338aa01 100644 --- a/include/simpleplugin/class_Attribute.inc +++ b/include/simpleplugin/class_Attribute.inc @@ -711,12 +711,12 @@ class Attribute { if ($source['MODE'] == 'move') { if ($source['FIELD'] == 'dn') { - $value = $this->getValue(); + $value = $this->getInitialValue(); $value = preg_replace('/'.preg_quote($oldvalue, '/').'$/', $newvalue, $value, -1, $count); if ($count > 0) { $this->setValue($value); } - } elseif ($this->getValue() == $oldvalue) { + } elseif ($this->getInitialValue() == $oldvalue) { $this->setValue($newvalue); } } diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index 91023cd4d..0b2ef9f6f 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -1726,7 +1726,8 @@ class simplePlugin $pluginobject->save_object(); } } - $tabobject->save(); + $errors = $tabobject->save(); + msg_dialog::displayChecks($errors); } elseif ($mode == 'references') { // For each tab concerned foreach ($tabRefs['refs'] as $tab => $tab_infos) { -- GitLab