From bb21d048f476d749836ddfb29ac196e6487787f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 12 Oct 2019 22:08:11 +0200 Subject: [PATCH 1/7] keep a copy of object for trigger --- htdocs/contact/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 4139176e84e..9de1672db90 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -250,6 +250,7 @@ if (empty($reshook)) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->contact->supprimer) { $result=$object->fetch($id); + $object->oldcopy = clone $object; $object->old_lastname = GETPOST("old_lastname"); $object->old_firstname = GETPOST("old_firstname"); From 2d3a6d2108f5aa09853830c26d05defd155ee0da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:05:21 +0200 Subject: [PATCH 2/7] Update card.php --- htdocs/societe/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 39754b14fe0..e2a8f731856 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -817,6 +817,7 @@ if (empty($reshook)) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer) { $object->fetch($socid); + $object->oldcopy = clone $object; $result = $object->delete($socid, $user); if ($result > 0) From f6a2fd6eb88a31cf2a96dcfdd2d061a829d66884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:08:32 +0200 Subject: [PATCH 3/7] Update card.php --- htdocs/user/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index bdef850fa6b..edcb99678bb 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -156,6 +156,7 @@ if (empty($reshook)) { $object = new User($db); $object->fetch($id); + $object->oldcopy = clone $object; $result = $object->delete($user); if ($result < 0) { From 9eaad235640851791a4ea6fa013446c33fcf78a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:12:53 +0200 Subject: [PATCH 4/7] Update api_contacts.class.php --- htdocs/societe/class/api_contacts.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index b2432afe243..cfddddb7b96 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -292,7 +292,7 @@ class Contacts extends DolibarrApi { throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } - + $this->contact->oldcopy = clone $this->contact; return $this->contact->delete($id); } From 809d98129f5640ead0c2ee3601c66d66d5c13bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:14:45 +0200 Subject: [PATCH 5/7] Update api_thirdparties.class.php --- htdocs/societe/class/api_thirdparties.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 3d2104cc6f2..adcde4b0d5e 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -418,7 +418,7 @@ class Thirdparties extends DolibarrApi // External modules should update their ones too if (!$errors) { -$reshook = $hookmanager->executeHooks('replaceThirdparty', array( + $reshook = $hookmanager->executeHooks('replaceThirdparty', array( 'soc_origin' => $soc_origin->id, 'soc_dest' => $object->id ), $soc_dest, $action); @@ -488,6 +488,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( if( ! DolibarrApi::_checkAccessToResource('societe', $this->company->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } + $this->company->oldcopy = $this->company; return $this->company->delete($id); } From 0ae1e8c2a98990f7257c73d4a4a433849c5a257f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:17:57 +0200 Subject: [PATCH 6/7] Update api_users.class.php --- htdocs/user/class/api_users.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 72690c65dcb..9549fbe2ef1 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -350,7 +350,7 @@ class Users extends DolibarrApi { throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } - + $this->useraccount->oldcopy = clone $this->useraccount; return $this->useraccount->delete(DolibarrApiAccess::$user); } From 352df8241e6e9c8405563a2a22db3f82f06ab88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2019 06:19:40 +0200 Subject: [PATCH 7/7] Update api_thirdparties.class.php --- htdocs/societe/class/api_thirdparties.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index adcde4b0d5e..ed3b26e04ac 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -488,7 +488,7 @@ class Thirdparties extends DolibarrApi if( ! DolibarrApi::_checkAccessToResource('societe', $this->company->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $this->company->oldcopy = $this->company; + $this->company->oldcopy = clone $this->company; return $this->company->delete($id); }