Merge pull request #23613 from noec764/14_FIX_Errors_handling_CreateFrom_Hooks

FIX: Errors Handling for CreateFrom Hooks
This commit is contained in:
Laurent Destailleur 2023-01-18 20:04:15 +01:00 committed by GitHub
commit 0fd085d5bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 27 additions and 0 deletions

View File

@ -708,6 +708,8 @@ class ActionComm extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->errors += $hookmanager->errors;
$this->error = $hookmanager->error;
$error++;
}
}

View File

@ -567,6 +567,7 @@ if (empty($reshook)) {
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++;
}
} else {

View File

@ -1412,6 +1412,8 @@ class Propal extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->errors += $hookmanager->errors;
$this->error = $hookmanager->error;
$error++;
}
}

View File

@ -445,6 +445,7 @@ if (empty($reshook)) {
// Note that $action and $object may be modified by hook
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++;
}
} else {

View File

@ -1252,6 +1252,8 @@ class Commande extends CommonOrder
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->errors += $hookmanager->errors;
$this->error = $hookmanager->error;
$error++;
}
}
@ -1406,6 +1408,8 @@ class Commande extends CommonOrder
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->errors += $hookmanager->errors;
$this->error = $hookmanager->error;
$error++;
}

View File

@ -1299,6 +1299,8 @@ class Facture extends CommonInvoice
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->errors += $hookmanager->errors;
$this->error = $hookmanager->error;
$error++;
}
}
@ -1432,6 +1434,8 @@ class Facture extends CommonInvoice
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->errors += $hookmanager->errors;
$this->error = $hookmanager->error;
$error++;
}

View File

@ -341,6 +341,7 @@ if (empty($reshook)) {
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++;
}
} else {

View File

@ -2564,6 +2564,8 @@ class Contrat extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->errors += $hookmanager->errors;
$this->error = $hookmanager->error;
$error++;
}
}

View File

@ -455,6 +455,8 @@ class ExpenseReport extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->errors += $hookmanager->errors;
$this->error = $hookmanager->error;
$error++;
}
}

View File

@ -1211,6 +1211,8 @@ class Fichinter extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->errors += $hookmanager->errors;
$this->error = $hookmanager->error;
$error++;
}
}

View File

@ -1654,6 +1654,8 @@ class CommandeFournisseur extends CommonOrder
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->errors += $hookmanager->errors;
$this->error = $hookmanager->error;
$error++;
}
}

View File

@ -1314,6 +1314,7 @@ if (empty($reshook)) {
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++;
}
} else {

View File

@ -407,6 +407,7 @@ if (empty($reshook)) {
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++;
}
} else {

View File

@ -1160,6 +1160,8 @@ class SupplierProposal extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->errors += $hookmanager->errors;
$this->error = $hookmanager->error;
$error++;
}
}