mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Debug v21 - fix pb with setup of mandatory vat number
This commit is contained in:
parent
7bf28162a0
commit
bcca177bdf
|
|
@ -3325,10 +3325,17 @@ class Facture extends CommonInvoice
|
|||
}
|
||||
}
|
||||
if ($key == 'TVA_INTRA') {
|
||||
// Check for mandatory
|
||||
if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') && ($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra)) {
|
||||
// Check for mandatory vat number
|
||||
if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') == 'eeconly') {
|
||||
if (($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra) && $this->thirdparty->isInEEC()) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorProdIdIsMandatoryForEuThirdparties', $langs->transnoentitiesnoconv('VATIntra')).' ('.$langs->transnoentitiesnoconv("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
|
||||
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
} elseif (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') && ($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra)) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->trans('VATIntra')).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
|
||||
$this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transnoentitiesnoconv('VATIntra')).' ('.$langs->transnoentitiesnoconv("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
|
||||
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,6 +409,7 @@ SaleExport=Export sale
|
|||
SaleEEC=Sale in EEC
|
||||
SaleEECWithVAT=Sale in EEC with a VAT not null, so we suppose this is NOT an intracommunautary sale and the suggested account is the standard product account.
|
||||
SaleEECWithoutVATNumber=Sale in EEC with no VAT but the VAT ID of third party is not defined. We fall back on the account for standard sales. You can fix the VAT ID of the third party, or change the product account suggested for binding if needed.
|
||||
AnySale=Any sale
|
||||
ForbiddenTransactionAlreadyExported=Forbidden: The transaction has been validated and/or exported.
|
||||
ForbiddenTransactionAlreadyValidated=Forbidden: The transaction has been validated.
|
||||
DataMustHaveBeenTransferredInAccounting=The transfer of data in accounting must have been done
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be differen
|
|||
ErrorBadThirdPartyName=Bad value for third-party name
|
||||
ForbiddenBySetupRules=Forbidden by setup rules
|
||||
ErrorProdIdIsMandatory=The %s is mandatory
|
||||
ErrorProdIdIsMandatoryForEuThirdparties=The %s is mandatory for customers in EEC
|
||||
ErrorAccountancyCodeCustomerIsMandatory=The accountancy code of customer %s is mandatory
|
||||
ErrorAccountancyCodeSupplierIsMandatory=The accountancy code of supplier %s is mandatory
|
||||
ErrorBadCustomerCodeSyntax=Bad syntax for customer code
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
|||
* @var User $user
|
||||
*/
|
||||
|
||||
$langs->loadLangs(array("admin", "companies", "other"));
|
||||
$langs->loadLangs(array("admin", "accountancy", "companies", "other"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
|
|
@ -329,9 +329,11 @@ if ($action == 'setprofidmandatory') {
|
|||
}
|
||||
|
||||
//Activate ProfId invoice mandatory
|
||||
if ($action == 'setprofidinvoicemandatory') {
|
||||
if ($action == 'setprofidinvoicemandatory' || $action == 'setprofidinvoicemandatoryeeconly') {
|
||||
$status = GETPOST('status', 'alpha');
|
||||
|
||||
if ($status == '1' && $action == 'setprofidinvoicemandatoryeeconly') {
|
||||
$status = 'eeconly';
|
||||
}
|
||||
$idprof = "SOCIETE_".$value."_INVOICE_MANDATORY";
|
||||
$result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity);
|
||||
if ($result <= 0) {
|
||||
|
|
@ -777,31 +779,52 @@ print '<td colspan="2">'.$langs->trans('VATIntra')."</td>\n";
|
|||
$key = 'VAT_INTRA';
|
||||
if (getDolGlobalString('SOCIETE_VAT_INTRA_UNIQUE')) {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&token='.newToken().'&value='.$key.'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle"');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&token='.newToken().'&value='.$key.'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle"');
|
||||
print '</a></td>';
|
||||
}
|
||||
if (getDolGlobalString('SOCIETE_VAT_INTRA_MANDATORY')) {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&token='.newToken().'&value='.$key.'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle"');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&token='.newToken().'&value='.$key.'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle"');
|
||||
print '</a></td>';
|
||||
}
|
||||
if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY')) {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&token='.newToken().'&value='.$key.'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
print '<td class="center">';
|
||||
if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') == 'eeconly') {
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatoryeeconly&token='.newToken().'&value='.$key.'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle paddingrightonly"');
|
||||
print '</a>';
|
||||
print $langs->trans("SaleEEC").'<br>';
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&token='.newToken().'&value='.$key.'&status=1">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_off', 'class="valignmiddle paddingrightonly"');
|
||||
print '</a>';
|
||||
print $langs->trans("AnySale");
|
||||
} elseif (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY')) {
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatoryeeconly&token='.newToken().'&value='.$key.'&status=1">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_off', 'class="valignmiddle paddingrightonly"');
|
||||
print '</a>';
|
||||
print $langs->trans("SaleEEC").'<br>';
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&token='.newToken().'&value='.$key.'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle paddingrightonly"');
|
||||
print '</a>';
|
||||
print $langs->trans("AnySale");
|
||||
} else {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&token='.newToken().'&value='.$key.'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatoryeeconly&token='.newToken().'&value='.$key.'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle paddingrightonly"');
|
||||
print '</a>';
|
||||
print $langs->trans("SaleEEC").'<br>';
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&token='.newToken().'&value='.$key.'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle paddingrightonly"');
|
||||
print '</a>';
|
||||
print $langs->trans("AnySale");
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user