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;
|
return -2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->error = $subscription->error;
|
$this->setErrorsFromObject($subscription);
|
||||||
$this->errors = $subscription->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1790,13 +1789,11 @@ class Adherent extends CommonObject
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $acct->error;
|
$this->setErrorsFromObject($acct);
|
||||||
$this->errors = $acct->errors;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $acct->error;
|
$this->setErrorsFromObject($acct);
|
||||||
$this->errors = $acct->errors;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -742,8 +742,7 @@ class ActionComm extends CommonObject
|
|||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$this->errors += $hookmanager->errors;
|
$this->setErrorsFromObject($hookmanager);
|
||||||
$this->error = $hookmanager->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1505,8 +1505,7 @@ class Propal extends CommonObject
|
|||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$this->errors += $hookmanager->errors;
|
$this->setErrorsFromObject($hookmanager);
|
||||||
$this->error = $hookmanager->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1279,8 +1279,7 @@ class Commande extends CommonOrder
|
|||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$this->errors += $hookmanager->errors;
|
$this->setErrorsFromObject($hookmanager);
|
||||||
$this->error = $hookmanager->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1436,8 +1435,7 @@ class Commande extends CommonOrder
|
|||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$this->errors += $hookmanager->errors;
|
$this->setErrorsFromObject($hookmanager);
|
||||||
$this->error = $hookmanager->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1330,8 +1330,7 @@ class Facture extends CommonInvoice
|
|||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$this->errors += $hookmanager->errors;
|
$this->setErrorsFromObject($hookmanager);
|
||||||
$this->error = $hookmanager->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1465,8 +1464,7 @@ class Facture extends CommonInvoice
|
|||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$this->errors += $hookmanager->errors;
|
$this->setErrorsFromObject($hookmanager);
|
||||||
$this->error = $hookmanager->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2630,8 +2630,7 @@ class Contrat extends CommonObject
|
|||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$this->errors += $hookmanager->errors;
|
$this->setErrorsFromObject($hookmanager);
|
||||||
$this->error = $hookmanager->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -669,6 +669,23 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
return -1;
|
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
|
* getTooltipContentArray
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1672,7 +1672,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
|
|||||||
if (!array_key_exists($level, $logLevels)) {
|
if (!array_key_exists($level, $logLevels)) {
|
||||||
throw new Exception('Incorrect log level');
|
throw new Exception('Incorrect log level');
|
||||||
}
|
}
|
||||||
if ($level > $conf->global->SYSLOG_LEVEL) {
|
if ($level > getDolGlobalInt('SYSLOG_LEVEL')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -512,8 +512,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$this->errors += $hookmanager->errors;
|
$this->setErrorsFromObject($hookmanager);
|
||||||
$this->error = $hookmanager->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1249,8 +1249,7 @@ class Fichinter extends CommonObject
|
|||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$this->errors += $hookmanager->errors;
|
$this->setErrorsFromObject($hookmanager);
|
||||||
$this->error = $hookmanager->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1758,8 +1758,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$this->errors += $hookmanager->errors;
|
$this->setErrorsFromObject($hookmanager);
|
||||||
$this->error = $hookmanager->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1175,8 +1175,7 @@ class SupplierProposal extends CommonObject
|
|||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$this->errors += $hookmanager->errors;
|
$this->setErrorsFromObject($hookmanager);
|
||||||
$this->error = $hookmanager->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user