Merge pull request #24039 from frederic34/setErrorsFromObject
set errors from object
This commit is contained in:
commit
f496d4887c
@ -1726,8 +1726,7 @@ class Adherent extends CommonObject
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
$this->error = $subscription->error;
|
||||
$this->errors = $subscription->errors;
|
||||
$this->setErrorsFromObject($subscription);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -1790,13 +1789,11 @@ class Adherent extends CommonObject
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$this->error = $acct->error;
|
||||
$this->errors = $acct->errors;
|
||||
$this->setErrorsFromObject($acct);
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$this->error = $acct->error;
|
||||
$this->errors = $acct->errors;
|
||||
$this->setErrorsFromObject($acct);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -742,8 +742,7 @@ 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;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1505,8 +1505,7 @@ 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;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1279,8 +1279,7 @@ 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;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -1436,8 +1435,7 @@ 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;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
@ -1330,8 +1330,7 @@ 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;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -1465,8 +1464,7 @@ 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;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
@ -2630,8 +2630,7 @@ 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;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -669,6 +669,23 @@ abstract class CommonObject
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* setErrorsFromObject
|
||||
*
|
||||
* @param CommonObject $object commonobject
|
||||
* @return void
|
||||
*/
|
||||
public function setErrorsFromObject($object)
|
||||
{
|
||||
if (!empty($object->error)) {
|
||||
$this->error = $object->error;
|
||||
}
|
||||
if (!empty($object->errors)) {
|
||||
$this->errors = array_merge($this->errors, $object->errors);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getTooltipContentArray
|
||||
*
|
||||
|
||||
@ -1672,7 +1672,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
|
||||
if (!array_key_exists($level, $logLevels)) {
|
||||
throw new Exception('Incorrect log level');
|
||||
}
|
||||
if ($level > $conf->global->SYSLOG_LEVEL) {
|
||||
if ($level > getDolGlobalInt('SYSLOG_LEVEL')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -512,8 +512,7 @@ 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;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1249,8 +1249,7 @@ 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;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1758,8 +1758,7 @@ 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;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1175,8 +1175,7 @@ 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;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user