From 15cc0f8775147ccc2db3a1f7a000218b27badace Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Mar 2021 23:09:07 +0100 Subject: [PATCH] Avoid php errors if negative var in Receipt Module Solved in develop branch with PR https://github.com/Dolibarr/dolibarr/pull/15994/files After testing we introduce it in version 13 --- htdocs/core/class/dolreceiptprinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index e075005b437..b984f1ab2ce 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -634,7 +634,7 @@ class dolReceiptPrinter extends Printer if ($line->fk_product) { $spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen($line->qty) - 10 - 1; - $spaces = str_repeat(' ', $spacestoadd); + $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $this->printer->text($line->ref.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n"); $this->printer->text(strip_tags(htmlspecialchars_decode($line->product_label))."\n"); }