"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.
This commit is contained in:
parent
110d8b7485
commit
6c46257bb5
1 changed files with 3 additions and 2 deletions
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Rafael San José <rsanjose@alxarafe.com>
|
||||
*
|
||||
* 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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue