Fix Loop in trigger with CommandeFournisseur::createFromClone

added param $notrigger to avoid an infinite loop when createFromClone calls create
This commit is contained in:
ibuiv 2021-04-13 20:19:02 +02:00 committed by GitHub
parent f54fd1063b
commit 2a391dc13f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1556,9 +1556,10 @@ class CommandeFournisseur extends CommonOrder
*
* @param User $user User making the clone
* @param int $socid Id of thirdparty
* @param int $notrigger Disable all triggers
* @return int New id of clone
*/
public function createFromClone(User $user, $socid = 0)
public function createFromClone(User $user, $socid = 0, $notrigger = 0)
{
global $conf, $user, $hookmanager;
@ -1605,7 +1606,7 @@ class CommandeFournisseur extends CommonOrder
// Create clone
$this->context['createfromclone'] = 'createfromclone';
$result = $this->create($user);
$result = $this->create($user, $notrigger);
if ($result < 0) {
$error++;
}