From d81c124b77f585cbf1c06365dd55a0ea2493f32e Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 28 Feb 2025 11:55:32 +0100 Subject: [PATCH 01/19] Fix setup default value --- htdocs/core/class/html.formsetup.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index efc97ad63f2..392fa8232c1 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -700,10 +700,10 @@ class FormSetupItem { global $conf; if (isset($conf->global->{$this->confKey})) { - $this->fieldValue = getDolGlobalString($this->confKey); + $this->fieldValue = getDolGlobalString($this->confKey, null); return true; } else { - $this->fieldValue = ''; + $this->fieldValue = null; return false; } } From 1418bb9157a9fcc18ef4eda8583ce4abd58193b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Mar 2025 11:51:53 +0100 Subject: [PATCH 02/19] fix CI branch 21.0 --- htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index f1469969582..e2af25918ee 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -794,9 +794,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Show square if ($pagenb == $pageposbeforeprintlines) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); } $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; From 1796050a6d45c34085106289b3fb6c4d01bed445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Mar 2025 11:56:57 +0100 Subject: [PATCH 03/19] Update export_files.php --- htdocs/admin/tools/export_files.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index bc52bcadc4a..6c9ed65f840 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -165,6 +165,7 @@ if ($compression == 'zip') { } } + global $errormsg; $ret = dol_compress_dir($fulldirtocompress, $outputdir."/".$file, $compression, $excludefiles, $rootdirinzip); if ($ret < 0) { if ($ret == -2) { From 6c632259291469a0d22609f1a81c62a1c5a9d8c1 Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Sun, 2 Mar 2025 14:59:25 +0100 Subject: [PATCH 04/19] TraceableDB: add missing regexpsql() wrapper The TraceableDB must also redirect to the underlying database object for regexpsql queries, otherwise, a DoliDBPgsql DB with the debugbar enabled would try to use REGEXP() commands which are not supported on Postgresql. --- htdocs/debugbar/class/TraceableDB.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 9211e8e5fae..2d4a98c47a6 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -86,6 +86,19 @@ class TraceableDB extends DoliDB return $this->db->ifsql($test, $resok, $resko); } + /** + * format a sql regexp + * + * @param string $subject field name to test + * @param string $pattern sql pattern to match + * @param int $sqlstring 0=the string being tested is a hard coded string, 1=the string is a field + * @return string sql string + */ + public function regexpsql($subject, $pattern, $sqlstring = 0): string + { + return $this->db->regexpsql($subject, $pattern, $sqlstring = 0); + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return datas as an array From c2aa1fe7a6c30b9f95f477daf4ea709311d4d698 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sun, 2 Mar 2025 18:44:04 +0100 Subject: [PATCH 05/19] Missing log for services --- htdocs/core/lib/website2.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index b0a6d59b935..a465e140ac1 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -183,7 +183,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= "} // Not already loaded\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; - if (in_array($objectpage->type_container, array('page', 'blogpost'))) { + if (in_array($objectpage->type_container, array('page', 'blogpost', 'service'))) { $tplcontent .= 'dol_syslog("--- Prepare content of page '.((int) $objectpage->id).' - '.$objectpage->pageurl.'");'."\n"; } $tplcontent .= "ob_start();\n"; @@ -373,7 +373,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= "} // Not already loaded\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; - if (in_array($objectpage->type_container, array('page', 'blogpost'))) { + if (in_array($objectpage->type_container, array('page', 'blogpost', 'service'))) { $tplcontent .= 'dol_syslog("--- Prepare content of page '.((int) $objectpage->id).' - '.$objectpage->pageurl.'");'."\n"; } $tplcontent .= "// END PHP ?>\n"; From 812d9ad05186d439689f900d8dfaf9c5184b148c Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sun, 2 Mar 2025 19:13:06 +0100 Subject: [PATCH 06/19] Debug v12 - fix delay of cache --- htdocs/core/lib/website.lib.php | 2 +- htdocs/viewimage.php | 11 ++++------- htdocs/website/samples/wrapper.php | 4 +++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index c9844e27f17..bbc77d1a452 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -558,7 +558,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri unset($tmpwebsitepage); } if ($result > 0) { - $currenturi = $_SERVER["REQUEST_URI"]; // Example: /public/website/index.php?website=mywebsite.com&pageref=mywebsite-home&nocache=1708177483 + $currenturi = $_SERVER["REQUEST_URI"]; // Example: /public/website/index.php?website=mywebsite.com&pageref=mywebsite-home&cache=3600 $regtmp = array(); if (preg_match('/&pageref=([^&]+)/', $currenturi, $regtmp)) { if ($regtmp[0] == $containerref) { diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 1bbf7224a02..899fffa181b 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -189,20 +189,17 @@ if ($modulepart == 'fckeditor') { * View */ -if (GETPOST("cache", 'alpha')) { +$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int, or a hash +if ($cachestring) { // Important: The following code is to avoid a page request by the browser and PHP CPU at each Dolibarr page access. // We are here when param cache=xxx to force a cache policy: // xxx=1 means cache of 3600s // xxx=abcdef or 123456789 means a cache of 1 week (the key will be modified to get break cache use) if (empty($dolibarr_nocache)) { - if (GETPOST('cache', 'alpha') != '1') { - $delaycache = 3600 * 24 * 7; - } else { - $delaycache = 3600; - } + $delaycache = ((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600'); header('Cache-Control: max-age='.$delaycache.', public, must-revalidate'); header('Pragma: cache'); // This is to avoid to have Pragma: no-cache set by proxy or web server - header('Expires: '.gmdate('D, d M Y H:i:s', time() + $delaycache).' GMT'); // This is to avoid to have Expires set by proxy or web server + header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $delaycache).' GMT'); // This is to avoid to have Expires set by proxy or web server } else { // If any cache on files were disable by config file (for test purpose) header('Cache-Control: no-cache'); diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index 51c6c2500bb..db6b93846f5 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -133,8 +133,10 @@ $cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int, or a hash if ($cachestring || image_format_supported($original_file) >= 0) { // Important: Following code is to avoid page request by browser and PHP CPU at // each Dolibarr page access. - header('Cache-Control: max-age='.((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600').', public, must-revalidate'); + $delaycache = ((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600'); + header('Cache-Control: max-age='.$cachedelay.', public, must-revalidate'); header('Pragma: cache'); // This is to avoid having Pragma: no-cache + header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $delaycache).' GMT'); // This is to avoid to have Expires set by proxy or web server } $refname = basename(dirname($original_file)."/"); From 035c99589e6f3650ce935f809f607ad588c2e340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20St=C5=99=C3=ADbrn=C3=BD?= <35335130+kubajznik@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:07:12 +0200 Subject: [PATCH 07/19] add professional id 7-10 to mysoc --- htdocs/societe/class/societe.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 95a40d04e12..97a7adebb1b 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4630,6 +4630,10 @@ class Societe extends CommonObject $this->idprof4 = getDolGlobalString('MAIN_INFO_RCS'); $this->idprof5 = getDolGlobalString('MAIN_INFO_PROFID5'); $this->idprof6 = getDolGlobalString('MAIN_INFO_PROFID6'); + $this->idprof7 = getDolGlobalString('MAIN_INFO_PROFID7'); + $this->idprof8 = getDolGlobalString('MAIN_INFO_PROFID8'); + $this->idprof9 = getDolGlobalString('MAIN_INFO_PROFID9'); + $this->idprof10 = getDolGlobalString('MAIN_INFO_PROFID10'); $this->tva_intra = getDolGlobalString('MAIN_INFO_TVAINTRA'); // VAT number, not necessarily INTRA. $this->managers = getDolGlobalString('MAIN_INFO_SOCIETE_MANAGERS'); $this->capital = is_numeric(getDolGlobalString('MAIN_INFO_CAPITAL')) ? (float) price2num(getDolGlobalString('MAIN_INFO_CAPITAL')) : 0; From ef387308c20750234a78cab44eecfe302bbda95a Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 3 Mar 2025 01:36:59 +0100 Subject: [PATCH 08/19] Debug v21 - Fix cache delay --- htdocs/website/samples/wrapper.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index db6b93846f5..2aaa9d67ba5 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -38,7 +38,6 @@ $limit = GETPOSTINT('limit'); if ($limit <= 0 || $limit > 100) { $limit = 20; } -$cachedelay = GETPOSTINT('cachedelay'); // The delay in second of the cache // Parameters for RSS $rss = GETPOST('rss', 'aZ09'); @@ -129,12 +128,11 @@ if (GETPOSTISSET('type')) { $original_file = str_replace("../", "/", $original_file); // Cache or not -$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int, or a hash +$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int (delay in second of the cache if < 999999, or a timestamp), or a hash if ($cachestring || image_format_supported($original_file) >= 0) { - // Important: Following code is to avoid page request by browser and PHP CPU at - // each Dolibarr page access. - $delaycache = ((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600'); - header('Cache-Control: max-age='.$cachedelay.', public, must-revalidate'); + // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. + $delaycache = GETPOSTINT('cachedelay') ? GETPOSTINT('cachedelay') : ((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600'); + header('Cache-Control: max-age='.$delaycache.', public, must-revalidate'); header('Pragma: cache'); // This is to avoid having Pragma: no-cache header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $delaycache).' GMT'); // This is to avoid to have Expires set by proxy or web server } From 778482d4be21f3eec5dcefc8f61b83b8c720ce76 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 3 Mar 2025 03:11:27 +0100 Subject: [PATCH 09/19] Fix bad link to payment (forum https://www.dolibarr.fr/forum/t/liens-de-paiement-sur-les-pdf/46733/28) --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_octopus.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 026b03ad970..ebbaedfbc06 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1259,7 +1259,7 @@ class pdf_crabe extends ModelePDFFactures $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); + $paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, '', '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index c958a8549c9..2b06f336901 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1462,7 +1462,7 @@ class pdf_octopus extends ModelePDFFactures $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); + $paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, '', '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 548d40bcb72..620fc2cc8c2 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1363,7 +1363,7 @@ class pdf_sponge extends ModelePDFFactures $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); - $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); + $paiement_url = getOnlinePaymentUrl(0, 'invoice', $object->ref, '', '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->SetXY($this->marge_gauche, $posy); From 06854f00e5a52e57d8fa61b83314d1c199c925ec Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Mon, 3 Mar 2025 07:34:42 +0100 Subject: [PATCH 10/19] change type var in comment --- htdocs/core/class/html.formsetup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 392fa8232c1..b4eae28beb0 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -615,7 +615,7 @@ class FormSetupItem /** @var string $picto */ public $picto = ''; - /** @var string $fieldValue */ + /** @var string|null $fieldValue */ public $fieldValue; /** @var string $defaultFieldValue */ From 58d1bdfbceeaa88be4ac3c6d3e1a96fc4721cca9 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 3 Mar 2025 13:51:47 +0100 Subject: [PATCH 11/19] Doc --- htdocs/core/lib/pdf.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e590ee2c49c..e49aabbb44b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1453,6 +1453,8 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos } $parameters = array('pdf' => $pdf, 'i' => $i, 'outputlangs' => $outputlangs, 'w' => $w, 'h' => $h, 'posx' => $posx, 'posy' => $posy, 'hideref' => $hideref, 'hidedesc' => $hidedesc, 'issupplierline' => $issupplierline, 'special_code' => $special_code); $action = ''; + // WARNING: A hook must not close/open the PDF transaction. Doing this generates a lot of trouble. + // Test to know if content added by the hooks is already done by the main caller of pdf_writelinedesc $reshook = $hookmanager->executeHooks('pdf_writelinedesc', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if (!empty($hookmanager->resPrint)) { From ebe11cde5198ea06d8854bee97c62df09aa7eda2 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 3 Mar 2025 14:42:15 +0100 Subject: [PATCH 12/19] Debug pdf (calculation of free text height) --- htdocs/core/lib/pdf.lib.php | 6 ++++-- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e49aabbb44b..9f169a18462 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -339,6 +339,8 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent) { // store current object $pdf->startTransaction(); + // To avoid pagebreak effect or strange behavior of writeHTMLCell when we are out of page, we imagine we are at the begin of page to test the height of the text + $pdf->setY(0); // store starting values $start_y = $pdf->GetY(); //var_dump($start_y); @@ -1212,7 +1214,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $pdf->SetDrawColor(224, 224, 224); // Option for footer text color if (getDolGlobalString('PDF_FOOTER_TEXT_COLOR')) { - list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_TEXT_COLOR, '%d, %d, %d'); + list($r, $g, $b) = sscanf(getDolGlobalString('PDF_FOOTER_TEXT_COLOR'), '%d, %d, %d'); $pdf->SetTextColor($r, $g, $b); } @@ -1231,7 +1233,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $freetextheight = $pdf->getStringHeight($width, $line); } else { $freetextheight = pdfGetHeightForHtmlContent($pdf, dol_htmlentitiesbr($line, 1, 'UTF-8', 0)); // New method (works for HTML content) - //print '
'.$freetextheight;exit; + //print '
'.$freetextheight; } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index a5c514576e1..8b4acc88d42 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -831,7 +831,7 @@ class pdf_crabe extends ModelePDFFactures } else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } - $this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $langs)); + $this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $outputlangs)); $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. @@ -849,7 +849,7 @@ class pdf_crabe extends ModelePDFFactures } else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } - $this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $langs)); + $this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pagenb, $object, $outputlangs)); // New page $pdf->AddPage(); if (!empty($tplidx)) { diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index f5457fc919d..9f39fb27975 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -343,7 +343,7 @@ class pdf_sponge extends ModelePDFFactures $this->heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page $this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin) - $heightforqrinvoice = $heightforqrinvoice_firstpage = 0; + $heightforqrinvoice = 0; if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') { if ($this->getHeightForQRInvoice(1, $object, $langs) > 0) { // Shrink infotot to a base 30 From 22ef2a018a80b3f58956a2c82c16b6cbb0bf1261 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 3 Mar 2025 14:45:14 +0100 Subject: [PATCH 13/19] Doc --- htdocs/core/lib/pdf.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 9f169a18462..3131f4e38ef 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -328,7 +328,8 @@ function pdf_getHeightForLogo($logo, $url = false) } /** - * Function to try to calculate height of a HTML Content + * Function to try to calculate height of a HTML Content. + * WARNING: Do not use this function inside a TCPDF transaction. * * @param TCPDF $pdf PDF initialized object * @param string $htmlcontent HTML Content @@ -340,6 +341,7 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent) // store current object $pdf->startTransaction(); // To avoid pagebreak effect or strange behavior of writeHTMLCell when we are out of page, we imagine we are at the begin of page to test the height of the text + // Another solution would be to do the test on another PDF instance with samefont, width... $pdf->setY(0); // store starting values $start_y = $pdf->GetY(); From 6d2de0a16fc96983bbeed57a3085e8be82cfc487 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 3 Mar 2025 15:13:43 +0100 Subject: [PATCH 14/19] Fix remove $conf->global --- htdocs/core/class/html.formfile.class.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index abb2d604b95..1d306a01143 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -969,10 +969,7 @@ class FormFile $out .= ''; - $documenturl = DOL_URL_ROOT.'/document.php'; - if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) { - $documenturl = getDolGlobalString('DOL_URL_ROOT_DOCUMENT_PHP'); // To use another wrapper - } + $documenturl = getDolGlobalString('DOL_URL_ROOT_DOCUMENT_PHP', DOL_URL_ROOT.'/document.php'); // DOL_URL_ROOT_DOCUMENT_PHP can be used to set another wrapper // Show file name with link to download $imgpreview = $this->showPreview($file, $modulepart, $relativepath, 0, $param); From 105ec63eafe86ae8a89685d9f1e3f57c4e9f1c5b Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 3 Mar 2025 15:20:39 +0100 Subject: [PATCH 15/19] Debug v21 for multicompany --- htdocs/ecm/class/ecmfiles.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 28db17eceb0..0bd44eceb31 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -1009,9 +1009,9 @@ class EcmFiles extends CommonObject if ($option) { if ($option == 'facture_fournisseur') { - $tmppath = preg_replace('/^fournisseur\/facture\//', '', $this->filepath); + $tmppath = preg_replace('/^(\d+\/)?fournisseur\/facture\//', '', $this->filepath); } elseif ($option == 'commande_fournisseur') { - $tmppath = preg_replace('/^fournisseur\/commande\//', '', $this->filepath); + $tmppath = preg_replace('/^(\d+\/)?fournisseur\/commande\//', '', $this->filepath); } else { if ((int) $this->entity > 1) { // Remove the part "entityid/commande/" into "entityid/commande/REFXXX" to get only the ref From 330d8d0d82661880eba2f7bda9cb970ad4965c88 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 3 Mar 2025 15:52:07 +0100 Subject: [PATCH 16/19] Clean CSS file from no more existing class --- ChangeLog | 1 + htdocs/theme/eldy/global.inc.php | 3 --- htdocs/theme/md/style.css.php | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c17176bdf11..677172b0019 100644 --- a/ChangeLog +++ b/ChangeLog @@ -218,6 +218,7 @@ The following changes may create regressions for some external modules, but were * The trigger code CATEGORY_LINK and CATEGORY_UNLINK have been replaced with code CATEGORY_MODIFY. You can read ->context['linkto'] or ->context['unlinkoff'] to detect if we want to make a link or unlink. * The property ->domiciliation and ->propio on bank accounts has been deprecated and replaced with property ->address and ->owner_name everywhere. * If you were using the substitution key __MEMBER_CIVILITY__, you must now use __MEMBER_TITLE__ +* The hidden title of tab that was hidden by the CSS class tabTitleText has been completely removed from HTML content. ***** ChangeLog for 20.0.4 compared to 20.0.3 ***** diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 7e597d769ba..50219ba0c3a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3991,9 +3991,6 @@ a.tabTitle { text-decoration: none; white-space: nowrap; } -.tabTitleText { - display: none; -} .imgTabTitle { max-height: 14px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 1da6838385a..e8ea2d48109 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4138,9 +4138,6 @@ a.tabTitle { text-decoration: none; white-space: nowrap; } -.tabTitleText { - display: none; -} .imgTabTitle { max-height: 14px; } From 361ac7fa337575ffee9925a34177e222e1d81910 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 3 Mar 2025 16:49:34 +0100 Subject: [PATCH 17/19] Better sanitizing function --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0e56d6a26d2..2921519e6c3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12566,7 +12566,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = ' // TODO: add hook // escape all attribute - $attr = array_map('dol_escape_htmltag', $attr); + $attr = array_map('dolPrintHtmlForAttribute', $attr); $TCompiledAttr = array(); foreach ($attr as $key => $value) { From 3bed970948a2a0ceee3adb6efe950fe5aedfeb03 Mon Sep 17 00:00:00 2001 From: EchoLoGeek <73399671+EchoLoGeek@users.noreply.github.com> Date: Mon, 3 Mar 2025 11:24:33 +0100 Subject: [PATCH 18/19] Remain to pay in multicurrency If I want to have the remainder to pay in foreign currency, I must deduct it from the amount in multicurrency, not the amount in conf->currency --- htdocs/core/class/commoninvoice.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 321533eb28d..cc759fa89af 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -286,7 +286,12 @@ abstract class CommonInvoice extends CommonObject $alreadypaid += $this->getSumDepositsUsed($multicurrency); $alreadypaid += $this->getSumCreditNotesUsed($multicurrency); - $remaintopay = price2num($this->total_ttc - $alreadypaid, 'MT'); + if((int) $multicurrency > 0){ + $totalamount = $this->multicurrency_total_ttc; + } else { + $totalamount = $this->total_ttc; + } + $remaintopay = price2num($totalamount - $alreadypaid, 'MT'); if ($this->status == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment $remaintopay = 0.0; } From 259f8f5643dd549851edf8768ad2bba2c69df791 Mon Sep 17 00:00:00 2001 From: EchoLoGeek <73399671+EchoLoGeek@users.noreply.github.com> Date: Mon, 3 Mar 2025 11:39:18 +0100 Subject: [PATCH 19/19] fix spaces --- htdocs/core/class/commoninvoice.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index cc759fa89af..ec4cf03f7df 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -286,7 +286,7 @@ abstract class CommonInvoice extends CommonObject $alreadypaid += $this->getSumDepositsUsed($multicurrency); $alreadypaid += $this->getSumCreditNotesUsed($multicurrency); - if((int) $multicurrency > 0){ + if ((int) $multicurrency > 0) { $totalamount = $this->multicurrency_total_ttc; } else { $totalamount = $this->total_ttc;