From d17ecbeccda8265be541758e53e3886daa53f1f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Nov 2020 20:56:11 +0100 Subject: [PATCH] Fix #15438 --- .../modules/commande/doc/pdf_eratosthene.modules.php | 11 +++++++++++ .../core/modules/facture/doc/pdf_sponge.modules.php | 11 +++++++++++ htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 11 +++++++++++ 3 files changed, 33 insertions(+) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 1910dd0c048..d936fd75a30 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1780,6 +1780,17 @@ class pdf_eratosthene extends ModelePDFCommandes 'border-left' => true, // add left line separator ); + // Adapt dynamically the width of subprice, if text is too long. + $tmpwidth = 0; + $nblines = count($object->lines); + for ($i = 0; $i < $nblines; $i++) { + $tmpwidth2 = dol_strlen(dol_string_nohtmltag(pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails))); + $tmpwidth = max($tmpwidth, $tmpwidth2); + } + if ($tmpwidth > 10) { + $this->cols['subprice']['width'] += (2 * ($tmpwidth - 10)); + } + $rank = $rank + 10; $this->cols['qty'] = array( 'rank' => $rank, diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 8f48f31fddb..94eeca2a8ab 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -2307,6 +2307,17 @@ class pdf_sponge extends ModelePDFFactures 'border-left' => true, // add left line separator ); + // Adapt dynamically the width of subprice, if text is too long. + $tmpwidth = 0; + $nblines = count($object->lines); + for ($i = 0; $i < $nblines; $i++) { + $tmpwidth2 = dol_strlen(dol_string_nohtmltag(pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails))); + $tmpwidth = max($tmpwidth, $tmpwidth2); + } + if ($tmpwidth > 10) { + $this->cols['subprice']['width'] += (2 * ($tmpwidth - 10)); + } + $rank = $rank + 10; $this->cols['qty'] = array( 'rank' => $rank, diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 1af66ca645e..fce874d7bdf 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1933,6 +1933,17 @@ class pdf_cyan extends ModelePDFPropales 'border-left' => true, // add left line separator ); + // Adapt dynamically the width of subprice, if text is too long. + $tmpwidth = 0; + $nblines = count($object->lines); + for ($i = 0; $i < $nblines; $i++) { + $tmpwidth2 = dol_strlen(dol_string_nohtmltag(pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails))); + $tmpwidth = max($tmpwidth, $tmpwidth2); + } + if ($tmpwidth > 10) { + $this->cols['subprice']['width'] += (2 * ($tmpwidth - 10)); + } + $rank = $rank + 10; $this->cols['qty'] = array( 'rank' => $rank,