2
0
forked from Wavyzz/dolibarr

Hide Bank Account number and Bank Code when field is empty (#34253)

* Skip empty value cells for bank information

* Save space for bank table when no info is present
This commit is contained in:
Peter Kessen
2025-05-27 20:11:44 +02:00
committed by GitHub
parent b6bb5c0e99
commit 124ae92f33

View File

@@ -908,7 +908,7 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0,
$pdf->line($curx + 1, $cury + 1, $curx + 1, $cury + 6); $pdf->line($curx + 1, $cury + 1, $curx + 1, $cury + 6);
} }
$bank_number_length = 0;
foreach ($account->getFieldsToShow() as $val) { foreach ($account->getFieldsToShow() as $val) {
$pdf->SetXY($curx, $cury + 4); $pdf->SetXY($curx, $cury + 4);
$pdf->SetFont('', '', $default_font_size - 3); $pdf->SetFont('', '', $default_font_size - 3);
@@ -938,6 +938,10 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0,
break; break;
} }
if ($content == '') {
continue;
}
$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($content), 0, 'C', false); $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($content), 0, 'C', false);
$pdf->SetXY($curx, $cury + 1); $pdf->SetXY($curx, $cury + 1);
$curx += $tmplength; $curx += $tmplength;
@@ -946,10 +950,13 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0,
if (empty($onlynumber)) { if (empty($onlynumber)) {
$pdf->line($curx, $cury + 1, $curx, $cury + 7); $pdf->line($curx, $cury + 1, $curx, $cury + 7);
} }
// Only set this variable when table was printed
$bank_number_length = 8;
} }
$curx = $savcurx; $curx = $savcurx;
$cury += 8; $cury += $bank_number_length;
} }
} elseif (!empty($account->number)) { } elseif (!empty($account->number)) {
$pdf->SetFont('', 'B', $default_font_size - $diffsizecontent); $pdf->SetFont('', 'B', $default_font_size - $diffsizecontent);