Merge pull request #20717 from aspangaro/16a21
FIX Check field accountancy code customer is mandatory in mass action
This commit is contained in:
commit
3a80ece0fd
@ -2724,7 +2724,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Check for mandatory fields in thirdparty (defined into setup)
|
||||
if (!empty($this->thirdparty) && is_object($this->thirdparty)) {
|
||||
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL');
|
||||
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'ACCOUNTANCY_CODE_CUSTOMER');
|
||||
foreach ($array_to_check as $key) {
|
||||
$keymin = strtolower($key);
|
||||
if (!property_exists($this->thirdparty, $keymin)) {
|
||||
@ -2756,6 +2756,15 @@ class Facture extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') {
|
||||
// Check for mandatory
|
||||
if (!empty($conf->global->SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY) && empty($this->thirdparty->code_compta)) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans("ErrorAccountancyCodeCustomerIsMandatory", $this->thirdparty->name).' ('.$langs->trans("ForbiddenBySetupRules").')';
|
||||
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user