Clean code

This commit is contained in:
Laurent Destailleur 2026-04-02 19:03:53 +02:00
parent 5bb9afeb08
commit 125ba7b02f

View file

@ -1964,6 +1964,8 @@ class pdf_sponge extends ModelePDFFactures
if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) {
// Nothing to do
} else {
$tmpatleastoneratenotnull = 0;
// Local tax 1 before VAT
foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
if (in_array((string) $localtax_type, array('1', '3', '5'))) {
@ -1972,7 +1974,7 @@ class pdf_sponge extends ModelePDFFactures
foreach ($localtax_rate as $tvakey => $tvaval) {
if ($tvakey != 0 || getDolGlobalString('INVOICE_SHOW_ALSO_LOCALTAX1_LINE_IF_ZERO')) {
//$this->atleastoneratenotnull++;
//$tmpatleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@ -2010,7 +2012,7 @@ class pdf_sponge extends ModelePDFFactures
foreach ($localtax_rate as $tvakey => $tvaval) {
if ($tvakey != 0 || getDolGlobalString('INVOICE_SHOW_ALSO_LOCALTAX2_LINE_IF_ZERO')) {
//$this->atleastoneratenotnull++;
//$tmpatleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@ -2063,11 +2065,11 @@ class pdf_sponge extends ModelePDFFactures
}
}
if (!getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) {
if (!getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { // by default, we show detail of vat here
// VAT
foreach ($this->tva_array as $tvakey => $tvaval) {
if ($tvakey != 0 || getDolGlobalString('INVOICE_SHOW_ALSO_VAT_LINE_IF_ZERO')) {
$this->atleastoneratenotnull++;
$tmpatleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@ -2097,7 +2099,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
//Local tax 1 after VAT
// Local tax 1 after VAT
foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
if (in_array((string) $localtax_type, array('2', '4', '6'))) {
continue;
@ -2105,7 +2107,7 @@ class pdf_sponge extends ModelePDFFactures
foreach ($localtax_rate as $tvakey => $tvaval) {
if ($tvakey != 0 || getDolGlobalString('INVOICE_SHOW_ALSO_LOCALTAX1_LINE_IF_ZERO')) {
//$this->atleastoneratenotnull++;
//$tmpatleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@ -2134,7 +2136,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
//Local tax 2 after VAT
// Local tax 2 after VAT
foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
if (in_array((string) $localtax_type, array('2', '4', '6'))) {
continue;
@ -2143,7 +2145,7 @@ class pdf_sponge extends ModelePDFFactures
foreach ($localtax_rate as $tvakey => $tvaval) {
// retrieve global local tax
if ($tvakey != 0 || getDolGlobalString('INVOICE_SHOW_ALSO_LOCALTAX2_LINE_IF_ZERO')) {
//$this->atleastoneratenotnull++;
//$tmpatleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@ -2172,6 +2174,9 @@ class pdf_sponge extends ModelePDFFactures
}
}
$this->atleastoneratenotnull = $tmpatleastoneratenotnull;
// Revenue stamp
if (price2num($object->revenuestamp, 'MT') != 0) {
$index++;