From 3e7cf0a463bc6f686d8beacf77663b149538526e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 12 Jan 2024 16:14:15 +0100 Subject: [PATCH 1/7] fix pdf nbpages (#27457) Co-authored-by: Christophe Battarel --- htdocs/core/lib/pdf.lib.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 95fc3b34f89..de788b67583 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1306,10 +1306,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // Show page nb only on iso languages (so default Helvetica font) // if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); - // $pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); - // $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); // doesn't works with all fonts - // $pagination = $pdf->getAliasNumPage().' / '.$pdf->getAliasNbPages(); // works with $pdf->Cell - $pagination = $pdf->PageNo().' / '.$pdf->getNumPages(); + $pagination = $pdf->PageNo().' / '.$pdf->getAliasNbPages(); $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); // } From 4374aa1a205d57b13fc655c8616b8f7a7df936a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Jan 2024 16:31:49 +0100 Subject: [PATCH 2/7] FIX Bad visible status of proposal after reopen --- htdocs/comm/propal/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 205eab09655..8ad14f7f48b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -780,10 +780,14 @@ if (empty($reshook)) { if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) { $db->begin(); - $result = $object->reopen($user, empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE)); + $newstatus = (getDolGlobalInt('PROPAL_SKIP_ACCEPT_REFUSE') ? Propal::STATUS_DRAFT : Propal::STATUS_VALIDATED); + $result = $object->reopen($user, $newstatus); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; + } else { + $object->statut = $newstatus; + $object->status = $newstatus; } if (!$error) { From f03eb1f505ab6b8918d90d0ed7d569a8de3d2ce4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Jan 2024 16:47:09 +0100 Subject: [PATCH 3/7] Fix restore old code due to regression on some lang. Add hidden PDF_USE_GETALIASNBPAGE_FOR_TOTAL for the case it bugs --- htdocs/core/lib/pdf.lib.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index de788b67583..9dfae331e51 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1304,11 +1304,16 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } } // Show page nb only on iso languages (so default Helvetica font) - // if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { - $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); - $pagination = $pdf->PageNo().' / '.$pdf->getAliasNbPages(); - $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); - // } + $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); + + if (getDolGlobalString('PDF_USE_GETALIASNBPAGE_FOR_TOTAL')) { + // $pagination = $pdf->getAliasNumPage().' / '.$pdf->getAliasNbPages(); // works with $pdf->Cell + $pagination = $pdf->PageNo().' / '.$pdf->getAliasNbPages(); // seems to not works with all fonts like ru_UK + } else { + $pagination = $pdf->PageNo().' / '.$pdf->getNumPages(); // seems to always work even with $pdf->Cell. But some users has reported wrong nb (no way to reproduce) + } + + $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); // Show Draft Watermark if (!empty($watermark)) { From 5df2850dca80b77399cd1f7b0600aae2dbcda93e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 12 Jan 2024 16:49:30 +0100 Subject: [PATCH 4/7] FIX Accountancy - Level 3 of binding not working on supplier side (#27462) --- htdocs/accountancy/class/accountingaccount.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 98d58450e7b..d25025f3c76 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2013-2021 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) @@ -865,10 +865,14 @@ class AccountingAccount extends CommonObject // Level 3 (define $code_t): Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding) if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { - if (!empty($buyer->code_compta_product)) { + if ($type == 'customer' && !empty($buyer->code_compta_product)) { $code_t = $buyer->code_compta_product; $suggestedid = $accountingAccount['thirdparty']; $suggestedaccountingaccountfor = 'thirdparty'; + } elseif ($type == 'supplier' && !empty($seller->code_compta_product)) { + $code_t = $seller->code_compta_product; + $suggestedid = $accountingAccount['thirdparty']; + $suggestedaccountingaccountfor = 'thirdparty'; } } From 58cf5609cab7ede04eaed3803d4a4d79bf870487 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Fri, 12 Jan 2024 17:03:57 +0100 Subject: [PATCH 5/7] FIX php 8.2 warning (#27465) * fix php 8.2 warning * Fix warning --- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- .../interface_50_modBlockedlog_ActionsBlockedLog.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 94c4d961750..5b62e9edcc9 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -738,8 +738,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu = $menu; - $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"]); - $leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"])); + $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"]??''); + $leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"]??'')); if (is_null($mainmenu)) { $mainmenu = 'home'; diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index a515078bc70..87a46036fc9 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -67,7 +67,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers if (!getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED') || !in_array($action, explode(',', getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED')))) { // If custom actions are not set or if action not into custom actions, we can exclude action if object->elementis not valid $listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription', 'payment_various', 'cashcontrol'); - if (!in_array($object->element, $listofqualifiedelement)) { + if (!is_object($object) || !property_exists($object, 'element') || !in_array($object->element, $listofqualifiedelement)) { return 1; } } From 1c86073a9eae6f342008be77463ea8f5aa05f285 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Jan 2024 17:06:22 +0100 Subject: [PATCH 6/7] Fix phpcs --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index eb5f3e45f7a..5d28ea7501e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1598,7 +1598,7 @@ class ExtraFields } else if ( $element == 'projet' ) { $element = 'project'; } - + //$out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, '', 0, 0, ''); $out = $form->selectForForms($tmparray[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, '', 0, 0, '', $element.':options_'.$key); } elseif ($type == 'password') { From 11d6b891fa9a0f0435866d89fdbef0e52a7a4639 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Jan 2024 21:36:29 +0100 Subject: [PATCH 7/7] FIX SQL error --- htdocs/multicurrency/multicurrency_rate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 4164a99cb6b..02c37bca890 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -357,7 +357,7 @@ $sql .= " WHERE m.code <> '".$db->escape($conf->currency)."'"; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= " GROUP BY cr.rowid, cr.date_sync, cr.rate, m.code, cr.entity, m.code, m.name"; +$sql .= " GROUP BY cr.rowid, cr.date_sync, cr.rate, cr.rate_indirect, m.code, cr.entity, m.code, m.name"; // Add fields from hooks $parameters = array();