From 124ae92f334447e1ee79f95e46ea04c7ca5362d4 Mon Sep 17 00:00:00 2001
From: Peter Kessen
Date: Tue, 27 May 2025 20:11:44 +0200
Subject: [PATCH] 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
---
htdocs/core/lib/pdf.lib.php | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 3e9d1b4acff..96f9bbb2aca 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -908,7 +908,7 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0,
$pdf->line($curx + 1, $cury + 1, $curx + 1, $cury + 6);
}
-
+ $bank_number_length = 0;
foreach ($account->getFieldsToShow() as $val) {
$pdf->SetXY($curx, $cury + 4);
$pdf->SetFont('', '', $default_font_size - 3);
@@ -938,6 +938,10 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0,
break;
}
+ if ($content == '') {
+ continue;
+ }
+
$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($content), 0, 'C', false);
$pdf->SetXY($curx, $cury + 1);
$curx += $tmplength;
@@ -946,10 +950,13 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0,
if (empty($onlynumber)) {
$pdf->line($curx, $cury + 1, $curx, $cury + 7);
}
+
+ // Only set this variable when table was printed
+ $bank_number_length = 8;
}
$curx = $savcurx;
- $cury += 8;
+ $cury += $bank_number_length;
}
} elseif (!empty($account->number)) {
$pdf->SetFont('', 'B', $default_font_size - $diffsizecontent);