mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'Dolibarr:develop' into develop
This commit is contained in:
commit
5868a9749d
|
|
@ -610,7 +610,7 @@ if (empty($reshook)) {
|
|||
// Check parameters
|
||||
|
||||
// Check for mandatory fields in thirdparty (defined into setup)
|
||||
$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);
|
||||
$i = (int) preg_replace('/[^0-9]/', '', $key);
|
||||
|
|
@ -638,6 +638,14 @@ if (empty($reshook)) {
|
|||
setEventMessages($langs->trans("ErrorBadEMail", $object->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
|
||||
}
|
||||
}
|
||||
if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') {
|
||||
// Check for mandatory
|
||||
if (!empty($conf->global->SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY) && empty($object->thirdparty->code_compta)) {
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorAccountancyCodeCustomerIsMandatory", $object->thirdparty->name).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1622,7 +1622,7 @@ class Facture extends CommonInvoice
|
|||
if ($rowid) {
|
||||
$sql .= " WHERE f.rowid=".((int) $rowid);
|
||||
} else {
|
||||
$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; // Dont't use entity if you use rowid
|
||||
$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; // Don't use entity if you use rowid
|
||||
if ($ref) {
|
||||
$sql .= " AND f.ref='".$this->db->escape($ref)."'";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,27 +124,25 @@ if ($action == 'presend') {
|
|||
|
||||
if ($object->element === 'facture' && !empty($conf->global->INVOICE_EMAIL_SENDER)) {
|
||||
$formmail->frommail = $conf->global->INVOICE_EMAIL_SENDER;
|
||||
$formmail->fromname = '';
|
||||
$formmail->fromname = (!empty($conf->global->INVOICE_EMAIL_SENDER_NAME) ? $conf->global->INVOICE_EMAIL_SENDER_NAME : '');
|
||||
$formmail->fromtype = 'special';
|
||||
}
|
||||
if ($object->element === 'shipping' && !empty($conf->global->SHIPPING_EMAIL_SENDER)) {
|
||||
$formmail->frommail = $conf->global->SHIPPING_EMAIL_SENDER;
|
||||
$formmail->fromname = '';
|
||||
$formmail->fromname = (!empty($conf->global->SHIPPING_EMAIL_SENDER_NAME) ? $conf->global->SHIPPING_EMAIL_SENDER_NAME : '');
|
||||
$formmail->fromtype = 'special';
|
||||
}
|
||||
if ($object->element === 'commande' && !empty($conf->global->COMMANDE_EMAIL_SENDER)) {
|
||||
$formmail->frommail = $conf->global->COMMANDE_EMAIL_SENDER;
|
||||
$formmail->fromname = '';
|
||||
$formmail->fromname = (!empty($conf->global->COMMANDE_EMAIL_SENDER_NAME) ? $conf->global->COMMANDE_EMAIL_SENDER_NAME : '');
|
||||
$formmail->fromtype = 'special';
|
||||
}
|
||||
if ($object->element === 'order_supplier' && !empty($conf->global->ORDER_SUPPLIER_EMAIL_SENDER)) {
|
||||
$formmail->frommail = $conf->global->ORDER_SUPPLIER_EMAIL_SENDER;
|
||||
$formmail->fromname = '';
|
||||
$formmail->fromname = (!empty($conf->global->ORDER_SUPPLIER_EMAIL_SENDER_NAME) ? $conf->global->ORDER_SUPPLIER_EMAIL_SENDER_NAME : '');
|
||||
$formmail->fromtype = 'special';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$formmail->trackid = $trackid;
|
||||
$formmail->withfrom = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ ErrorThisContactIsAlreadyDefinedAsThisType=This contact is already defined as co
|
|||
ErrorCashAccountAcceptsOnlyCashMoney=This bank account is a cash account, so it accepts payments of type cash only.
|
||||
ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be different.
|
||||
ErrorBadThirdPartyName=Bad value for third-party name
|
||||
ForbiddenBySetupRules=Forbidden by setup rules
|
||||
ErrorProdIdIsMandatory=The %s is mandatory
|
||||
ErrorAccountancyCodeCustomerIsMandatory=The accountancy code of customer %s is mandatory
|
||||
ErrorBadCustomerCodeSyntax=Bad syntax for customer code
|
||||
ErrorBadBarCodeSyntax=Bad syntax for barcode. May be you set a bad barcode type or you defined a barcode mask for numbering that does not match value scanned.
|
||||
ErrorCustomerCodeRequired=Customer code required
|
||||
|
|
|
|||
|
|
@ -170,6 +170,20 @@ if ($action == 'setdoc') {
|
|||
}
|
||||
}
|
||||
|
||||
//Activate Set accountancy code customer invoice mandatory
|
||||
if ($action == "setaccountancycodecustomerinvoicemandatory") {
|
||||
$setaccountancycodecustomerinvoicemandatory = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY", $setaccountancycodecustomerinvoicemandatory, 'yesno', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
//Activate Set ref in list
|
||||
if ($action == "setaddrefinlist") {
|
||||
$setaddrefinlist = GETPOST('value', 'int');
|
||||
|
|
@ -710,6 +724,23 @@ foreach ($profid as $key => $val) {
|
|||
$i++;
|
||||
}
|
||||
|
||||
if ($conf->accounting->enabled) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="2">'.$langs->trans('CustomerAccountancyCodeShort')."</td>\n";
|
||||
print '<td colspan="2"></td>';
|
||||
|
||||
if (!empty($conf->global->SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY)) {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaccountancycodecustomerinvoicemandatory&token='.newToken().'&value=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaccountancycodecustomerinvoicemandatory&token='.newToken().'&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user