From 94dbde9cfd04ebf90a2b1ef4e0a771f8122b9581 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 12 Mar 2024 15:28:35 +0100 Subject: [PATCH 01/16] fix default current user as commercial for the thirdparty --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a88aec05618..c1cdb053f5b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1652,7 +1652,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1); // Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record. - $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir) ? array($user->id) : array()))); + $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (!empty($user->rights->societe->client->voir) ? array($user->id) : array()))); print img_picto('', 'user').$form->multiselectarray('commercial', $userlist, $selected, null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ''; From 71442efa030276a1f77d8de01c575c39e23a2695 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 13 Mar 2024 12:19:01 +0100 Subject: [PATCH 02/16] remove check againts read access (and if that user create a thirdpart read access is implicit) --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index c1cdb053f5b..65c194ee50f 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1652,7 +1652,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1); // Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record. - $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (!empty($user->rights->societe->client->voir) ? array($user->id) : array()))); + $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : array($user->id))); print img_picto('', 'user').$form->multiselectarray('commercial', $userlist, $selected, null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ''; From 049beb9bf8b7c85b4c83a324e35bffe38deb3eb8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 26 Mar 2024 17:28:26 +0100 Subject: [PATCH 03/16] NEW Constant to select if typent helps define whether the thirdparty is a company --- htdocs/societe/class/societe.class.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 3e42c0ddbdb..914c416c924 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4082,12 +4082,16 @@ class Societe extends CommonObject $isacompany = 1; } elseif (!empty($this->idprof1) || !empty($this->idprof2) || !empty($this->idprof3) || !empty($this->idprof4) || !empty($this->idprof5) || !empty($this->idprof6)) { $isacompany = 1; - } elseif (!empty($this->typent_code) && $this->typent_code != 'TE_UNKNOWN') { - // TODO Add a field is_a_company into dictionary - if (preg_match('/^TE_PRIVATE/', $this->typent_code)) { - $isacompany = 0; + } else { + if (!empty($conf->global->DEFINE_CUSTOMERS_ARE_COMPANIES_BY_TYPE_COMPANY)) { + // TODO Add a field is_a_company into dictionary + if (preg_match('/^TE_PRIVATE/', $this->typent_code)) { + $isacompany = 0; + } else { + $isacompany = 1; + } } else { - $isacompany = 1; + $isacompany = 0; } } From a8771d03bd028f06125d216032141c72d6ca6977 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 26 Mar 2024 17:30:02 +0100 Subject: [PATCH 04/16] Use getDolGlobalString --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 914c416c924..bc784236649 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4083,7 +4083,7 @@ class Societe extends CommonObject } elseif (!empty($this->idprof1) || !empty($this->idprof2) || !empty($this->idprof3) || !empty($this->idprof4) || !empty($this->idprof5) || !empty($this->idprof6)) { $isacompany = 1; } else { - if (!empty($conf->global->DEFINE_CUSTOMERS_ARE_COMPANIES_BY_TYPE_COMPANY)) { + if (getDolGlobalString('DEFINE_CUSTOMERS_ARE_COMPANIES_BY_TYPE_COMPANY')) { // TODO Add a field is_a_company into dictionary if (preg_match('/^TE_PRIVATE/', $this->typent_code)) { $isacompany = 0; From 48bcc07bc6314b85736851da732c4416daec79d8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 30 Mar 2024 07:51:57 +0100 Subject: [PATCH 05/16] FIX #29114 Missing contact term in intervention --- htdocs/langs/en_US/interventions.lang | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index b92474e7f91..f638dd26835 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -69,4 +69,9 @@ GenerateInter=Generate intervention FichinterNoContractLinked=Intervention %s has been created without a linked contract. ErrorFicheinterCompanyDoesNotExist=Company does not exist. Intervention has not been created. NextDateToIntervention=Date for next intervention generation -NoIntervention=No intervention \ No newline at end of file +NoIntervention=No intervention +##### Contact types ##### +TypeContact_fichinter_internal_INTERREPFOLL=Responsible for intervention follow-up +TypeContact_fichinter_internal_INTERVENING=Intervenant +TypeContact_fichinter_external_BILLING=Contact customer invoicing intervention +TypeContact_fichinter_external_CUSTOMER=Customer contact of intervention follow-up From ef4a1bef3bbe248797560e14ca01d918eb7719fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2024 19:59:47 +0100 Subject: [PATCH 06/16] Update interventions.lang --- htdocs/langs/en_US/interventions.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index f638dd26835..570fdcc8a5f 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -73,5 +73,5 @@ NoIntervention=No intervention ##### Contact types ##### TypeContact_fichinter_internal_INTERREPFOLL=Responsible for intervention follow-up TypeContact_fichinter_internal_INTERVENING=Intervenant -TypeContact_fichinter_external_BILLING=Contact customer invoicing intervention +TypeContact_fichinter_external_BILLING=Contact customer of intervention billing TypeContact_fichinter_external_CUSTOMER=Customer contact of intervention follow-up From cbf1014ab961197909c5442cd8d6ca0bcb99eb15 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 31 Mar 2024 13:56:44 +0200 Subject: [PATCH 07/16] FIX multiple problems with multicompany --- htdocs/takepos/invoice.php | 14 ++++++++------ htdocs/takepos/pay.php | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 9aecffa35bc..64688ef537a 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -197,8 +197,9 @@ if (empty($reshook)) { if ($invoice->total_ttc < 0) { $invoice->type = $invoice::TYPE_CREDIT_NOTE; - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture WHERE"; - $sql .= " fk_soc = ".((int) $invoice->socid); + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE entity IN (".getEntity('invoice').")"; + $sql .= " AND fk_soc = ".((int) $invoice->socid); $sql .= " AND type <> ".Facture::TYPE_CREDIT_NOTE; $sql .= " AND fk_statut >= ".$invoice::STATUS_VALIDATED; $sql .= " ORDER BY rowid DESC"; @@ -670,7 +671,8 @@ if (empty($reshook)) { $varforconst = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]; $sql .= " SET fk_soc = ".((int) $conf->global->$varforconst).", "; $sql .= " datec = '".$db->idate(dol_now())."'"; - $sql .= " WHERE ref = '(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; + $sql .= " WHERE entity IN (".getEntity('invoice').")"; + $sql .= " AND ref = '(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; $resql1 = $db->query($sql); if ($resdeletelines && $resql1) { @@ -1160,14 +1162,14 @@ $( document ).ready(function() { global->TAKEPOS_CAN_EDIT_IF_ALREADY_VALIDATED)) { // By default, only invoices with a ref not already defined can in list of open invoice we can edit. - $sql .= " WHERE ref LIKE '(PROV-POS".$db->escape(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '')."-0%' AND entity IN (".getEntity('invoice').")"; + $sql .= " AND ref LIKE '(PROV-POS".$db->escape(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '')."-0%'"; } else { // If TAKEPOS_CAN_EDIT_IF_ALREADY_VALIDATED set, we show also draft invoice that already has a reference defined - $sql .= " WHERE pos_source = '".$db->escape($_SESSION["takeposterminal"])."'"; + $sql .= " AND pos_source = '".$db->escape($_SESSION["takeposterminal"])."'"; $sql .= " AND module_source = 'takepos'"; - $sql .= " AND entity IN (".getEntity('invoice').")"; } $sql .= $db->order('datec', 'ASC'); diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index fdc2a4f319d..5fd2055f885 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -147,7 +147,9 @@ $invoice = new Facture($db); if ($invoiceid > 0) { $invoice->fetch($invoiceid); } else { - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE entity IN (".getEntity('invoice').")"; + $sql .= " AND ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { From 2ed6ae079961c96c59bfab40260e1fddbcd991ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2024 19:14:02 +0200 Subject: [PATCH 08/16] Fix #29031 Fix #29059 --- htdocs/core/lib/functions.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 181825a689e..244593e5b4a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -971,6 +971,9 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options } break; case 'intcomma': + if (is_array($out)) { + $out = implode(',', $out); + } if (preg_match('/[^0-9,-]+/i', $out)) { $out = ''; } From 85a08a9288981cfb165a1989ad3c40982310aa11 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 31 Mar 2024 19:17:58 +0200 Subject: [PATCH 09/16] FIX sometimes a string type instead integer is return, why ? --- htdocs/comm/propal/class/api_proposals.class.php | 2 +- htdocs/commande/class/api_orders.class.php | 2 +- htdocs/compta/facture/class/api_invoices.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 2d59bb1ac65..a2ff96ec37d 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -278,7 +278,7 @@ class Proposals extends DolibarrApi throw new RestException(500, "Error creating order", array_merge(array($this->propal->error), $this->propal->errors)); } - return $this->propal->id; + return ((int) $this->propal->id); } /** diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 66e8c2ee957..5498f22a3c8 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -297,7 +297,7 @@ class Orders extends DolibarrApi throw new RestException(500, "Error creating order", array_merge(array($this->commande->error), $this->commande->errors)); } - return $this->commande->id; + return ((int) $this->commande->id); } /** diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index d48740ea68d..72c392816eb 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -318,7 +318,7 @@ class Invoices extends DolibarrApi if ($this->invoice->create(DolibarrApiAccess::$user, 0, (empty($request_data["date_lim_reglement"]) ? 0 : $request_data["date_lim_reglement"])) < 0) { throw new RestException(500, "Error creating invoice", array_merge(array($this->invoice->error), $this->invoice->errors)); } - return $this->invoice->id; + return ((int) $this->invoice->id); } /** From a001d4825275d78a86cd953521ac4153b21ee5af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2024 21:17:20 +0200 Subject: [PATCH 10/16] Clean duplicate comment --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 6 ------ htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 6 ------ htdocs/core/modules/reception/doc/pdf_squille.modules.php | 6 ------ htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php | 6 ------ 4 files changed, 24 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index acd8bf1e262..fdd8809fba9 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -996,12 +996,6 @@ class pdf_espadon extends ModelePdfExpedition } $pdf->SetDrawColor(128, 128, 128); - if (isModEnabled('barcode')) { - // TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref - //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); - //$pdf->Image($logo,10, 5, 0, 24); - } - $posx = $this->page_largeur - $w - $this->marge_droite; $posy = $this->marge_haute; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 9258a1fb58c..5ef1c8d04de 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -906,12 +906,6 @@ class pdf_rouget extends ModelePdfExpedition } $pdf->SetDrawColor(128, 128, 128); - if (isModEnabled('barcode')) { - // TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref - //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); - //$pdf->Image($logo,10, 5, 0, 24); - } - $posx = $this->page_largeur - $w - $this->marge_droite; $posy = $this->marge_haute; diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index e7e91dbfd89..fc47c858dc7 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -906,12 +906,6 @@ class pdf_squille extends ModelePdfReception } $pdf->SetDrawColor(128, 128, 128); - if (isModEnabled('barcode')) { - // TODO Build code bar with function writeBarCode of barcode module for reception ref $object->ref - //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); - //$pdf->Image($logo,10, 5, 0, 24); - } - $posx = $this->page_largeur - $w - $this->marge_droite; $posy = $this->marge_haute; diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 7f42f2e83c2..8a6ad2e17c0 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -992,12 +992,6 @@ class pdf_eagle extends ModelePDFStockTransfer } $pdf->SetDrawColor(128, 128, 128); - if (isModEnabled('barcode')) { - // TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref - //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); - //$pdf->Image($logo,10, 5, 0, 24); - } - $posx = $this->page_largeur - $w - $this->marge_droite; $posy = $this->marge_haute; From c664ed75654f2c770a01fd97cf51f373f99e9e49 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 1 Apr 2024 08:06:48 +0200 Subject: [PATCH 11/16] FIX Accountancy - Not trunc id_import --- htdocs/accountancy/bookkeeping/list.php | 6 +++--- htdocs/accountancy/bookkeeping/listbyaccount.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index b6d468fe023..45967025a99 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,8 +1,8 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2023 Alexandre Spangaro - * Copyright (C) 2022 Lionel Vessiller + * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2022 Lionel Vessiller * Copyright (C) 2016-2017 Laurent Destailleur * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2022 Progiseize @@ -1293,7 +1293,7 @@ while ($i < min($num, $limit)) { } if (!empty($arrayfields['t.import_key']['checked'])) { - print ''.$obj->import_key."\n"; + print ''.$obj->import_key."\n"; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index dc13b47b4af..abdf358ccfc 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016 Neil Orley * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2020 Florian Henry - * Copyright (C) 2013-2022 Alexandre Spangaro + * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -1207,7 +1207,7 @@ while ($i < min($num, $limit)) { } if (!empty($arrayfields['t.import_key']['checked'])) { - print ''.$line->import_key."\n"; + print ''.$line->import_key."\n"; if (!$i) { $totalarray['nbfield']++; } From e1e8e45a5294bd8cc98e2dc0d35fcaeb14fb0bfd Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 2 Apr 2024 18:47:28 +0200 Subject: [PATCH 12/16] Fix cronjob.class.php --- htdocs/cron/class/cronjob.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 266909fe17b..1c5ed95a7df 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1295,11 +1295,10 @@ class Cronjob extends CommonObject } else { $result = call_user_func_array(array($object, $this->methodename), $params_arr); } - + $errmsg = ''; if ($result === false || (!is_bool($result) && $result != 0)) { $langs->load("errors"); - $errmsg = ''; if (!is_array($object->errors) || !in_array($object->error, $object->errors)) { $errmsg .= $object->error; } From 000234c85328208b296965aab5e7800c4d973acc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Apr 2024 12:05:33 +0200 Subject: [PATCH 13/16] FIX css of background of modules that was black --- htdocs/theme/md/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9dabc46d53f..f4d2e6caa37 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -361,7 +361,7 @@ print '*/'."\n"; --amountremaintopaybackcolor:none; --productlinestockod: #002200; --productlinestocktoolow: #884400; - --infoboxmoduleenabledbgcolor : linear-gradient(0.4turn, #2b2d2f, #2b2d2f, #2b2d2f, #e4efe8); + --infoboxmoduleenabledbgcolor : linear-gradient(0.4turn, #fff, #fff, #fff, #e4efe8); --tablevalidbgcolor: rgb(252, 248, 227); --butactionbg : #; --textbutaction : #; From 81adb15eb0d74a4e28ba13cb281af7393f036d77 Mon Sep 17 00:00:00 2001 From: x Date: Wed, 3 Apr 2024 15:04:30 +0200 Subject: [PATCH 14/16] FIX PDF Translations Extrafields --- .../core/class/commondocgenerator.class.php | 2 +- htdocs/core/class/extrafields.class.php | 40 ++++++++++--------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 2278a1de8dc..ddd35a96c0d 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1294,7 +1294,7 @@ abstract class CommonDocGenerator $extrafields = $this->extrafieldsCache; $extrafieldOutputContent = ''; - if (isset($object->array_options[$extrafieldOptionsKey])) $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey], '', $object->table_element); + if (isset($object->array_options[$extrafieldOptionsKey])) $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey], '', $object->table_element, $outputlangs); // TODO : allow showOutputField to be pdf public friendly, ex: in a link to object, clean getNomUrl to remove link and images... like a getName methode ... if ($extrafields->attributes[$object->table_element]['type'][$extrafieldKey] == 'link') { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d457db3ab31..d3f50d53f20 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1575,12 +1575,17 @@ class ExtraFields * @param string $value Value to show * @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering) * @param string $extrafieldsobjectkey Required (for example $object->table_element). + * @param Translate $outputlangs Output language * @return string Formated value */ - public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '') + public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '', $outputlangs = null) { global $conf, $langs; + if (is_null($outputlangs) || !is_object($outputlangs)) { + $outputlangs = $langs; + } + if (empty($extrafieldsobjectkey)) { dol_syslog(get_class($this).'::showOutputField extrafieldsobjectkey required', LOG_ERR); return 'BadValueForParamExtraFieldsObjectKey'; @@ -1624,7 +1629,7 @@ class ExtraFields //$value=price($value); $sizeparts = explode(",", $size); $number_decimals = array_key_exists(1, $sizeparts) ? $sizeparts[1] : 0; - $value = price($value, 0, $langs, 0, 0, $number_decimals, ''); + $value = price($value, 0, $outputlangs, 0, 0, $number_decimals, ''); } } elseif ($type == 'boolean') { $checked = ''; @@ -1643,7 +1648,7 @@ class ExtraFields } elseif ($type == 'price') { //$value = price($value, 0, $langs, 0, 0, -1, $conf->currency); if ($value || $value == '0') { - $value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$langs->getCurrencySymbol($conf->currency); + $value = price($value, 0, $outputlangs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$outputlangs->getCurrencySymbol($conf->currency); } } elseif ($type == 'pricecy') { $currency = $conf->currency; @@ -1654,7 +1659,7 @@ class ExtraFields $value = $pricetmp[0]; } if ($value || $value == '0') { - $value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1, $currency); + $value = price($value, 0, $outputlangs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1, $currency); } } elseif ($type == 'select') { $valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : ''); @@ -1662,7 +1667,7 @@ class ExtraFields $valstr = substr($valstr, 0, $pos); } if ($langfile && $valstr) { - $value = $langs->trans($valstr); + $value = $outputlangs->trans($valstr); } else { $value = $valstr; } @@ -1721,13 +1726,12 @@ class ExtraFields foreach ($fields_label as $field_toshow) { $translabel = ''; if (!empty($obj->$field_toshow)) { - $translabel = $langs->trans($obj->$field_toshow); - - if ($translabel != $obj->$field_toshow) { - $value .= dol_trunc($translabel, 24).' '; - } else { - $value .= $obj->$field_toshow.' '; - } + $translabel = $outputlangs->trans($obj->$field_toshow); + } + if ($translabel != $obj->$field_toshow) { + $value .= dol_trunc($translabel, 24).' '; + } else { + $value .= $obj->$field_toshow.' '; } } } else { @@ -1735,7 +1739,7 @@ class ExtraFields $tmppropname = $InfoFieldList[1]; //$obj->$tmppropname = ''; if (!empty(isset($obj->$tmppropname) ? $obj->$tmppropname : '')) { - $translabel = $langs->trans($obj->$tmppropname); + $translabel = $outputlangs->trans($obj->$tmppropname); } if ($translabel != (isset($obj->$tmppropname) ? $obj->$tmppropname : '')) { $value = dol_trunc($translabel, 18); @@ -1764,10 +1768,10 @@ class ExtraFields } } elseif ($type == 'radio') { if (!isset($param['options'][$value])) { - $langs->load('errors'); - $value = $langs->trans('ErrorNoValueForRadioType'); + $outputlangs->load('errors'); + $value = $outputlangs->trans('ErrorNoValueForRadioType'); } else { - $value = $langs->trans($param['options'][$value]); + $value = $outputlangs->trans($param['options'][$value]); } } elseif ($type == 'checkbox') { $value_arr = explode(',', $value); @@ -1831,7 +1835,7 @@ class ExtraFields foreach ($fields_label as $field_toshow) { $translabel = ''; if (!empty($obj->$field_toshow)) { - $translabel = $langs->trans($obj->$field_toshow); + $translabel = $outputlangs->trans($obj->$field_toshow); } if ($translabel != $field_toshow) { $label .= ' '.dol_trunc($translabel, 18); @@ -1844,7 +1848,7 @@ class ExtraFields } else { $translabel = ''; if (!empty($obj->{$InfoFieldList[1]})) { - $translabel = $langs->trans($obj->{$InfoFieldList[1]}); + $translabel = $outputlangs->trans($obj->{$InfoFieldList[1]}); } if ($translabel != $obj->{$InfoFieldList[1]}) { $toprint[] = '
  • '.dol_trunc($translabel, 18).'
  • '; From c583102364dfedae776ef555491c73fdfaa8db9c Mon Sep 17 00:00:00 2001 From: x Date: Wed, 3 Apr 2024 15:19:53 +0200 Subject: [PATCH 15/16] FIX Accolad --- htdocs/core/class/extrafields.class.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d3f50d53f20..6959ca44a36 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1727,11 +1727,12 @@ class ExtraFields $translabel = ''; if (!empty($obj->$field_toshow)) { $translabel = $outputlangs->trans($obj->$field_toshow); - } - if ($translabel != $obj->$field_toshow) { - $value .= dol_trunc($translabel, 24).' '; - } else { - $value .= $obj->$field_toshow.' '; + + if ($translabel != $obj->$field_toshow) { + $value .= dol_trunc($translabel, 24) . ' '; + } else { + $value .= $obj->$field_toshow . ' '; + } } } } else { From f6cd58bf50ec412346ba007a61e71229e4a5440f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Apr 2024 18:51:46 +0200 Subject: [PATCH 16/16] Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 19.0 --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 34be2bd8fe8..612f1000c12 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2674,7 +2674,7 @@ function top_menu_quickadd() // Key map shortcut $(document).keydown(function(event){ - var ostype = "'.$conf->browser->os.'"; + var ostype = \''.dol_escape_js($conf->browser->os).'\'; if (ostype === "macintosh") { if ( event.which === 65 && event.ctrlKey ) { console.log(\'control + a : trigger open quick add dropdown\'); @@ -2946,7 +2946,7 @@ function top_menu_bookmark() // Key map shortcut jQuery(document).keydown(function(event) { - var ostype = "'.$conf->browser->os.'"; + var ostype = \''.dol_escape_js($conf->browser->os).'\'; if (ostype === "macintosh") { if ( event.which === 66 && event.ctrlKey ) { console.log("Click on control + b : trigger open bookmark dropdown");