From 6c46257bb5a8694f2d8a749d7fc2a3600faad279 Mon Sep 17 00:00:00 2001 From: rsanjoseo Date: Thu, 28 Mar 2024 09:02:55 +0100 Subject: [PATCH] "Fatal error: Uncaught Error: Call to undefined method stdClass::del_to_abo()" is resolved. When editing a adherent that does not have an email and giving it one, the following error is thrown as the oldcopy attribute is a stdClass. This is fixed by checking that the del_to_abo method exists on the object before trying to use it. --- .../interface_50_modMailmanspip_Mailmanspipsynchro.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php index a73a0eb2eb4..7a3f761bd50 100644 --- a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php @@ -1,7 +1,8 @@ * Copyright (C) 2014 Marcos García - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Rafael San José * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -115,7 +116,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers // Add user into some linked tools (mailman, spip, etc...) if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) { if (is_object($object->oldcopy) && (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))) { // If email has changed or if list has changed we delete mailman subscription for old email - if ($object->oldcopy->del_to_abo() < 0) { + if (method_exists($object->oldcopy, 'del_to_abo') && $object->oldcopy->del_to_abo() < 0) { $this->errors = $object->oldcopy->errors; if (!empty($object->oldcopy->error)) { $this->errors[] = $object->oldcopy->error;