From 4cd82df73c5a87dfc65520859d1722722d483567 Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 13 Sep 2024 04:07:24 +0200 Subject: [PATCH 01/50] FIX late propal search option (v18+) (#30687) * Fixed search late propal. Added search late propal checkbox. * Removed late date alert checkbox --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/comm/propal/list.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 699ade8172a..c2825ff1830 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3517,7 +3517,7 @@ class Propal extends CommonObject $response->label = $label; $response->labelShort = $labelShort; $response->url = DOL_URL_ROOT.'/comm/propal/list.php?search_status='.$status.'&mainmenu=commercial&leftmenu=propals'; - $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?search_status='.$status.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc'; + $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?search_option=late&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc'; $response->img = img_object('', "propal"); // This assignment in condition is not a bug. It allows walking the results. diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 93a2db80072..4b1def204bc 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -17,6 +17,7 @@ * Copyright (C) 2021 Anthony Berton * Copyright (C) 2021 Frédéric France * Copyright (C) 2022 Josep Lluís Amador + * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -146,6 +147,12 @@ $search_status = GETPOST('search_status', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $object_statut = GETPOST('search_statut', 'alpha'); +$search_option = GETPOST('search_option', 'alpha'); +if ($search_option == 'late') { + $search_status = '1'; + $object_statut = '1'; +} + $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); @@ -389,6 +396,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_date_signature_endyear = ''; $search_date_signature_start = ''; $search_date_signature_end = ''; + $search_option = ''; } if ($object_statut != '') { $search_status = $object_statut; @@ -764,6 +772,9 @@ if ($search_date_signature_start) { if ($search_date_signature_end) { $sql .= " AND p.date_signature <= '".$db->idate($search_date_signature_end)."'"; } +if ($search_option == 'late') { + $sql .= " AND p.fin_validite < '".$db->idate(dol_now() - $conf->propal->cloture->warning_delay)."'"; +} // Search for tag/category ($searchCategoryProductList is an array of ID) $searchCategoryProductOperator = -1; $searchCategoryProductList = array($search_product_category); @@ -1042,6 +1053,9 @@ if ($resql) { if ($search_date_signature_endyear) { $param .= '&search_date_signature_endyear='.urlencode($search_date_signature_endyear); } + if ($search_option) { + $param .= "&search_option=".urlencode($search_option); + } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -1166,6 +1180,7 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle); $moreforfilter .= ''; } + $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { From 1a81d7fc16b196e7d192111ac8fcfc1502b45d50 Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 13 Sep 2024 04:14:41 +0200 Subject: [PATCH 02/50] FIX late order search option (v18+) (#30692) * Fixed search late order. Added search late order checkbox. Added contributor details. * Removed late date alert checkbox --- htdocs/commande/class/commande.class.php | 2 ++ htdocs/commande/list.php | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c820acd6e6c..dce7ec132b0 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -13,6 +13,7 @@ * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2021-2023 Frédéric France * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -3614,6 +3615,7 @@ class Commande extends CommonOrder $response->label = $langs->trans("OrdersToProcess"); $response->labelShort = $langs->trans("Opened"); $response->url = DOL_URL_ROOT.'/commande/list.php?search_status=-3&mainmenu=commercial&leftmenu=orders'; + $response->url_late = DOL_URL_ROOT.'/commande/list.php?search_option=late&mainmenu=commercial&leftmenu=orders'; $response->img = img_object('', "order"); $generic_commande = new Commande($this->db); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index a71212a517c..d9ad4ee2c56 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -12,6 +12,7 @@ * Copyright (C) 2016-2023 Ferran Marcet * Copyright (C) 2018 Charlene Benke * Copyright (C) 2021 Anthony Berton + * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,6 +119,10 @@ $search_fk_cond_reglement = GETPOST('search_fk_cond_reglement', 'int'); $search_fk_shipping_method = GETPOST('search_fk_shipping_method', 'int'); $search_fk_mode_reglement = GETPOST('search_fk_mode_reglement', 'int'); $search_fk_input_reason = GETPOST('search_fk_input_reason', 'int'); +$search_option = GETPOST('search_option', 'alpha'); +if ($search_option == 'late') { + $search_status = '-2'; +} $diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id; @@ -293,6 +298,7 @@ if (empty($reshook)) { $search_fk_shipping_method = ''; $search_fk_mode_reglement = ''; $search_fk_input_reason = ''; + $search_option = ''; } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { @@ -601,6 +607,9 @@ if (empty($reshook)) { if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); } + if ($search_option) { + $param .= "&search_option=".urlencode($search_option); + } if ($search_orderday) { $param .= '&search_orderday='.urlencode($search_orderday); } @@ -915,7 +924,9 @@ if ($search_status <> '') { $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process } } - +if ($search_option == 'late') { + $sql .= " AND c.date_commande < '".$db->idate(dol_now() - $conf->commande->client->warning_delay)."'"; +} if ($search_datecloture_start) { $sql .= " AND c.date_cloture >= '".$db->idate($search_datecloture_start)."'"; } @@ -1169,6 +1180,9 @@ if ($socid > 0) { if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); } +if ($search_option) { + $param .= "&search_option=".urlencode($search_option); +} if ($search_datecloture_start) { $param .= '&search_datecloture_startday='.dol_print_date($search_datecloture_start, '%d').'&search_datecloture_startmonth='.dol_print_date($search_datecloture_start, '%m').'&search_datecloture_startyear='.dol_print_date($search_datecloture_start, '%Y'); } @@ -1466,6 +1480,7 @@ if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURIN $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1, 0, 0, $tmptitle, 0, 0, array(), 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= ''; } + $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { From 30c212c732ac43ab683fb015db752aa8f10c8b35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Sep 2024 12:24:46 +0200 Subject: [PATCH 03/50] Fix text --- htdocs/admin/system/perf.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 0b02e78e344..44935e91607 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -660,7 +660,7 @@ if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) { } else { print img_picto('', 'minus', 'class="pictofixedwidth"'); } -print ' '.$form->textwithpicto($langs->trans("EnableFileCache").' ('.$langs->trans("Widgets").')', $langs->trans("Option").' MAIN_ACTIVATE_FILECACHE'); +print $form->textwithpicto($langs->trans("EnableFileCache").' ('.$langs->trans("Widgets").')', $langs->trans("Option").' MAIN_ACTIVATE_FILECACHE'); print ': '.yn(getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')); print '
'; @@ -669,7 +669,7 @@ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { } else { print img_picto('', 'minus', 'class="pictofixedwidth"'); } -print ' MAIN_ENABLE_AJAX_TOOLTIP : '; +print 'MAIN_ENABLE_AJAX_TOOLTIP : '; print yn(getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')); print '
'; From 37d9e6e9e9a7d95216cdad41f3c98f3b303df49f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Sep 2024 14:00:21 +0200 Subject: [PATCH 04/50] Fix search on string that include partial html content --- htdocs/admin/system/security.php | 5 +++-- htdocs/core/lib/functions.lib.php | 6 +++++- htdocs/website/index.php | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 8e1c16581c3..8235bbde97a 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -376,11 +376,12 @@ if (empty($dolibarr_main_stream_to_disable)) { } else { print implode(', ', $dolibarr_main_stream_to_disable); } -print ' -> Current PHP streams allowed = '; +print '   -> Current PHP streams allowed = '; $arrayofstreams = stream_get_wrappers(); if (!empty($arrayofstreams)) { sort($arrayofstreams); - print(implode(',', $arrayofstreams)).'     ('.$langs->trans("Recommended").': '.$langs->trans("TryToKeepOnly", 'file,http,https,php').')'."\n"; + print ''.implode(',', $arrayofstreams).''; + print '     ('.$langs->trans("Recommended").': '.$langs->trans("TryToKeepOnly", 'file,http,https,php').')'."\n"; } print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8af20ea8e24..15220ea3f5f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8267,7 +8267,11 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = ' $out = preg_replace('/&#x?[0-9]+/i', '', $out); // For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'. // Keep only some html tags and remove also some 'javascript:' strings - $out = dol_string_onlythesehtmltags($out, 0, ($check == 'restricthtmlallowclass' ? 0 : 1), 1); + if ($check == 'restricthtmlallowclass' || $check == 'restricthtmlallowunvalid') { + $out = dol_string_onlythesehtmltags($out, 0, 0, 1); + } else { + $out = dol_string_onlythesehtmltags($out, 0, 1, 1); + } // Keep only some html attributes and exclude non expected HTML attributes and clean content of some attributes (keep only alt=, title=...). if (getDolGlobalString('MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES')) { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index e82fa4693de..308a80fec85 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -342,7 +342,7 @@ if (empty($sortfield)) { } } -$searchkey = GETPOST('searchstring', 'restricthtmlallowclass'); +$searchkey = GETPOST('searchstring', 'restricthtmlallowunvalid'); if ($action == 'replacesite' || $mode == 'replacesite') { // Test on permission not required $containertype = GETPOST('optioncontainertype', 'aZ09') != '-1' ? GETPOST('optioncontainertype', 'aZ09') : ''; From d9881605887b434a9e15fcb26dfebda814bec0bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Sep 2024 14:06:36 +0200 Subject: [PATCH 05/50] Fix search on string that include partial html content --- htdocs/website/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 308a80fec85..d2ffdb68c48 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -342,7 +342,7 @@ if (empty($sortfield)) { } } -$searchkey = GETPOST('searchstring', 'restricthtmlallowunvalid'); +$searchkey = GETPOST('searchstring', 'restricthtmlallowunvalid'); // or 'none', must be same then $searchstring if ($action == 'replacesite' || $mode == 'replacesite') { // Test on permission not required $containertype = GETPOST('optioncontainertype', 'aZ09') != '-1' ? GETPOST('optioncontainertype', 'aZ09') : ''; @@ -584,7 +584,7 @@ if ($massaction == 'delcategory' && GETPOST('confirmmassaction', 'alpha') && $us // Replacement of string into pages if ($massaction == 'replace' && GETPOST('confirmmassaction', 'alpha') && $usercanedit) { - $replacestring = GETPOST('replacestring', 'none'); + $replacestring = GETPOST('replacestring', 'restricthtmlallowunvalid'); // or 'none', must be same then $searchstring $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT); $allowimportsite = true; From b7ff2bd0ddb65fae394f074858ef1291f6e1e447 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Sep 2024 15:13:32 +0200 Subject: [PATCH 06/50] Fix doc --- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/website.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index dc07918f724..e64e83b2d82 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2146,7 +2146,7 @@ COMPANY_DIGITARIA_CLEAN_REGEX=Regex filter to clean value (COMPANY_DIGITARIA_CLE DuplicateForbidden=Duplicate forbidden RemoveSpecialWords=Clean certain words when generating sub-accounts for customers or suppliers RemoveSpecialWordsHelp=Specify the words to be cleaned before calculating the customer or supplier account. Use a ";" between each word -GDPRContact=Data Protection Officer (DPO, Data Privacy or GDPR contact) +GDPRContact=Data Protection Officer (DPO, Data Privacy or GDPR contact, ...) GDPRContactDesc=If you store personal data in your Information System, you can name the contact who is responsible for the General Data Protection Regulation here HelpOnTooltip=Help text to show on tooltip HelpOnTooltipDesc=Put text or a translation key here for the text to show in a tooltip when this field appears in a form diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 33c4d523e2f..3bbd33ba5ee 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -356,3 +356,4 @@ subtract=Subtract LoginCheckout=Login & Proceed to checkout paymentSuccessProcessed=Your payment has been successfully processed. youWillBeRedirectedToOrderPage=You will be redirected to the order details page shortly. +WebPortalSetupNotComplete=Web portal setup is not complete From 2672fbed97b51ae0c083198924018da43a968ef9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Sep 2024 17:19:07 +0200 Subject: [PATCH 07/50] TODO --- htdocs/public/company/new.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/public/company/new.php b/htdocs/public/company/new.php index b6e84d2437b..a77e3c84a23 100644 --- a/htdocs/public/company/new.php +++ b/htdocs/public/company/new.php @@ -215,6 +215,9 @@ if (empty($reshook) && $action == 'add') { if (!$error) { $societe = new Societe($db); + // TODO Support MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS + + $societe->name = GETPOST('name', 'alphanohtml'); $societe->client = GETPOSTINT('client') ? GETPOSTINT('client') : $societe->client; From f64a07861d166ccc69394a08c21f4044272dbab2 Mon Sep 17 00:00:00 2001 From: MaximilienR-easya <122890855+MaximilienR-easya@users.noreply.github.com> Date: Wed, 18 Sep 2024 01:25:28 +0200 Subject: [PATCH 08/50] Fix php8 change, '' != 0 since php8 (#30997) * Fix php8 change, '' != 0 since php8 * Update dispatch.php --------- Co-authored-by: Laurent Destailleur --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 307d82ebdd3..dfff2f7051c 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -258,7 +258,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { } // We ask to move a qty - if (GETPOST($qty) != 0) { + if ((float) GETPOST($qty) != 0) { if (!(GETPOST($ent, 'int') > 0)) { dol_syslog('No dispatch for line '.$key.' as no warehouse was chosen.'); $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' '.($numline); From 9165091d35ecb70b5a96d288de214ab8615bf9d5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 18 Sep 2024 01:32:56 +0200 Subject: [PATCH 09/50] ChangeLog v20 (#30988) --- ChangeLog | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index bbd341b5d7e..6f2c15dfe29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,10 @@ NEW: Accountancy - Add possibility for specific format FEC to sort with the FEC NEW: Accountancy - Expense report - Add an option to use end period for transfer (#26706) NEW: Accountancy - Show accounting result on balance NEW: Accountancy - Show import key if exist (#29265) +NEW: Accountancy - Auto-determine piece number in FEC import (#29672) +NEW: Accountancy - Option to transfer only reconciled lines from bank (#29408) +NEW: Accountancy - Separation of accounting default account for salary and expense report +NEW: Various payment - Use list of accounting account when edit (#27992) NEW: Add option to change all service dates at once NEW: Add a default limit in nb to agenda export NEW: Add a Feedback-ID into email headers @@ -73,7 +77,6 @@ NEW: Allow smileys into emailing html content NEW: Allow to set a default project for POS sales (#27042) NEW: animation for display spinner when waiting response NEW: Asset Module - make asset model creation in a single step (#26982) -NEW: auto-determine piece number in FEC import (#29672) NEW: auto fill infos in template email NEW: Automatically fill matching extra fields of object on line creation. (#27240) NEW: Can add documents on a payment (#29660) @@ -110,7 +113,7 @@ NEW: fetch object by element for website account card NEW: filter on sale representative in contact list NEW: Filter shipments by selecting multiple shipping methods (#28376) NEW: Font param Look and Feel (#29302) -NEW: fuctionnality for stock configuration prompt in AI module (#28030) +NEW: functionality for stock configuration prompt in AI module (#28030) NEW: functionality to delete contact of company list NEW: functionality to display codebar on pdf files (#29623) NEW: functionality to list event for user @@ -142,7 +145,6 @@ NEW: notification action triggers for cancelling orders and invoices NEW: now button when editing an event NEW: online signature of shipments (#29559) NEW: On OAuth Google login, no prompt at all if already logged in Google -NEW: Option to transfer only reconciliated lines from bank (#29408) NEW: Param to show main menu logo in color look and feel (#29305) NEW: Payment page received from donations NEW: possibility to define a completely inactive module (#29289) @@ -155,7 +157,6 @@ NEW: resource address, phone, email & maxusers (#28185) NEW: Script for fast identification of missing/unused/duplicate translations NEW: search member by date NEW: See the documents of my subordinates (#28318) -NEW: separation of expense report from salary accounting code NEW: Show error on ical parse NEW: Show the profit per attendee on events NEW: signed status CRUD to contract and fichinter @@ -182,7 +183,6 @@ NEW: Update expense report card.php to allow pdf preview even without thumbnail NEW: update price with auto to use const for rounding prices (#29350) NEW: Use a nicer combo list to select the export accounting format NEW: users can set their own length for short lists -NEW: Various payment - Use list of account when edit (#27992) NEW: warning message when cloning a product whose status is not to sell (#28374) PERF: Performance enhancement on Invoice/Paiement area page PERF: Use cache for loaded users/contact on project list @@ -195,6 +195,7 @@ SEC: Reduce nb of var without WAF used when using the website module For developers or integrators: ------------------------------ +NEW: Situation invoice - Add new official progressive mode - (constant INVOICE_USE_SITUATION = 2) NEW: $noescapetags param of dol_escape_html works if attributes NEW: Add createInvoiceFromContract to API invoice (#27277) NEW: add debugging info to api/status if non-production From ea5d55a9a875a1c4de681310538c096136014a47 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Sep 2024 02:03:50 +0200 Subject: [PATCH 10/50] fix phpstan (#30991) * fix phpstan * fix phpstan --- htdocs/product/stock/massstockmove.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index d17e9bb1259..c2eddc5a4e5 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -177,7 +177,7 @@ if ($action == 'createmovements' && $user->hasRight('stock', 'mouvement', 'creer if (!GETPOST("label")) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired"), $langs->transnoentitiesnoconv("MovementLabel"), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MovementLabel")), null, 'errors'); } $db->begin(); From 6593e7f3c31c88ccf80f4312ed9e6b8e0b67bb58 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Wed, 18 Sep 2024 02:53:38 +0200 Subject: [PATCH 11/50] Qaul - remove parameter not used in trans function of WebPortal (#31004) --- htdocs/public/webportal/webportal.main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/webportal/webportal.main.inc.php b/htdocs/public/webportal/webportal.main.inc.php index 2ee4778aad6..3fbe5b3d825 100644 --- a/htdocs/public/webportal/webportal.main.inc.php +++ b/htdocs/public/webportal/webportal.main.inc.php @@ -213,7 +213,7 @@ if (!defined('WEBPORTAL_NOLOGIN') && !empty($context->controllerInstance->access if ($user_id <= 0) { $error++; - $error_msg = $langs->transnoentitiesnoconv('WebPortalSetupNotComplete', $user_id); + $error_msg = $langs->transnoentitiesnoconv('WebPortalSetupNotComplete'); dol_syslog($error_msg, LOG_WARNING); $context->setEventMessages($error_msg, null, 'errors'); } From 126dc77ef3162ab4feeb8eb5866fd35ecd674e56 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 18 Sep 2024 03:03:05 +0200 Subject: [PATCH 12/50] fix: add missing hook in propal and invoice (contact and document tabs) (#30518) * add missing hook in propal contact and document * add missing hook in propal contact and document * add missing hook in propal and invoice (contact and document) * add missing hook in propal and invoice (contact and document) * add missing hook in propal and invoice (contact and document) * review: change inithook place --- htdocs/comm/propal/contact.php | 2 +- htdocs/comm/propal/document.php | 1 + htdocs/compta/facture/contact.php | 3 +-- htdocs/compta/facture/document.php | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 26bb7c5818e..dbe7790c21d 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -67,11 +67,11 @@ $socid = ''; if (!empty($user->socid)) { $socid = $user->socid; } +$hookmanager->initHooks(array('proposalcontactcard', 'globalcard')); restrictedArea($user, 'propal', $object->id); $usercancreate = $user->hasRight("propal", "creer"); - /* * Add a new contact */ diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 0a7584248c0..45349be6286 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -81,6 +81,7 @@ $socid = ''; if (!empty($user->socid)) { $socid = $user->socid; } +$hookmanager->initHooks(array('propaldocument', 'globalcard')); restrictedArea($user, 'propal', $object->id); $usercancreate = $user->hasRight("propal", "creer"); diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 38d51f7b8b8..5c577ff0df6 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -55,12 +55,11 @@ $object = new Facture($db); if ($id > 0 || !empty($ref)) { $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0)); } - +$hookmanager->initHooks(array('invoicecontactcard', 'globalcard')); $result = restrictedArea($user, 'facture', $object->id); $usercancreate = $user->hasRight("facture", "creer"); - /* * Add a new contact */ diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index af633e14f90..ed0498c6753 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -79,6 +79,7 @@ $permissiontoadd = $user->hasRight('facture', 'creer'); if ($user->socid) { $socid = $user->socid; } +$hookmanager->initHooks(array('invoicedocument', 'globalcard')); $result = restrictedArea($user, 'facture', $object->id, ''); $usercancreate = $user->hasRight("facture", "creer"); From dcba3347d876d25e379866b9a321e91dde9face5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= <121813548+altairis-benjamin@users.noreply.github.com> Date: Wed, 18 Sep 2024 03:22:38 +0200 Subject: [PATCH 13/50] Retroport: FIX determine multi-currency price on object line create tpl (#28021) (#30535) * NEW determine multi-currency price on object line create tpl (#28021) * Update html.form.class.php --------- Co-authored-by: lvessiller-opendsi Co-authored-by: Laurent Destailleur --- htdocs/core/class/html.form.class.php | 63 ++++++++++++++--------- htdocs/core/lib/ajax.lib.php | 17 +++++- htdocs/core/tpl/objectline_create.tpl.php | 34 ++++++++++-- 3 files changed, 83 insertions(+), 31 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e262eb163c9..67a8dab7845 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3381,9 +3381,10 @@ class Form } $sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, p.fk_product_type, p.stock, p.tva_tx as tva_tx_sale, p.default_vat_code as default_vat_code_sale,"; - $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,"; - $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.default_vat_code, pfp.fk_soc, s.nom as name,"; - $sql .= " pfp.supplier_reputation"; + $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice"; + $sql .= ", pfp.multicurrency_code, pfp.multicurrency_unitprice"; + $sql .= ", pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.default_vat_code, pfp.fk_soc, s.nom as name"; + $sql .= ", pfp.supplier_reputation"; // if we use supplier description of the products if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) { $sql .= ", pfp.desc_fourn as description"; @@ -3689,6 +3690,10 @@ class Form $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"'; $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"'; + if (isModEnabled('multicurrency')) { + $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"'; + $optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"'; + } } $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"'; @@ -3710,6 +3715,10 @@ class Form 'disabled' => (empty($objp->idprodfournprice) ? true : false), 'description' => $objp->description ); + if (isModEnabled('multicurrency')) { + $outarrayentry['multicurrency_code'] = $objp->multicurrency_code; + $outarrayentry['multicurrency_unitprice'] = price2num($objp->multicurrency_unitprice, 'MU'); + } $parameters = array( 'objp' => &$objp, @@ -3725,29 +3734,33 @@ class Form // "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax // "label" value of json key array is used by jQuery automatically as text for combo box $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "\n"; - array_push( - $outarray, - array('key' => $outkey, - 'value' => $outref, - 'label' => $outvallabel, - 'qty' => $outqty, - 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty - 'price_qty_ht_locale' => price($objp->fprice), - 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price - 'price_unit_ht_locale' => price($objp->unitprice), - 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) - 'tva_tx_formated' => price($objp->tva_tx), - 'tva_tx' => price2num($objp->tva_tx), - 'default_vat_code' => $objp->default_vat_code, - 'discount' => $outdiscount, - 'type' => $outtype, - 'duration_value' => $outdurationvalue, - 'duration_unit' => $outdurationunit, - 'disabled' => (empty($objp->idprodfournprice) ? true : false), - 'description' => $objp->description - ) + $outarraypush = array( + 'key' => $outkey, + 'value' => $outref, + 'label' => $outvallabel, + 'qty' => $outqty, + 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty + 'price_qty_ht_locale' => price($objp->fprice), + 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price + 'price_unit_ht_locale' => price($objp->unitprice), + 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) + 'tva_tx_formated' => price($objp->tva_tx), + 'tva_tx' => price2num($objp->tva_tx), + 'default_vat_code' => $objp->default_vat_code, + 'discount' => $outdiscount, + 'type' => $outtype, + 'duration_value' => $outdurationvalue, + 'duration_unit' => $outdurationunit, + 'disabled' => (empty($objp->idprodfournprice) ? true : false), + 'description' => $objp->description ); - // Exemple of var_dump $outarray + if (isModEnabled('multicurrency')) { + $outarraypush['multicurrency_code'] = $objp->multicurrency_code; + $outarraypush['multicurrency_unitprice'] = price2num($objp->multicurrency_unitprice, 'MU'); + } + array_push($outarray, $outarraypush); + + // Example of var_dump $outarray // array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp" // ["label"]=>string(76) "ppp (fff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)" // ["qty"]=>string(1) "1" ["discount"]=>string(1) "0" ["disabled"]=>bool(false) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 34ca110dd1e..67f64a76661 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -163,6 +163,14 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen price_ttc: item.price_ttc, price_unit_ht: item.price_unit_ht, price_unit_ht_locale: item.price_unit_ht_locale, + '; + if (isModEnabled('multicurrency')) { + $script .= ' + multicurrency_code: item.multicurrency_code, + multicurrency_unitprice: item.multicurrency_unitprice, + '; + } + $script .= ' description : item.description, ref_customer: item.ref_customer, tva_tx: item.tva_tx, @@ -194,7 +202,14 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen $("#'.$htmlnamejquery.'").attr("data-tvatx", ui.item.tva_tx); $("#'.$htmlnamejquery.'").attr("data-default-vat-code", ui.item.default_vat_code); '; - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + if (isModEnabled('multicurrency')) { + $script .= ' + // For multi-currency values + $("#'.$htmlnamejquery.'").attr("data-multicurrency-code", ui.item.multicurrency_code); + $("#'.$htmlnamejquery.'").attr("data-multicurrency-unitprice", ui.item.multicurrency_unitprice); + '; + } + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { $script .= ' // For customer price when PRODUIT_CUSTOMER_PRICES_BY_QTY is on console.log("PRODUIT_CUSTOMER_PRICES_BY_QTY is on, propagate also prices by quantity into data-pbqxxx properties"); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 42377634ff9..7a5f36af592 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -1035,12 +1035,36 @@ if (!empty($usemargins) && $user->rights->margins->creer) { var supplier_ref = $('option:selected', this).attr('data-supplier-ref'); // When select is done from HTML select if (typeof supplier_ref === 'undefined') { supplier_ref = jQuery('#idprodfournprice').attr('data-supplier-ref');} // When select is done from HTML input with ajax autocomplete - console.log("objectline_create.tpl We find supplier price : up = "+up+", up_locale = "+up_locale+", supplier_ref = "+supplier_ref+" qty = "+qty+", tva_tx = "+tva_tx+", default_vat_code = "+default_vat_code+", stringforvatrateselection="+stringforvatrateselection+", discount = "+discount+" for product supplier ref id = "+jQuery('#idprodfournprice').val()); + var has_multicurrency_up = false; + multicurrency_code != $conf->currency) { + ?> + var object_multicurrency_code = 'multicurrency_code); ?>'; - if (typeof up_locale === 'undefined') { - jQuery("#price_ht").val(up); - } else { - jQuery("#price_ht").val(up_locale); + var multicurrency_code = $('option:selected', this).attr('data-multicurrency-code'); // When select is done from HTML select + if (multicurrency_code == undefined) { multicurrency_code = jQuery('#idprodfournprice').attr('data-multicurrency-code'); } // When select is done from HTML input with ajax autocomplete + + var multicurrency_up = parseFloat($('option:selected', this).attr('data-multicurrency-unitprice')); // When select is done from HTML select + if (isNaN(multicurrency_up)) { multicurrency_up = parseFloat(jQuery('#idprodfournprice').attr('data-multicurrency-unitprice')); } // When select is done from HTML input with ajax autocomplete + + if (multicurrency_code == object_multicurrency_code) { + has_multicurrency_up = true; + jQuery("#multicurrency_price_ht").val(multicurrency_up); + } + + console.log("objectline_create.tpl Multicurrency values : object_multicurrency_code = "+object_multicurrency_code+", multicurrency_code = "+multicurrency_code+", multicurrency_up = "+multicurrency_up); + + + console.log("objectline_create.tpl We find supplier price : up = "+up+", up_locale = "+up_locale+", has_multicurrency_up = "+has_multicurrency_up+", supplier_ref = "+supplier_ref+" qty = "+qty+", tva_tx = "+tva_tx+", default_vat_code = "+default_vat_code+", stringforvatrateselection="+stringforvatrateselection+", discount = "+discount+" for product supplier ref id = "+jQuery('#idprodfournprice').val()); + + if (has_multicurrency_up === false) { + if (typeof up_locale === 'undefined') { + jQuery("#price_ht").val(up); + } else { + jQuery("#price_ht").val(up_locale); + } } // Set supplier_ref From 0cafebab552fa0bbf7dc5a173a6bdb2d0f7c4bd4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Sep 2024 13:50:57 +0200 Subject: [PATCH 14/50] Fix type of field in export --- htdocs/core/modules/modSociete.class.php | 129 ++++++++++++----------- 1 file changed, 65 insertions(+), 64 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 42953ed61e9..0c075298d3a 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -107,13 +107,13 @@ class modSociete extends DolibarrModules $r++; /* - $this->const[$r][0] = "COMPANY_HIDE_INACTIVE_IN_COMBOBOX"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "0"; - $this->const[$r][3] = "hide thirdparty customer inative in combobox"; - $this->const[$r][4] = 1; - $r++; - */ + $this->const[$r][0] = "COMPANY_HIDE_INACTIVE_IN_COMBOBOX"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "0"; + $this->const[$r][3] = "hide thirdparty customer inative in combobox"; + $this->const[$r][4] = 1; + $r++; + */ $this->const[$r][0] = "SOCIETE_ADD_REF_IN_LIST"; $this->const[$r][1] = "yesno"; @@ -144,21 +144,21 @@ class modSociete extends DolibarrModules $this->rights[$r][4] = 'lire'; /*$r++; - $this->rights[$r][0] = 241; - $this->rights[$r][1] = 'Read thirdparties customers'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'thirdparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on - $this->rights[$r][5] = 'read'; + $this->rights[$r][0] = 241; + $this->rights[$r][1] = 'Read thirdparties customers'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'thirdparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on + $this->rights[$r][5] = 'read'; - $r++; - $this->rights[$r][0] = 242; - $this->rights[$r][1] = 'Read thirdparties suppliers'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'thirdparty_supplier_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on - $this->rights[$r][5] = 'read'; - */ + $r++; + $this->rights[$r][0] = 242; + $this->rights[$r][1] = 'Read thirdparties suppliers'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'thirdparty_supplier_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on + $this->rights[$r][5] = 'read'; + */ $r++; $this->rights[$r][0] = 122; // id de la permission @@ -168,21 +168,21 @@ class modSociete extends DolibarrModules $this->rights[$r][4] = 'creer'; /* $r++; - $this->rights[$r][0] = 251; - $this->rights[$r][1] = 'Create thirdparties customers'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'thirdparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on - $this->rights[$r][5] = 'read'; + $this->rights[$r][0] = 251; + $this->rights[$r][1] = 'Create thirdparties customers'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'thirdparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on + $this->rights[$r][5] = 'read'; - $r++; - $this->rights[$r][0] = 252; - $this->rights[$r][1] = 'Create thirdparties suppliers'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'thirdparty_supplier_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on - $this->rights[$r][5] = 'read'; - */ + $r++; + $this->rights[$r][0] = 252; + $this->rights[$r][1] = 'Create thirdparties suppliers'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'thirdparty_supplier_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on + $this->rights[$r][5] = 'read'; + */ $r++; $this->rights[$r][0] = 125; // id de la permission @@ -215,14 +215,14 @@ class modSociete extends DolibarrModules $this->rights[$r][5] = 'voir'; /* - $r++; - $this->rights[$r][0] = 263; - $this->rights[$r][1] = 'Read all third parties (without their objects) by internal users (otherwise only if commercial contact). Not effective for external users (limited to themselves).'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'client'; - $this->rights[$r][5] = 'readallthirdparties_advance'; - */ + $r++; + $this->rights[$r][0] = 263; + $this->rights[$r][1] = 'Read all third parties (without their objects) by internal users (otherwise only if commercial contact). Not effective for external users (limited to themselves).'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'client'; + $this->rights[$r][5] = 'readallthirdparties_advance'; + */ $r++; $this->rights[$r][0] = 281; // id de la permission @@ -411,6 +411,7 @@ class modSociete extends DolibarrModules 's.code_compta' => "company", 's.code_compta_fournisseur' => "company", 's.client' => "company", 's.fournisseur' => "company", 's.address' => "company", 's.zip' => "company", 's.town' => "company", 's.phone' => "company", 's.email' => "company", + 's.note_private' => 'company', 's.note_public' => "company", 't.code' => "company", 's.entity' => 'company', ); // We define here only fields that use another picto @@ -599,24 +600,24 @@ class modSociete extends DolibarrModules 'table_element' => 'c_stcomm' ), /* - 's.fk_prospectlevel' => array( - 'rule' => 'fetchidfromcodeid', - 'classfile' => '/core/class/cgenericdic.class.php', - 'class' => 'CGenericDic', - 'method' => 'fetch', - 'dict' => 'DictionaryProspectLevel', - 'element' => 'c_prospectlevel', - 'table_element' => 'c_prospectlevel' - ),*/ - // TODO - // 's.fk_incoterms' => array( - // 'rule' => 'fetchidfromcodeid', - // 'classfile' => '/core/class/cincoterm.class.php', - // 'class' => 'Cincoterm', - // 'method' => 'fetch', - // 'dict' => 'IncotermLabel' - // ) - ); + 's.fk_prospectlevel' => array( + 'rule' => 'fetchidfromcodeid', + 'classfile' => '/core/class/cgenericdic.class.php', + 'class' => 'CGenericDic', + 'method' => 'fetch', + 'dict' => 'DictionaryProspectLevel', + 'element' => 'c_prospectlevel', + 'table_element' => 'c_prospectlevel' + ),*/ + // TODO + // 's.fk_incoterms' => array( + // 'rule' => 'fetchidfromcodeid', + // 'classfile' => '/core/class/cincoterm.class.php', + // 'class' => 'Cincoterm', + // 'method' => 'fetch', + // 'dict' => 'IncotermLabel' + // ) + ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); $this->import_regex_array[$r] = array(//field order as per structure of table llx_societe 's.status' => '^[0|1]', @@ -895,7 +896,7 @@ class modSociete extends DolibarrModules 'sr.datec' => 'date used for creating direct debit UMR formatted as '.dol_print_date( dol_now(), '%Y-%m-%d' - ), + ), 'sr.bank' => 'bank name eg: "ING-Direct"', 'sr.code_banque' => 'account sort code (GB)/Routing number (US) eg. "8456"', 'sr.code_guichet' => "bank code for office/branch", @@ -922,8 +923,8 @@ class modSociete extends DolibarrModules $this->import_fields_array[$r] = array('sr.fk_soc' => "ThirdPartyName*", 'sr.fk_user' => "User*"); $this->import_convertvalue_array[$r] = array( - 'sr.fk_soc' => array('rule' => 'fetchidfromref', 'classfile' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'), - 'sr.fk_user' => array('rule' => 'fetchidfromref', 'classfile' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'User') + 'sr.fk_soc' => array('rule' => 'fetchidfromref', 'classfile' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'), + 'sr.fk_user' => array('rule' => 'fetchidfromref', 'classfile' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'User') ); $this->import_examplevalues_array[$r] = array('sr.fk_soc' => "MyBigCompany", 'sr.fk_user' => "login"); } From 7a2dd3f7696060f4ca01d273c8ef9152100cfc1a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Sep 2024 14:12:07 +0200 Subject: [PATCH 15/50] FIX retreiving user specific constant --- htdocs/core/class/html.formother.class.php | 6 +++--- htdocs/core/lib/functions.lib.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index a99af668fd8..cf55a4366d1 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -524,13 +524,13 @@ class FormOther if (!empty($user->socid)) { $sql_usr .= " AND u.fk_soc = ".((int) $user->socid); } - if (getDolGlobalString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX')) { + if (getDolUserString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX', getDolGlobalString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX'))) { $sql_usr .= " AND u.employee <> 0"; } - if (getDolGlobalString('USER_HIDE_EXTERNAL_IN_COMBOBOX')) { + if (getDolUserString('USER_HIDE_EXTERNAL_IN_COMBOBOX', getDolGlobalString('USER_HIDE_EXTERNAL_IN_COMBOBOX'))) { $sql_usr .= " AND u.fk_soc IS NULL"; } - if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX')) { + if (getDolUserString('USER_HIDE_INACTIVE_IN_COMBOBOX', getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX'))) { // Can be set in setup of module User. $sql_usr .= " AND u.statut <> 0"; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 15220ea3f5f..f39f0a708a0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -249,7 +249,7 @@ function getDolUserString($key, $default = '', $tmpuser = null) $tmpuser = $user; } - return (string) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); + return (string) (isset($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); } /** @@ -267,7 +267,7 @@ function getDolUserInt($key, $default = 0, $tmpuser = null) $tmpuser = $user; } - return (int) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); + return (int) (isset($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); } From cf931a8a90c01a89f310bcaa86009aa9c124879a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Sep 2024 14:12:07 +0200 Subject: [PATCH 16/50] FIX retreiving user specific constant --- htdocs/core/class/html.formother.class.php | 6 +++--- htdocs/core/lib/functions.lib.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index a99af668fd8..cf55a4366d1 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -524,13 +524,13 @@ class FormOther if (!empty($user->socid)) { $sql_usr .= " AND u.fk_soc = ".((int) $user->socid); } - if (getDolGlobalString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX')) { + if (getDolUserString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX', getDolGlobalString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX'))) { $sql_usr .= " AND u.employee <> 0"; } - if (getDolGlobalString('USER_HIDE_EXTERNAL_IN_COMBOBOX')) { + if (getDolUserString('USER_HIDE_EXTERNAL_IN_COMBOBOX', getDolGlobalString('USER_HIDE_EXTERNAL_IN_COMBOBOX'))) { $sql_usr .= " AND u.fk_soc IS NULL"; } - if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX')) { + if (getDolUserString('USER_HIDE_INACTIVE_IN_COMBOBOX', getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX'))) { // Can be set in setup of module User. $sql_usr .= " AND u.statut <> 0"; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 15220ea3f5f..762910dc8dd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -249,7 +249,7 @@ function getDolUserString($key, $default = '', $tmpuser = null) $tmpuser = $user; } - return (string) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); + return (string) (isset($tmpuser->conf->$key) ? $tmpuser->conf->$key : $default); } /** @@ -267,7 +267,7 @@ function getDolUserInt($key, $default = 0, $tmpuser = null) $tmpuser = $user; } - return (int) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); + return (int) (isset($tmpuser->conf->$key) ? $tmpuser->conf->$key: $default); } From 66861de0977b5c097bebbe1cbd74ebe1d62708f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 19 Sep 2024 21:03:26 +0200 Subject: [PATCH 17/50] fix phpstan :rotating_light: (#31041) * fix phpstan * fix phpstan --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 8 ++++---- .../core/modules/commande/doc/pdf_eratosthene.modules.php | 8 ++++---- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 8 ++++---- htdocs/core/modules/facture/doc/pdf_octopus.modules.php | 8 ++++---- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 8 ++++---- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 8 ++++---- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 8 ++++---- .../modules/supplier_invoice/doc/pdf_canelle.modules.php | 4 ++-- .../modules/supplier_order/doc/pdf_cornas.modules.php | 4 ++-- .../modules/supplier_order/doc/pdf_muscadet.modules.php | 4 ++-- .../modules/supplier_proposal/doc/pdf_aurore.modules.php | 8 ++++---- .../modules/supplier_proposal/doc/pdf_zenith.modules.php | 4 ++-- 12 files changed, 40 insertions(+), 40 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 78b4b884bd1..1b0d36864d8 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -947,7 +947,7 @@ class pdf_einstein extends ModelePDFCommandes if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -983,7 +983,7 @@ class pdf_einstein extends ModelePDFCommandes if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1053,7 +1053,7 @@ class pdf_einstein extends ModelePDFCommandes if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1093,7 +1093,7 @@ class pdf_einstein extends ModelePDFCommandes if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 818731d1962..78f7907c719 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1153,7 +1153,7 @@ class pdf_eratosthene extends ModelePDFCommandes if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1189,7 +1189,7 @@ class pdf_eratosthene extends ModelePDFCommandes if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1257,7 +1257,7 @@ class pdf_eratosthene extends ModelePDFCommandes if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1295,7 +1295,7 @@ class pdf_eratosthene extends ModelePDFCommandes if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index dbcc4b4efa7..33efb292234 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1426,7 +1426,7 @@ class pdf_crabe extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1463,7 +1463,7 @@ class pdf_crabe extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1530,7 +1530,7 @@ class pdf_crabe extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1565,7 +1565,7 @@ class pdf_crabe extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 87b17a74a31..1b2d6c3d488 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1638,7 +1638,7 @@ class pdf_octopus extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1675,7 +1675,7 @@ class pdf_octopus extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1759,7 +1759,7 @@ class pdf_octopus extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1797,7 +1797,7 @@ class pdf_octopus extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 1942da5cbc5..026d04fed79 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1713,7 +1713,7 @@ class pdf_sponge extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1750,7 +1750,7 @@ class pdf_sponge extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1842,7 +1842,7 @@ class pdf_sponge extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1880,7 +1880,7 @@ class pdf_sponge extends ModelePDFFactures if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 39c4f86b2e1..794d00a88f3 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1132,7 +1132,7 @@ class pdf_azur extends ModelePDFPropales if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1168,7 +1168,7 @@ class pdf_azur extends ModelePDFPropales if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1235,7 +1235,7 @@ class pdf_azur extends ModelePDFPropales if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1272,7 +1272,7 @@ class pdf_azur extends ModelePDFPropales if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { $totalvat .= $tvacompl; } else { - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; } $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index cbfdab2ccb9..d1e10dbf4e1 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1235,7 +1235,7 @@ class pdf_cyan extends ModelePDFPropales } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : ''); $totalvat .= ' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval); @@ -1268,7 +1268,7 @@ class pdf_cyan extends ModelePDFPropales } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); $totalvat .= ' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval); @@ -1326,7 +1326,7 @@ class pdf_cyan extends ModelePDFPropales $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : ''); $totalvat .= ' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval); @@ -1361,7 +1361,7 @@ class pdf_cyan extends ModelePDFPropales $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); $totalvat .= ' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval); diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 1ed55a909bc..bfb54f29065 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -720,7 +720,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -745,7 +745,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); 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 b9429ebe685..1ce7e5bde72 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1021,7 +1021,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -1051,7 +1051,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 657b9d05a59..a0e9147f135 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -897,7 +897,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -927,7 +927,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 5c4c64f7967..9912b69a5b4 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -934,7 +934,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -966,7 +966,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -1019,7 +1019,7 @@ class pdf_aurore extends ModelePDFSupplierProposal } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1050,7 +1050,7 @@ class pdf_aurore extends ModelePDFSupplierProposal } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index a1e702ce891..5d2c17a1e92 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -1018,7 +1018,7 @@ class pdf_zenith extends ModelePDFSupplierProposal $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -1048,7 +1048,7 @@ class pdf_zenith extends ModelePDFSupplierProposal $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); From 3976525aef68a21ea2f8f74c06d7ebc0c0323b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 19 Sep 2024 21:07:50 +0200 Subject: [PATCH 18/50] add missing translations (#31037) * add missing translations * add missing translations --- dev/translation/ignore_translation_keys.lst | 4 +--- htdocs/core/modules/oauth/google_oauthcallback.php | 4 ++-- htdocs/langs/en_US/main.lang | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst index fcde147d65f..46124cff57e 100644 --- a/dev/translation/ignore_translation_keys.lst +++ b/dev/translation/ignore_translation_keys.lst @@ -143,7 +143,7 @@ BAN BI BOMs Back -Bad value for email, email lwas not verified by Google +Bad value for email, email was not verified by Google Bad value for returned userinfo[aud] Bad value for returned userinfo[exp]. Token expired. Bad value for returned userinfo[iss] @@ -302,8 +302,6 @@ ECMAreaDesc2 ECMDocsByProducts ECMSectionAutoDesc ECMSectionManualDesc -EMail -EMails EcmFiles EditAdherent EditAdherentAddress diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index 1be7463ac42..381ed5e3635 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -282,7 +282,7 @@ if (!GETPOST('code')) { // Verify that email is a verified email /*if (empty($userinfo['email_verified'])) { - setEventMessages($langs->trans('Bad value for email, email lwas not verified by Google'), null, 'errors'); + setEventMessages($langs->trans('Bad value for email, email was not verified by Google'), null, 'errors'); $errorincheck++; }*/ diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 3116b8f39d3..ff0914a6e69 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -722,6 +722,8 @@ TextUsedInTheMessageBody=Email body SendAcknowledgementByMail=Send confirmation email SendMail=Send email Email=Email +EMail=Email +EMails=Emails NoEMail=No email AlreadyRead=Already read NotRead=Unread From 0ba26aacdd8d5926e6c8bb14b17828366a382c15 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Sep 2024 22:51:33 +0200 Subject: [PATCH 19/50] FIX Debug option WORKFLOW_TICKET_LINK_CONTRACT. Bad id stored. Bad condition to activate it. Bad position in setup. Bad selection of catrogy on setup. --- htdocs/admin/ticket.php | 24 -------- htdocs/admin/workflow.php | 56 +++++++++++++++++-- htdocs/core/class/html.formcategory.class.php | 18 +++--- htdocs/core/modules/modTicket.class.php | 2 +- htdocs/langs/en_US/ticket.lang | 2 +- 5 files changed, 62 insertions(+), 40 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 6ae7405ca87..76fd7f98064 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -153,14 +153,6 @@ if ($action == 'updateMask') { $error++; } - if (GETPOSTISSET('product_category_id')) { - $param_ticket_product_category = GETPOSTINT('product_category_id'); - $res = dolibarr_set_const($db, 'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } - $param_delay_first_response = GETPOSTINT('delay_first_response'); $res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { @@ -579,22 +571,6 @@ print $formcategory->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp print ''; print ''; -if (isModEnabled('product')) { - $htmlname = "product_category_id"; - print ''.$langs->trans("TicketChooseProductCategory").''; - print ''; - print img_picto('', 'category', 'class="pictofixedwidth"'); - $formcategory->selectProductCategory(getDolGlobalString('TICKET_PRODUCT_CATEGORY'), $htmlname); - if ($conf->use_javascript_ajax) { - print ajax_combobox('select_'.$htmlname); - } - print ''; - print ''; - print $formcategory->textwithpicto('', $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help'); - print ''; - print ''; -} - print ''; print ''.$langs->trans("TicketsDelayBeforeFirstAnswer").""; print ' diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index d5ba9c88431..3272e7174dc 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -234,6 +234,12 @@ $workflowcodes = array_filter( } ); +if ($action == 'setvarworkflow') { // Test on permission already done + if (GETPOSTISSET('product_category_id')) { + $param_ticket_product_category = GETPOSTINT('product_category_id'); + $res = dolibarr_set_const($db, 'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category, 'chaine', 0, '', $conf->entity); + } +} /* @@ -261,22 +267,30 @@ if (count($workflowcodes) < 1) { // Sort on position $workflowcodes = dol_sort_array($workflowcodes, 'position'); -print ''; +print ''; +print ''; +print ''; +print ''; $oldfamily = ''; +$tableopen = 0; +$atleastoneline = 0; foreach ($workflowcodes as $key => $params) { if ($params['family'] == 'separator') { - print '
'; - print '
'; - - print ''; + if ($atleastoneline) { + print '
'; + print '
'; + $oldfamily = ''; + $atleastoneline = 0; + } continue; } $reg = array(); if ($oldfamily != $params['family']) { + // New group if ($params['family'] == 'create') { $header = $langs->trans("AutomaticCreation"); } elseif (preg_match('/classify_(.*)/', $params['family'], $reg)) { @@ -308,6 +322,9 @@ foreach ($workflowcodes as $key => $params) { $header = $langs->trans("Description"); } + print ''; + $tableopen = 1; + print ''; print ''; print ''; @@ -316,6 +333,8 @@ foreach ($workflowcodes as $key => $params) { $oldfamily = $params['family']; } + $atleastoneline = 1; + print ''; print ''; print ''; } -print '
'.$header.''.$langs->trans("Status").'
'; print img_object('', $params['picto'], 'class="pictofixedwidth"'); @@ -328,6 +347,26 @@ foreach ($workflowcodes as $key => $params) { print ' '.img_warning($langs->transnoentitiesnoconv("Deprecated")); } + if ($key == 'WORKFLOW_TICKET_LINK_CONTRACT' && getDolGlobalString('WORKFLOW_TICKET_LINK_CONTRACT')) { + require_once DOL_DOCUMENT_ROOT."/core/class/html.formcategory.class.php"; + + $formcategory = new FormCategory($db); + + $htmlname = "product_category_id"; + print '
'; + print $formcategory->textwithpicto($langs->trans("TicketChooseProductCategory"), $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help'); + if (isModEnabled('category')) { + print '   '.img_picto('', 'category', 'class="pictofixedwidth"'); + $formcategory->selectProductCategory(getDolGlobalInt('TICKET_PRODUCT_CATEGORY'), $htmlname, 1); + if ($conf->use_javascript_ajax) { + print ajax_combobox('select_'.$htmlname); + } + print ''; + } else { + print 'Module category must be enabled'; + } + } + print '
'; @@ -354,7 +393,12 @@ foreach ($workflowcodes as $key => $params) { print '
'; +if ($tableopen) { + print ''; +} + +print ''; + // End of page llxFooter(); diff --git a/htdocs/core/class/html.formcategory.class.php b/htdocs/core/class/html.formcategory.class.php index 193967845ab..731559ed119 100644 --- a/htdocs/core/class/html.formcategory.class.php +++ b/htdocs/core/class/html.formcategory.class.php @@ -23,6 +23,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; /** @@ -101,6 +102,8 @@ class FormCategory extends Form /** * Prints a select form for products categories + * TODO Remove this. We should already have a generic method to get list of product category. + * * @param int $selected Id category pre-selection * @param string $htmlname Name of HTML field * @param int $showempty Add an empty field @@ -108,15 +111,14 @@ class FormCategory extends Form */ public function selectProductCategory($selected = 0, $htmlname = 'product_category_id', $showempty = 0) { - $sql = "SELECT cp.fk_categorie as cat_index, cat.label"; - $sql .= " FROM ".MAIN_DB_PREFIX."categorie_product as cp"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie as cat ON cat.rowid = cp.fk_categorie"; - $sql .= " GROUP BY cp.fk_categorie, cat.label"; + $sql = "SELECT cat.rowid, cat.label"; + $sql .= " FROM ".MAIN_DB_PREFIX."categorie as cat"; + $sql .= " WHERE cat.type = 0"; dol_syslog(get_class($this)."::selectProductCategory", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - print ''; if ($showempty) { print ''; } @@ -125,10 +127,10 @@ class FormCategory extends Form $num_rows = $this->db->num_rows($resql); while ($i < $num_rows) { $category = $this->db->fetch_object($resql); - if ($selected && $selected == $category->cat_index) { - print ''; + if ($selected && $selected == $category->rowid) { + print ''; } else { - print ''; + print ''; } $i++; } diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 90f63d269c1..17e6ecc9430 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -115,7 +115,7 @@ class modTicket extends DolibarrModules 5 => array('TICKET_DELAY_BEFORE_FIRST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time before a first answer to a ticket (in hours). Display a warning in tickets list if not respected.', 0), 6 => array('TICKET_DELAY_SINCE_LAST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time between two answers on the same ticket (in hours). Display a warning in tickets list if not respected.', 0), 7 => array('TICKET_NOTIFY_AT_CLOSING', 'chaine', '0', 'Default notify contacts when closing a module', 0), - 8 => array('TICKET_PRODUCT_CATEGORY', 'chaine', 0, 'The category of product that is being used for ticket accounting', 0), + 8 => array('TICKET_PRODUCT_CATEGORY', 'chaine', 0, 'The category of product that is being used to find contract to link to created ticket', 0), 9 => array('TICKET_NOTIFICATION_EMAIL_FROM', 'chaine', getDolGlobalString('MAIN_MAIL_EMAIL_FROM'), 'Email to use by default as sender for messages sent from Dolibarr', 0), 10 => array('TICKET_MESSAGE_MAIL_INTRO', 'chaine', $langs->trans('TicketMessageMailIntroText'), 'Introduction text of ticket replies sent from Dolibarr', 0), 11 => array('TICKET_MESSAGE_MAIL_SIGNATURE', 'chaine', $default_footer, 'Signature to use by default for messages sent from Dolibarr', 0), diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 2e5a6621d2e..bb0cd645857 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -132,7 +132,7 @@ TicketsAutoNotifyClose=Automatically notify the third party when closing a ticke TicketsAutoNotifyCloseHelp=When closing a ticket, you will be proposed to send a message to one of third-party contacts. On mass closing, a message will be sent to one contact of the third party linked to the ticket. TicketWrongContact=Provided contact is not part of current ticket contacts. Email not sent. TicketChooseProductCategory=Product category for ticket support -TicketChooseProductCategoryHelp=Select the product category of ticket support. This will be used to automatically link a contract to a ticket. +TicketChooseProductCategoryHelp=Select the product category for support. The category will be used to find all contracts that include a product in this category. All contracts found will be linked to the created ticket. TicketUseCaptchaCode=Use graphical code (CAPTCHA) when creating a ticket TicketUseCaptchaCodeHelp=Adds CAPTCHA verification when creating a new ticket. TicketsAllowClassificationModificationIfClosed=Allow to modify classification of closed tickets From e05600170ec910c8571aeb6925f51ed59999c2b1 Mon Sep 17 00:00:00 2001 From: MaximilienR-easya <122890855+MaximilienR-easya@users.noreply.github.com> Date: Fri, 20 Sep 2024 00:21:42 +0200 Subject: [PATCH 20/50] Fix missing required field check on public and update it to be coherent with dolibarr side (#31042) --- htdocs/public/ticket/create_ticket.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 00f637d8736..7987205419e 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -212,16 +212,16 @@ if (empty($reshook)) { } } - if (!GETPOST("subject", "alphanohtml")) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"))); - $action = ''; - } - if (!GETPOST("message", "restricthtml")) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Message"))); - $action = ''; - } + + $fieldsToCheck = [ + 'type_code' => ['check' => 'alpha', 'langs' => 'TicketTypeRequest'], + 'category_code' => ['check' => 'alpha', 'langs' => 'TicketCategory'], + 'severity_code' => ['check' => 'alpha', 'langs' => 'TicketSeverity'], + 'subject' => ['check' => 'alphanohtml', 'langs' => 'Subject'], + 'message' => ['check' => 'restricthtml', 'langs' => 'Message'] + ]; + + FormTicket::checkRequiredFields($fieldsToCheck, $error); // Check email address if (!empty($origin_email) && !isValidEmail($origin_email)) { From 23b3b07526cfe022f4585609c3b91d1a511986c0 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Fri, 20 Sep 2024 00:22:42 +0200 Subject: [PATCH 21/50] New add ip field on recurtementcandidature and societe (#31045) * New add ip field on recurtementcandidature and societe * fix CI * fix CI --------- Co-authored-by: Hystepik --- htdocs/install/mysql/migration/20.0.0-21.0.0.sql | 3 +++ .../llx_recruitment_recruitmentcandidature-recruitment.sql | 3 ++- htdocs/install/mysql/tables/llx_societe.sql | 2 ++ htdocs/recruitment/class/recruitmentcandidature.class.php | 4 ++++ htdocs/societe/class/societe.class.php | 5 +++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 88d81daffa5..6862702294c 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -127,3 +127,6 @@ ALTER TABLE llx_actioncomm_reminder ADD COLUMN datedone datetime NULL; ALTER TABLE llx_product_attribute_combination2val ADD INDEX idx_product_att_com2v_prod_combination (fk_prod_combination); ALTER TABLE llx_product_attribute_combination2val ADD INDEX idx_product_att_com2v_prod_attr (fk_prod_attr); ALTER TABLE llx_product_attribute_combination2val ADD INDEX idx_product_att_com2v_prod_attr_val (fk_prod_attr_val); + +ALTER TABLE llx_societe ADD COLUMN ip varchar(250); +ALTER TABLE llx_recruitment_recruitmentcandidature ADD COLUMN ip varchar(250); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature-recruitment.sql b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature-recruitment.sql index 676d5ade157..e52c599e012 100644 --- a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature-recruitment.sql +++ b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature-recruitment.sql @@ -40,6 +40,7 @@ CREATE TABLE llx_recruitment_recruitmentcandidature( remuneration_proposed integer, email_msgid varchar(175), -- Do not use a too large value, it generates trouble with unique index email_date datetime, - fk_recruitment_origin INTEGER NULL + fk_recruitment_origin INTEGER NULL, -- END MODULEBUILDER FIELDS + ip varchar(250) --ip used to create record (for public submission page) ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index 50b454fa281..ab5a3782ab6 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -129,5 +129,7 @@ create table llx_societe fk_multicurrency integer, multicurrency_code varchar(3), + ip varchar(250), --ip used to create record (for public submission page) + import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 999f30f675e..5de46df4c73 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -148,6 +148,10 @@ class RecruitmentCandidature extends CommonObject public $status; // END MODULEBUILDER PROPERTIES + /** + * @var string IP address + */ + public $ip; /** * Constructor diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ccde48cade0..a09ede9a4ab 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -783,6 +783,11 @@ class Societe extends CommonObject */ public $ref_ext; + /** + * @var string IP address + */ + public $ip; + /** * Import key. * Set when the thirdparty has been created through an import process. This is to relate those created thirdparties From 7308b03b1d44c2ad77abf643097c8f6f08d356e8 Mon Sep 17 00:00:00 2001 From: MaximilienR-easya <122890855+MaximilienR-easya@users.noreply.github.com> Date: Fri, 20 Sep 2024 00:28:35 +0200 Subject: [PATCH 22/50] autofill datef to now when we create an event with a status set to 100% (#31036) --- htdocs/comm/action/card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 3750da9a16f..49051464614 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -331,6 +331,8 @@ if (empty($reshook) && $action == 'add' && $usercancreate) { $datep = dol_mktime(GETPOSTINT("aphour"), GETPOSTINT("apmin"), GETPOSTINT("apsec"), GETPOSTINT("apmonth"), GETPOSTINT("apday"), GETPOSTINT("apyear"), 'tzuserrel'); $datef = dol_mktime(GETPOSTINT("p2hour"), GETPOSTINT("p2min"), GETPOSTINT("apsec"), GETPOSTINT("p2month"), GETPOSTINT("p2day"), GETPOSTINT("p2year"), 'tzuserrel'); } + //set end date to now if percentage is set to 100 and end date not set + $datef = (!$datef && $percentage == 100)?dol_now():$datef; // Check parameters if (!$datef && $percentage == 100) { From 82f947effee6e217d00ad42fe9966823dd0c89ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 20 Sep 2024 00:32:44 +0200 Subject: [PATCH 23/50] fix phpstan (#31030) * fix phpstan * fix phpstan --- htdocs/core/class/vcard.class.php | 11 ++++++----- phpstan.neon.dist | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index fb10ad03bb2..cbdad2fb2e4 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -1,8 +1,9 @@ - * Copyright (C) 2005-2017 Laurent Destailleur - * Copyright (C) 2020 Tobias Sekan - * Copyright (C) 2024 MDW +/* Copyright (C) Kai Blankenhorn + * Copyright (C) 2005-2017 Laurent Destailleur + * Copyright (C) 2020 Tobias Sekan + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -107,7 +108,7 @@ class vCard /** * Format phone number. * - * @param int $number numero de telephone + * @param string $number numero de telephone * @param string $type Type ('cell') * @return void */ diff --git a/phpstan.neon.dist b/phpstan.neon.dist index ebdf5be7c91..3eb9a2f9a28 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -73,7 +73,7 @@ parameters: - '#color.* expects int, string#' - '#imap.* expects int, string#' - '# (Setup|Asset|Proposals|Orders|Invoices|FactureRec|BonPrelevement|Products|Thirdparties)::_fetch\S*\(\) expects int, string#' - - '#(getFullName|sendTicketMessageByEmail|addItemsFact|update_price|setPhoneNumber|recur|addDepreciationLine|addline|generate|buildRumNumber|update|update_label|getSelectConditionsPaiements|select_state|listBoxes|addLineRec|literalBarcodeType)\(\) expects int, string#' + - '#(getFullName|sendTicketMessageByEmail|addItemsFact|update_price|recur|addDepreciationLine|addline|generate|buildRumNumber|update|update_label|getSelectConditionsPaiements|select_state|listBoxes|addLineRec|literalBarcodeType)\(\) expects int, string#' - '#run_sql expects int, string#' - '#on array{url: mixed} in empty\(\) does not exist.#' - '#dol_copy expects string, int given#' From 4189be78ae3ee5302e1650a9e8787e4e04b68d34 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 20 Sep 2024 00:33:30 +0200 Subject: [PATCH 24/50] Qual: Update copyright alignment (#31027) # Qual: Update copyright alignment One can observe that copyright statements already generated are manually aligned to the shorter statements in the file. 32 characters (or 8 tabs) was considered the maximum width for the name column in the entire codebase and used to generate the new copyright notices. However, this is often shortend. This update makes the fixcopyrightheader.php check the copyright notices already present in the file and adapt the new notice to those --- dev/tools/fixcopyrightheader.php | 58 +++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/dev/tools/fixcopyrightheader.php b/dev/tools/fixcopyrightheader.php index cc0e40b8517..36e964ca8fd 100755 --- a/dev/tools/fixcopyrightheader.php +++ b/dev/tools/fixcopyrightheader.php @@ -42,6 +42,32 @@ const PREFIXES = [ 'php' => ['/* ', ' * ', ' */', '\d{4}))\s+{$r_name}\s*\<{$r_email}>~"; + // Based on the tendency to limit the length of the spacing between the name + // and email to the smallest one, determine the biggest offset from the start + // of a name to the start of the email, and use that for the current name/email + // offset if it is sufficient. + // Pattern to match any copyright already present + $allpattern = "~(?:{$r_prefix0}|{$r_prefix1})Copyright \(C\)\s+(?:(?:\d{4}-)?(?:\d{4}))\s+(\S.*)<\S+>~"; + // Set minimum offset based of width of new name + $nameStartToMailStartOffset = 4 * (int) ((mb_strlen($r_name) + 4) / 4); + + if (preg_match_all($allpattern, $lines, $allmatches)) { + foreach ($allmatches[1] as $nameAndSpaces) { + //print $nameAndSpaces."\n"; + $nameAndSpaces = expandTabs($nameAndSpaces, 4); + $currentOffset = mb_strlen($nameAndSpaces); + $currentOffset = 4 * (int) ((3 + $currentOffset) / 4); + //print "Other offset $nameAndSpaces: $currentOffset\n"; + if ($currentOffset > $nameStartToMailStartOffset) { + $nameStartToMailStartOffset = $currentOffset; + } + } + } + + // Pattern to match the line matching the current developer + $pattern = "~(?:{$r_prefix0}|{$r_prefix1})Copyright \(C\)\s+(?:(?:\d{4}-)?(?\d{4}))\s+{$r_name}\s*\<{$r_email}>~"; // Check if the lines match the pattern $matches = array(); if (preg_match($pattern, $lines, $matches)) { @@ -90,7 +138,8 @@ function updateCopyrightNotice($filename, $fileType, $name, $email) // If the existing year is the same, no need to update } else { // Adjust tabs for proper alignment - $emailTabs = str_repeat("\t", (int) (max(0, (31 - mb_strlen($name)) / 4))); + print "Offset:".$nameStartToMailStartOffset."\n"; + $emailTabs = str_repeat("\t", (int) (max(0, ($nameStartToMailStartOffset + 4 - mb_strlen($name)) / 4))); // No match found, add a new line to the header $newNotice = "Copyright (C) " . date('Y') . "\t\t" . $name . $emailTabs . "<" . $email . ">"; @@ -113,7 +162,8 @@ function updateCopyrightNotice($filename, $fileType, $name, $email) } // Write the updated content back to the file - file_put_contents($filename, $fileContent); + //file_put_contents($filename, $fileContent); + print $fileContent; return true; // Change detected } From e7add0cbb3264af426f1b6288984881513da4cf0 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Fri, 20 Sep 2024 00:50:25 +0200 Subject: [PATCH 25/50] FIX custom CSS for WebPortal (#31022) --- htdocs/public/webportal/css/themes/custom.css.php | 3 +++ htdocs/public/webportal/webportal.main.inc.php | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/public/webportal/css/themes/custom.css.php b/htdocs/public/webportal/css/themes/custom.css.php index bdb1de8d7bb..d1d20c474d8 100644 --- a/htdocs/public/webportal/css/themes/custom.css.php +++ b/htdocs/public/webportal/css/themes/custom.css.php @@ -45,6 +45,9 @@ if (!defined('NOREQUIREAJAX')) { session_cache_limiter('public'); +if (!defined('MAIN_INC_REL_DIR')) { + define('MAIN_INC_REL_DIR', '../../'); +} require_once __DIR__.'/../../webportal.main.inc.php'; dol_include_once('/webportal/class/webPortalTheme.class.php'); diff --git a/htdocs/public/webportal/webportal.main.inc.php b/htdocs/public/webportal/webportal.main.inc.php index 1ad118b7360..16da910adfe 100644 --- a/htdocs/public/webportal/webportal.main.inc.php +++ b/htdocs/public/webportal/webportal.main.inc.php @@ -76,8 +76,11 @@ if (!function_exists('dol_getprefix')) { } } - -include '../../main.inc.php'; +$relDir = ''; +if (defined('MAIN_INC_REL_DIR')) { + $relDir = MAIN_INC_REL_DIR; +} +include $relDir.'../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/societeaccount.class.php'; From dbd04120795ffa19e7320f916fc2bddc2f7c3600 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Fri, 20 Sep 2024 00:50:25 +0200 Subject: [PATCH 26/50] FIX custom CSS for WebPortal (#31022) --- htdocs/public/webportal/css/themes/custom.css.php | 3 +++ htdocs/public/webportal/webportal.main.inc.php | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/public/webportal/css/themes/custom.css.php b/htdocs/public/webportal/css/themes/custom.css.php index bdb1de8d7bb..d1d20c474d8 100644 --- a/htdocs/public/webportal/css/themes/custom.css.php +++ b/htdocs/public/webportal/css/themes/custom.css.php @@ -45,6 +45,9 @@ if (!defined('NOREQUIREAJAX')) { session_cache_limiter('public'); +if (!defined('MAIN_INC_REL_DIR')) { + define('MAIN_INC_REL_DIR', '../../'); +} require_once __DIR__.'/../../webportal.main.inc.php'; dol_include_once('/webportal/class/webPortalTheme.class.php'); diff --git a/htdocs/public/webportal/webportal.main.inc.php b/htdocs/public/webportal/webportal.main.inc.php index 3fbe5b3d825..cbf21f95219 100644 --- a/htdocs/public/webportal/webportal.main.inc.php +++ b/htdocs/public/webportal/webportal.main.inc.php @@ -76,8 +76,11 @@ if (!function_exists('dol_getprefix')) { } } - -include '../../main.inc.php'; +$relDir = ''; +if (defined('MAIN_INC_REL_DIR')) { + $relDir = MAIN_INC_REL_DIR; +} +include $relDir.'../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/societeaccount.class.php'; From fda42c9d2b013d999b9997b423ac0af2eeaa34b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Sep 2024 01:20:35 +0200 Subject: [PATCH 27/50] Log --- htdocs/public/webportal/css/themes/custom.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/webportal/css/themes/custom.css.php b/htdocs/public/webportal/css/themes/custom.css.php index d1d20c474d8..a5a437a4b65 100644 --- a/htdocs/public/webportal/css/themes/custom.css.php +++ b/htdocs/public/webportal/css/themes/custom.css.php @@ -87,5 +87,5 @@ $webPortalTheme = new WebPortalTheme(); } Date: Fri, 20 Sep 2024 01:29:13 +0200 Subject: [PATCH 28/50] Fix: I see no reason to now use the common http header. --- htdocs/public/webportal/css/themes/custom.css.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/public/webportal/css/themes/custom.css.php b/htdocs/public/webportal/css/themes/custom.css.php index a5a437a4b65..528b2743e70 100644 --- a/htdocs/public/webportal/css/themes/custom.css.php +++ b/htdocs/public/webportal/css/themes/custom.css.php @@ -52,17 +52,18 @@ require_once __DIR__.'/../../webportal.main.inc.php'; dol_include_once('/webportal/class/webPortalTheme.class.php'); // Define css type -// top_httphead('text/css'); +top_httphead('text/css'); +/* header("Content-Type: text/css"); header("X-Content-Type-Options: nosniff"); header("X-Frame-Options: SAMEORIGIN"); - +*/ // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. -// if (empty($dolibarr_nocache)) { +if (empty($dolibarr_nocache)) { header('Cache-Control: max-age=10800, public, must-revalidate'); -/* } else { +} else { header('Cache-Control: no-cache'); -} */ +} $webPortalTheme = new WebPortalTheme(); From a586e2c85172de07a719ab6d5bde58d3d9cf278f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 20 Sep 2024 01:33:20 +0200 Subject: [PATCH 29/50] fix phpstan (#31018) * fix phpstan * fix phpstan * fix phpstan --- htdocs/resource/card.php | 8 ++++---- phpstan.neon.dist | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index a5ae34ae2ad..610bf06e2e7 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -1,7 +1,7 @@ - * Copyright (C) 2023-2024 William Mead - * Copyright (C) 2024 MDW +/* Copyright (C) 2013-2014 Jean-François Ferry + * Copyright (C) 2023-2024 William Mead + * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -306,7 +306,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) { print ''.$langs->trans("Description").''; print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('description', ($description ?: $object->description), '', 200, 'dolibarr_notes', false); + $doleditor = new DolEditor('description', ($description ?: $object->description), '', 200, 'dolibarr_notes'); $doleditor->Create(); print ''; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 3eb9a2f9a28..9e37b39f2b1 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -99,7 +99,6 @@ parameters: - '# dol_stringtotime expects string, DateTime given.#' - '# (load_fiche_titre|dol_add_file_process) expects string, null given.#' - '# (show_ldap_content|projectLinesa) expects string, true given.#' - - '# DolEditor constructor expects string, false given.#' - '# dol_eval expects string, array given.#' - '#expects string, bool\|mysqli_result\|resource given.#' - '#( |::)((multi)?selectarray)\(\) expects array#' From 357186722d39b8a01280adcd58823180e94ca1c1 Mon Sep 17 00:00:00 2001 From: hansemschnokeloch Date: Fri, 20 Sep 2024 01:40:34 +0200 Subject: [PATCH 30/50] Fix #31015 (#31035) datepaye is already a timestamp --- htdocs/compta/facture/class/api_invoices.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 61d125ab7b9..e5f5b0edccf 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1523,7 +1523,7 @@ class Invoices extends DolibarrApi // Creation of payment line $paymentobj = new Paiement($this->db); - $paymentobj->datepaye = dol_stringtotime($datepaye); + $paymentobj->datepaye = $datepaye; $paymentobj->amounts = $amounts; // Array with all payments dispatching with invoice id $paymentobj->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paymentobj->paiementid = $paymentid; From c00650c403601bc5fa1dadaa94bf8eb19fc404f6 Mon Sep 17 00:00:00 2001 From: kkhelifa-opendsi Date: Fri, 20 Sep 2024 01:41:40 +0200 Subject: [PATCH 31/50] NEW: Add hook on sell journal page for overwrite the processed journal data after the SQL request (#31033) --- htdocs/accountancy/journal/sellsjournal.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 086cb033bca..0929cc70717 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -374,6 +374,20 @@ if ($result) { } // After the loop on each line + $parameters = array( + 'tabfac' => &$tabfac, + 'tabht' => &$tabht, + 'tabtva' => &$tabtva, + 'def_tva' => &$def_tva, + 'tabwarranty' => &$tabwarranty, + 'tabrevenuestamp' => &$tabrevenuestamp, + 'tabttc' => &$tabttc, + 'tablocaltax1' => &$tablocaltax1, + 'tablocaltax2' => &$tablocaltax2, + 'tabcompany' => &$tabcompany, + 'vatdata_cache' => &$vatdata_cache, + ); + $reshook = $hookmanager->executeHooks('processedJournalData', $parameters); // Note that $action and $object may have been modified by hook } else { dol_print_error($db); } From 77dd2f5e9cd5e5edd831782626e6ec92eec3454c Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 20 Sep 2024 02:43:29 +0300 Subject: [PATCH 32/50] FIX #30960 show and search extrafields (#31026) --- htdocs/salaries/list.php | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 82e888ceab2..00f4f23acb7 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2015-2016 Laurent Destailleur * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,7 +68,7 @@ if (!$sortorder) { } // Initialize technical objects -$object = new PaymentSalary($db); +$object = new Salary($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->user->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('salarieslist')); // Note that conf->hooks_modules contains array @@ -250,6 +251,9 @@ $sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total $sql .= " FROM ".MAIN_DB_PREFIX."salary as s"; +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)"; +} $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON (ps.fk_salary = s.rowid) "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON (s.fk_typepayment = pst.id) "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account ba ON (ba.rowid = s.fk_account), "; @@ -297,6 +301,8 @@ if ($search_status != '' && $search_status >= 0) { if ($search_type_id) { $sql .= " AND s.fk_typepayment=".((int) $search_type_id); } +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $sql .= " GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary, u.fk_soc, u.statut,"; $sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment, s.fk_bank,"; $sql .= " ba.rowid, ba.ref, ba.number, ba.account_number, ba.fk_accountancy_journal, ba.label, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos,"; @@ -342,7 +348,7 @@ $num = $db->num_rows($resql); if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; - header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id); + header("Location: ".DOL_URL_ROOT.'/salaries/card.php?id='.$id); exit; } @@ -533,6 +539,9 @@ if (isModEnabled("banque")) { print ''; } +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + // Amount print ''; @@ -542,9 +551,6 @@ $liststatus = array('0' => $langs->trans("Unpaid"), '1' => $langs->trans("Paid") print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); print ''; -// Extra fields -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - // Fields from hook $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -585,12 +591,15 @@ if (isModEnabled("banque")) { print_liste_field_titre("DefaultBankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); $totalarray['nbfield']++; } + +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder); $totalarray['nbfield']++; print_liste_field_titre('Status', $_SERVER["PHP_SELF"], "s.paye", '', $param, 'class="right"', $sortfield, $sortorder); $totalarray['nbfield']++; -// Extra fields -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -766,6 +775,9 @@ while ($i < $imaxinloop) { // if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Amount print ''.price($obj->amount).''; if (!$i) { @@ -781,8 +793,6 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook From e252e36073e3f086650c956c687cb8e5bfa2b2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 20 Sep 2024 01:45:17 +0200 Subject: [PATCH 33/50] fix phpstan (#31024) * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan --- htdocs/admin/mailman.php | 11 ++++++----- htdocs/admin/spip.php | 7 ++----- htdocs/core/lib/admin.lib.php | 5 ++--- phpstan.neon.dist | 1 - 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index 4647f807755..43b2b25d261 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +42,6 @@ if (!$user->admin) { } -$type = array('yesno', 'texte', 'chaine'); $action = GETPOST('action', 'aZ09'); $testsubscribeemail = GETPOST("testsubscribeemail"); @@ -57,13 +57,14 @@ $error = 0; // Action updated or added a constant if ($action == 'update' || $action == 'add') { $tmparray = GETPOST('constname', 'array'); + $tmpvalue = GETPOST('constvalue', 'array'); + $tmpnote = GETPOST('constnote', 'array'); if (is_array($tmparray)) { foreach ($tmparray as $key => $val) { $constname = $tmparray[$key]; - $constvalue = $tmparray[$key]; - $consttype = $tmparray[$key]; - $constnote = $tmparray[$key]; - $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); + $constvalue = $tmpvalue[$key]; + $constnote = $tmpnote[$key]; + $res = dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, $constnote, $conf->entity); if (!($res > 0)) { $error++; diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index c6bc1c5871b..b552609bc8d 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,8 +43,6 @@ if (!$user->admin) { } -$type = array('yesno', 'texte', 'chaine'); - $action = GETPOST('action', 'aZ09'); @@ -55,7 +54,6 @@ $action = GETPOST('action', 'aZ09'); if ($action == 'update' || $action == 'add') { $constnamearray = GETPOST("constname", 'array'); $constvaluearray = GETPOST("constvalue", 'array'); - $consttypearray = GETPOST("consttype", 'array'); $constnotearray = GETPOST("constnote", 'array'); // Action mise a jour ou ajout d'une constante @@ -63,10 +61,9 @@ if ($action == 'update' || $action == 'add') { foreach ($constnamearray as $key => $val) { $constname = dol_escape_htmltag($constnamearray[$key]); $constvalue = dol_escape_htmltag($constvaluearray[$key]); - $consttype = (int) $consttypearray[$key]; $constnote = dol_escape_htmltag($constnotearray[$key]); - $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); + $res = dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, $constnote, $conf->entity); if (!($res > 0)) { $error++; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 7c7ae304d60..32f57665ccd 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1715,8 +1715,8 @@ function complete_elementList_with_modules(&$elementList) /** * Show array with constants to edit * - * @param array $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label) - * where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ... + * @param array|array $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label) + * where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ... * @param int<2,3> $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (deprecated), 2=No form nor button at all, 3=No form nor button at all and each field has a unique name (form is output by caller, recommended) (typed as int<2,3> to highlight the deprecated values) * @param string $helptext Tooltip help to use for the column name of values * @param string $text Text to use for the column name of values @@ -1767,7 +1767,6 @@ function form_constantes($tableau, $strictw3c = 2, $helptext = '', $text = 'Valu $const = $key; } } - $sql = "SELECT "; $sql .= "rowid"; $sql .= ", ".$db->decrypt('name')." as name"; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 9e37b39f2b1..56eca32956b 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -115,7 +115,6 @@ parameters: - '# Form::formconfirm\(\) expects array#' - '# FormWebPortal::selectForForms\(\) expects int, array#' - '# Lettering::getBankLinesFromFkDocAndDocType\(\) expects array#' - - '# form_constantes expects array#' - '# (Odf) constructor expects #' - '# Stripe[^ ]+::all\(\) expects #' - '#expects resource#' From ecf5f4111023f96d116c10ba63ded9a49aa81766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 20 Sep 2024 01:46:07 +0200 Subject: [PATCH 34/50] fix phpstan (#31020) * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan --- htdocs/core/tpl/passwordforgotten.tpl.php | 7 +++--- htdocs/core/tpl/passwordreset.tpl.php | 3 ++- htdocs/societe/list.php | 2 +- htdocs/societe/paymentmodes.php | 4 ++-- htdocs/stripe/admin/stripe.php | 2 +- htdocs/stripe/charge.php | 6 ++--- htdocs/stripe/class/actions_stripe.class.php | 2 +- htdocs/stripe/payout.php | 6 ++--- htdocs/stripe/transaction.php | 6 ++--- htdocs/takepos/admin/terminal.php | 3 ++- htdocs/takepos/invoice.php | 23 ++++++++++---------- htdocs/takepos/pay.php | 4 ++-- htdocs/takepos/split.php | 7 +++--- phpstan.neon.dist | 2 +- 14 files changed, 41 insertions(+), 36 deletions(-) diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 687054a6102..aa30758f3c5 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -1,6 +1,7 @@ - * Copyright (C) 2011-2013 Laurent Destailleur +/* Copyright (C) 2009-2010 Regis Houssin + * Copyright (C) 2011-2013 Laurent Destailleur + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -259,7 +260,7 @@ if ($mode == 'dolibarr' || !$disabled) { diff --git a/htdocs/core/tpl/passwordreset.tpl.php b/htdocs/core/tpl/passwordreset.tpl.php index 93e1f1d062f..3a75458b297 100644 --- a/htdocs/core/tpl/passwordreset.tpl.php +++ b/htdocs/core/tpl/passwordreset.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -300,7 +301,7 @@ if ($mode == 'dolibarr' || !$disabled) { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index dfde30e9ca3..0a761b9a716 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1141,7 +1141,7 @@ if (!empty($type)) { } if ($contextpage == 'poslist' && $type == 't' && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { - print get_htmloutput_mesg(img_warning('default').' '.$langs->trans("BecarefullChangeThirdpartyBeforeAddProductToInvoice"), '', 'warning', 1); + print get_htmloutput_mesg(img_warning('default').' '.$langs->trans("BecarefullChangeThirdpartyBeforeAddProductToInvoice"), [], 'warning', 1); } // Show the new button only when this page is not opend from the Extended POS (pop-up window) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 3184a9356e8..b8e4af6b264 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -894,10 +894,10 @@ $head = societe_prepare_head($object); // Show sandbox warning /*if (isModEnabled('paypal') && (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha'))) // We can force sand box with param 'forcesandbox' { - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Paypal'),'','warning'); + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Paypal'), [], 'warning'); }*/ if (isModEnabled('stripe') && (!getDolGlobalString('STRIPE_LIVE') || GETPOST('forcesandbox', 'alpha'))) { - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), [], 'warning'); } // Load Bank account diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index c2da0fec3b4..9c31175b1ab 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -421,7 +421,7 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // TODO Not used by current c if (isModEnabled('stripe') && (!getDolGlobalString('STRIPE_LIVE') || GETPOST('forcesandbox', 'alpha'))) { $service = 'StripeTest'; $servicestatus = '0'; - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), [], 'warning'); } else { $service = 'StripeLive'; $servicestatus = '1'; diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 0354b0b1f87..568b039fdde 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -1,7 +1,7 @@ - * Copyright (C) 2019 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,7 +72,7 @@ llxHeader('', $langs->trans("StripeChargeList")); if (isModEnabled('stripe') && (!getDolGlobalString('STRIPE_LIVE') || GETPOST('forcesandbox', 'alpha'))) { $service = 'StripeTest'; $servicestatus = '0'; - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), [], 'warning'); } else { $service = 'StripeLive'; $servicestatus = '1'; diff --git a/htdocs/stripe/class/actions_stripe.class.php b/htdocs/stripe/class/actions_stripe.class.php index 737eed49023..2f833af1336 100644 --- a/htdocs/stripe/class/actions_stripe.class.php +++ b/htdocs/stripe/class/actions_stripe.class.php @@ -70,7 +70,7 @@ class ActionsStripeconnect extends CommonHookActions if (isModEnabled('stripe') && (!getDolGlobalString('STRIPE_LIVE') || GETPOST('forcesandbox', 'alpha'))) { $service = 'StripeTest'; - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), [], 'warning'); } else { $service = 'StripeLive'; } diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php index eb64a0c0431..d9c95188353 100644 --- a/htdocs/stripe/payout.php +++ b/htdocs/stripe/payout.php @@ -1,7 +1,7 @@ - * Copyright (C) 2019 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -73,7 +73,7 @@ llxHeader('', $langs->trans("StripePayoutList")); if (isModEnabled('stripe') && (!getDolGlobalString('STRIPE_LIVE') || GETPOST('forcesandbox', 'alpha'))) { $service = 'StripeTest'; $servicestatus = '0'; - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), [], 'warning'); } else { $service = 'StripeLive'; $servicestatus = '1'; diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 7c5b8ddc72f..59e77174bb1 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,7 +1,7 @@ - * Copyright (C) 2018-2021 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2021-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,7 +75,7 @@ llxHeader('', $langs->trans("StripeTransactionList")); if (isModEnabled('stripe') && (!getDolGlobalString('STRIPE_LIVE') || GETPOST('forcesandbox', 'alpha'))) { $service = 'StripeTest'; $servicestatus = '0'; - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), [], 'warning'); } else { $service = 'StripeLive'; $servicestatus = '1'; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 596f14c6698..038b9cfbcba 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -3,6 +3,7 @@ * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2021 Thibault FOUCART * Copyright (C) 2022 Alexandre Spangaro + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -251,7 +252,7 @@ if (isModEnabled("bank")) { if (isModEnabled('stripe') && (!getDolGlobalString('STRIPE_LIVE') || GETPOST('forcesandbox', 'alpha'))) { $service = 'StripeTest'; $servicestatus = '0'; - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), [], 'warning'); } else { $service = 'StripeLive'; $servicestatus = '1'; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index f654a7d6dbb..23bb2e44c24 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1,9 +1,10 @@ - * Copyright (C) 2021 Nicolas ZABOURI - * Copyright (C) 2022-2023 Christophe Battarel - * Copyright (C) 2024 MDW + * Copyright (C) 2018 Andreu Bisquerra + * Copyright (C) 2021 Nicolas ZABOURI + * Copyright (C) 2022-2023 Christophe Battarel + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -236,19 +237,19 @@ if (empty($reshook)) { $allowstockchange = (getDolGlobalString($constantforkey) != "1"); if ($error) { - dol_htmloutput_errors($errormsg, null, 1); + dol_htmloutput_errors($errormsg, [], 1); } elseif ($invoice->status != Facture::STATUS_DRAFT) { //If invoice is validated but it is not fully paid is not error and make the payment if ($invoice->getRemainToPay() > 0) { $res = 1; } else { dol_syslog("Sale already validated"); - dol_htmloutput_errors($langs->trans("InvoiceIsAlreadyValidated", "TakePos"), null, 1); + dol_htmloutput_errors($langs->trans("InvoiceIsAlreadyValidated", "TakePos"), [], 1); } } elseif (count($invoice->lines) == 0) { $error++; dol_syslog('Sale without lines'); - dol_htmloutput_errors($langs->trans("NoLinesToBill", "TakePos"), null, 1); + dol_htmloutput_errors($langs->trans("NoLinesToBill", "TakePos"), [], 1); } elseif (isModEnabled('stock') && !isModEnabled('productbatch') && $allowstockchange) { // Validation of invoice with change into stock when produt/lot module is NOT enabled and stock change NOT disabled. // The case for isModEnabled('productbatch') is processed few lines later. @@ -606,7 +607,7 @@ if (empty($reshook)) { if ($invoice->socid <= 0) { $langs->load('errors'); - dol_htmloutput_errors($langs->trans("ErrorModuleSetupNotComplete", "TakePos"), null, 1); + dol_htmloutput_errors($langs->trans("ErrorModuleSetupNotComplete", "TakePos"), [], 1); } else { $db->begin(); @@ -968,7 +969,7 @@ if (empty($reshook)) { } } if (!$permissiontoupdateline) { - dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos").' - No permission to updateqty', null, 1); + dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos").' - No permission to updateqty', [], 1); } else { $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $number, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); } @@ -1013,7 +1014,7 @@ if (empty($reshook)) { } } if (!$permissiontoupdateline) { - dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos").' - No permission to updateprice', null, 1); + dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos").' - No permission to updateprice', [], 1); } elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) { $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); } else { @@ -1058,7 +1059,7 @@ if (empty($reshook)) { } } if (!$permissiontoupdateline) { - dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1); + dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), [], 1); } else { $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); } diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 2288727a213..03e4c4de5d4 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -149,7 +149,7 @@ function fetchConnectionToken() { } if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && (!getDolGlobalString('STRIPE_LIVE') || GETPOST('forcesandbox', 'alpha'))) { - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning', 1); + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), [], 'warning', 1); } $invoice = new Facture($db); @@ -606,7 +606,7 @@ array( $numpad = getDolGlobalString('TAKEPOS_NUMPAD'); if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) { print ''; - dol_htmloutput_mesg($langs->trans('ConnectingToStripeTerminal', 'Stripe'), '', 'warning', 1); + dol_htmloutput_mesg($langs->trans('ConnectingToStripeTerminal', 'Stripe'), [], 'warning', 1); print ''; } print ''; diff --git a/htdocs/takepos/split.php b/htdocs/takepos/split.php index fdfc98954e4..b499ef0874e 100644 --- a/htdocs/takepos/split.php +++ b/htdocs/takepos/split.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2021 Andreu Bisquerra + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -73,7 +74,7 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) { $invoice->entity = !empty($_SESSION["takeposinvoiceentity"]) ? $_SESSION["takeposinvoiceentity"] : $conf->entity; if ($invoice->socid <= 0) { $langs->load('errors'); - dol_htmloutput_errors($langs->trans("ErrorModuleSetupNotComplete", "TakePos"), null, 1); + dol_htmloutput_errors($langs->trans("ErrorModuleSetupNotComplete", "TakePos"), [], 1); } else { $placeid = $invoice->create($user); if ($placeid < 0) { @@ -102,7 +103,7 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) { $invoice->entity = !empty($_SESSION["takeposinvoiceentity"]) ? $_SESSION["takeposinvoiceentity"] : $conf->entity; if ($invoice->socid <= 0) { $langs->load('errors'); - dol_htmloutput_errors($langs->trans("ErrorModuleSetupNotComplete", "TakePos"), null, 1); + dol_htmloutput_errors($langs->trans("ErrorModuleSetupNotComplete", "TakePos"), [], 1); } else { $placeid = $invoice->create($user); if ($placeid < 0) { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 56eca32956b..d15013f2027 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -104,7 +104,7 @@ parameters: - '#( |::)((multi)?selectarray)\(\) expects array#' - '# (reWriteAllMenus|check_authentication) expects array#' - '#::(_validateMyObject|select_company)\(\) expects array Date: Fri, 20 Sep 2024 01:47:23 +0200 Subject: [PATCH 35/50] Fix bank account domiciliation address (#31019) * Fixed bank account domicilation update * Fixed bank address on create --- htdocs/compta/bank/card.php | 3 ++- htdocs/compta/bank/class/account.class.php | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 14489b92329..56c80657233 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -141,7 +141,8 @@ if (empty($reshook)) { $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1; $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); - $object->domiciliation = trim(GETPOST("domiciliation", "alphanohtml")); + $object->address = trim(GETPOST("account_address", "alphanohtml")); + $object->domiciliation = $object->address; // deprecated $object->owner_address = trim(GETPOST("owner_address", 'alphanohtml')); $object->owner_zip = trim(GETPOST("owner_zip", 'alphanohtml')); $object->owner_town = trim(GETPOST("owner_town", 'alphanohtml')); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4406dfb9a63..1357f7dbab2 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -717,6 +717,11 @@ class Account extends CommonObject $balance = 0; } + if (empty($this->address && !empty($this->domiciliation))) { + dol_syslog(get_class($this)."::create domiciliation is deprecated use address", LOG_NOTICE); + $this->address = $this->domiciliation; + } + // Load the library to validate/check a BAN account require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; @@ -768,7 +773,7 @@ class Account extends CommonObject $sql .= ", '".$this->db->escape($this->cle_rib)."'"; $sql .= ", '".$this->db->escape($this->bic)."'"; $sql .= ", '".$this->db->escape($this->iban)."'"; - $sql .= ", '".$this->db->escape($this->domiciliation)."'"; + $sql .= ", '".$this->db->escape($this->address)."'"; $sql .= ", ".((int) $this->pti_in_ctti); $sql .= ", '".$this->db->escape($this->proprio)."'"; $sql .= ", '".$this->db->escape($this->owner_address)."'"; @@ -894,7 +899,7 @@ class Account extends CommonObject $sql .= ",cle_rib='".$this->db->escape($this->cle_rib)."'"; $sql .= ",bic='".$this->db->escape($this->bic)."'"; $sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'"; - $sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'"; + $sql .= ",domiciliation='".$this->db->escape($this->address)."'"; $sql .= ",pti_in_ctti=".((int) $this->pti_in_ctti); $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; From 786ae29440af8156069cbb0aeaf89d03a82c9861 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 20 Sep 2024 01:51:13 +0200 Subject: [PATCH 36/50] Add hidden conf PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE (#31032) --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f3ea115c745..5b744cbd61c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2684,7 +2684,7 @@ class Form if ((int) $warehouseId > 0) { $urloption .= '&warehouseid=' . (int) $warehouseId; } - $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); + $out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions); if (isModEnabled('variants') && is_array($selected_combinations)) { // Code to automatically insert with javascript the select of attributes under the select of product From f9a8f6dd17d488541e539bc362d5b69fe9583b91 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Fri, 20 Sep 2024 01:54:36 +0200 Subject: [PATCH 37/50] Fix nature of thirdparty radio (#31021) * Fix nature of thirdparty radio * fix ci * add js to help manage with a const --------- Co-authored-by: Hystepik Co-authored-by: Laurent Destailleur --- htdocs/societe/card.php | 87 +++++++++++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 25 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8c8d11e966d..70a4d91de5a 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1433,12 +1433,17 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $selectedcustomer = (GETPOSTISSET('customer') ? GETPOSTINT('customer') : $selectedcustomer); print ''; if ($conf->browser->layout != 'phone') { - print ''.$form->editfieldkey('', 'customerprospect', '', $object, 0, 'string', '', 0).''; + print ''.$form->editfieldkey('NatureOfThirdParty', 'customerprospect', '', $object, 0, 'string', '', 0).''; } print 'browser->layout != 'phone' ? 'colspan="3"' : 'colspan="2"').'>'; - print ''; - print ''; + if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) { + print ''; + } + + if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) { + print ''; + } if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire')) || (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire'))) { @@ -1451,24 +1456,38 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '