Merge pull request #12109 from frederic34/patch-15

keep a copy of object for trigger
This commit is contained in:
Laurent Destailleur 2019-10-14 21:03:35 +02:00 committed by GitHub
commit f3c627cb7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 3 deletions

View File

@ -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");

View File

@ -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)

View File

@ -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);
}

View File

@ -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 = clone $this->company;
return $this->company->delete($id);
}

View File

@ -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) {

View File

@ -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);
}