From 9f5ef68123ad6336f99a36a7c791afaa7f4547e3 Mon Sep 17 00:00:00 2001 From: thomas-Ngr Date: Thu, 5 Sep 2024 16:01:31 +0200 Subject: [PATCH 001/203] fix replenish with multicurrency (#30832) * fix replenish * Use multicurrency supplier price instead of recomputing from EUR supplier price --- htdocs/product/stock/replenish.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index e3f27476488..a1a99523d91 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -194,6 +194,13 @@ if ($action == 'order' && GETPOST('valid')) { // TODO Get desc in language of thirdparty } + // If we use multicurrency + if (isModEnabled('multicurrency') && !empty($productsupplier->fourn_multicurrency_code) && $productsupplier->fourn_multicurrency_code != $conf->currency) { + $line->multicurrency_code = $productsupplier->fourn_multicurrency_code; + $line->fk_multicurrency = $productsupplier->fourn_multicurrency_id; + $line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice; + } + $line->tva_tx = $productsupplier->vatrate_supplier; $line->subprice = $productsupplier->fourn_pu; $line->total_ht = $productsupplier->fourn_pu * $qty; @@ -262,7 +269,8 @@ if ($action == 'order' && GETPOST('valid')) { null, null, 0, - $line->fk_unit + $line->fk_unit, + $line->multicurrency_subprice ?? 0 ); } if ($result < 0) { @@ -277,6 +285,7 @@ if ($action == 'order' && GETPOST('valid')) { } else { $order->socid = $suppliersid[$i]; $order->fetch_thirdparty(); + $order->multicurrency_code = $order->thirdparty->multicurrency_code; // Trick to know which orders have been generated using the replenishment feature $order->source = $order::SOURCE_ID_REPLENISHMENT; From 4cd82df73c5a87dfc65520859d1722722d483567 Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 13 Sep 2024 04:07:24 +0200 Subject: [PATCH 002/203] 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 003/203] 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 004/203] 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 005/203] 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 006/203] 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 007/203] 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 008/203] 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 009/203] 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 010/203] 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 011/203] 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 012/203] 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 013/203] 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 014/203] 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 f00a07e5640c27797b2e8d8336f4369c80d83be2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Sep 2024 13:29:07 +0200 Subject: [PATCH 015/203] FIX Translation of widget label into combo --- htdocs/core/boxes/modules_boxes.php | 17 +++++++++++------ htdocs/core/class/html.formother.class.php | 9 ++++++++- htdocs/core/class/infobox.class.php | 2 +- .../template/core/boxes/mymodulewidget1.php | 13 +++++++------ 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index c8ead22a95e..6877e50419a 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -103,32 +103,37 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo public $box_order; /** - * @var int User ID + * @var int User ID */ public $fk_user; /** - * @var string Source file + * @var string Source file */ public $sourcefile; /** - * @var string Class name + * @var string Class name */ public $class; /** - * @var string ID + * @var string ID */ public $box_id; /** - * @var string Alphanumeric ID + * @var string Box language file if it needs a specific language file. + */ + public $lang; + + /** + * @var string Alphanumeric ID */ public $boxcode; /** - * @var string Note + * @var string Note */ public $note; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 590859a1d24..37e7c6c538d 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1211,7 +1211,7 @@ class FormOther /** - * Get array with HTML tabs with boxes of a particular area including personalized choices of user. + * Get array with HTML tabs with widgets/boxes of a particular area including personalized choices of user. * Class 'Form' must be known. * * @param User $user Object User @@ -1237,8 +1237,14 @@ class FormOther if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) { $boxidactivatedforuser[$box->id] = $box->id; // We keep only boxes to show for user } + + if (!empty($box->lang)) { + $langs->loadLangs(array($box->lang)); + $box->boxlabel = $langs->transnoentitiesnoconv($box->boxlabel); + } } + // Define selectboxlist $arrayboxtoactivatelabel = array(); if (!empty($user->conf->$confuserzone)) { @@ -1248,6 +1254,7 @@ class FormOther if (!empty($boxidactivatedforuser[$box->id])) { continue; // Already visible for user } + $label = $langs->transnoentitiesnoconv($box->boxlabel); //if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')'; if (preg_match('/graph/', $box->class) && $conf->browser->layout != 'phone') { diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index 73dc687afd5..e8b8b11d7da 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -141,7 +141,7 @@ class InfoBox // TODO PERF Do not make "dol_include_once" here, nor "new" later. This means, we must store a 'depends' field to store modules list, then // the "enabled" condition for modules forbidden for external users and the depends condition can be done. - // Goal is to avoid making a "new" done for each boxes returned by select. + // Goal is to avoid to make a "new" done for each boxes returned by select. dol_include_once($relsourcefile); if (class_exists($boxname)) { $box = new $boxname($dbs, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params. diff --git a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php index 90321797398..0a1eca79027 100644 --- a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php +++ b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php @@ -50,7 +50,12 @@ class mymodulewidget1 extends ModeleBoxes /** * @var string Box label (in configuration page) */ - public $boxlabel; + public $boxlabel = 'MyWidget'; + + /** + * @var string Box language file if it needs a specific language file. + */ + public $lang = 'mymodule@mymodule'; /** * @var string[] Module dependencies @@ -71,14 +76,10 @@ class mymodulewidget1 extends ModeleBoxes */ public function __construct(DoliDB $db, $param = '') { - global $user, $conf, $langs; - // Translations - $langs->loadLangs(array("boxes", "mymodule@mymodule")); + global $user; parent::__construct($db, $param); - $this->boxlabel = $langs->transnoentitiesnoconv("MyWidget"); - $this->param = $param; // Condition when module is enabled or not From 0cafebab552fa0bbf7dc5a173a6bdb2d0f7c4bd4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Sep 2024 13:50:57 +0200 Subject: [PATCH 016/203] 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 017/203] 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 018/203] 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 a2edb28f5dae07c59f1ea9bc3e94688f18ce965e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Sep 2024 19:39:08 +0200 Subject: [PATCH 019/203] Fix css --- htdocs/core/boxes/box_scheduled_jobs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index c0e58ecba47..4e66eca08fc 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -167,10 +167,10 @@ class box_scheduled_jobs extends ModeleBoxes ); $textnoformat = ''; if ($nbjobsnotfinished) { - $textnoformat .= '
'.$nbjobsnotfinished.'
'; + $textnoformat .= '
'.$nbjobsnotfinished.'
'; } if ($nbjobsinerror) { - $textnoformat .= '
'.$nbjobsinerror.'
'; + $textnoformat .= '
'.$nbjobsinerror.'
'; } if (empty($nbjobsnotfinished) && empty($nbjobsinerror)) { $textnoformat .= '
0
'; 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 020/203] 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 021/203] 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 022/203] 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 023/203] 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 024/203] 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 025/203] 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 026/203] 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 027/203] 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 028/203] 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 029/203] 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 030/203] 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 031/203] 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 032/203] 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 033/203] 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 034/203] 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 035/203] 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 036/203] 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 037/203] 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 038/203] 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 039/203] 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 040/203] 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 ''."\n"; $out .= ''; - $out .= ''.($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; - $out .= ''.($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on', '', 0, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', 0, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', 0, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', 0, 0, 0, '', '', $marginleftonlyshort)).''; $out .= "\n"; } @@ -828,11 +828,11 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = } if (empty($conf->use_javascript_ajax) || $forcenojs) { - $out .= ''.img_picto($langs->trans($text_off), $switchoff, '', false, 0, 0, '', $cssswitchoff).''; - $out .= ''.img_picto($langs->trans($text_on), $switchon, '', false, 0, 0, '', $cssswitchon).''; + $out .= ''.img_picto($langs->trans($text_off), $switchoff, '', 0, 0, 0, '', $cssswitchoff).''; + $out .= ''.img_picto($langs->trans($text_on), $switchon, '', 0, 0, 0, '', $cssswitchon).''; } else { - $out .= ''.img_picto($langs->trans($text_off), $switchoff, '', false, 0, 0, '', $cssswitchoff).''; - $out .= ''.img_picto($langs->trans($text_on), $switchon, '', false, 0, 0, '', $cssswitchon).''; + $out .= ''.img_picto($langs->trans($text_off), $switchoff, '', 0, 0, 0, '', $cssswitchoff).''; + $out .= ''.img_picto($langs->trans($text_on), $switchon, '', 0, 0, 0, '', $cssswitchon).''; } return $out; diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 375ad2c171f..90aa23c6879 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * This file is a modified version of datepicker.php from phpBSM to fix some * bugs, to add new features and to dramatically increase speed. @@ -174,7 +175,7 @@ if ($conf->dol_use_jmobile) { $ret .= ''; $ret .= ''; $ret .= '
'; - $ret .= img_picto('', 'url', '', false, 0, 0, '', 'paddingright width20'); + $ret .= img_picto('', 'url', '', 0, 0, 0, '', 'paddingright width20'); $ret .= 'trans("OrPasteAnURL")).'"'; diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index 1a50479ae32..90b7f99f063 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -1,6 +1,7 @@ * 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 @@ -68,7 +69,7 @@ foreach ($object->fields as $key => $val) { print ''; print ''; if (!empty($val['picto'])) { - print img_picto('', $val['picto'], '', false, 0, 0, '', 'pictofixedwidth'); + print img_picto('', $val['picto'], '', 0, 0, 0, '', 'pictofixedwidth'); } if (in_array($val['type'], array('int', 'integer'))) { $value = GETPOSTINT($key); diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php index 39a029f1480..72ca7a2ba0e 100644 --- a/htdocs/core/tpl/commonfields_edit.tpl.php +++ b/htdocs/core/tpl/commonfields_edit.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 @@ -65,7 +66,7 @@ foreach ($object->fields as $key => $val) { print ''; if (!empty($val['picto'])) { - print img_picto('', $val['picto'], '', false, 0, 0, '', 'pictofixedwidth'); + print img_picto('', $val['picto'], '', 0, 0, 0, '', 'pictofixedwidth'); } if (in_array($val['type'], array('int', 'integer'))) { diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index ea3d626c64b..6b2c4418354 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -1,6 +1,7 @@ * 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 @@ -81,27 +82,27 @@ print '
'; if ($permtoadd) { $websitekeyandpageid = (!empty($websitekey) ? '&website='.urlencode($websitekey) : '').(!empty($pageid) ? '&pageid='.urlencode((string) $pageid) : ''); print ''; - print img_picto('', 'folder-plus', '', false, 0, 0, '', 'size15x marginrightonly'); + print img_picto('', 'folder-plus', '', 0, 0, 0, '', 'size15x marginrightonly'); print ''; } else { print ''; - print img_picto('', 'folder-plus', 'disabled', false, 0, 0, '', 'size15x marginrightonly'); + print img_picto('', 'folder-plus', 'disabled', 0, 0, 0, '', 'size15x marginrightonly'); print ''; } if ($module == 'ecm') { $tmpurl = ((!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) ? '#' : ($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module ? '&module='.$module : '').($section ? '&section='.$section : ''))); print ''; - print img_picto('', 'refresh', 'id="refreshbutton"', false, 0, 0, '', 'size15x marginrightonly'); + print img_picto('', 'refresh', 'id="refreshbutton"', 0, 0, 0, '', 'size15x marginrightonly'); print ''; } if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage medias of a web site print 'ref).'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; - print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly'); + print img_picto('', 'images', '', 0, 0, 0, '', 'size15x flip marginrightonly'); print ''; } elseif ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm if (getDolGlobalInt('ECM_SHOW_GENERATE_WEBP_BUTTON')) { print ''; - print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly'); + print img_picto('', 'images', '', 0, 0, 0, '', 'size15x flip marginrightonly'); print ''; } } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 00d05a7d8a3..2a3629bc573 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -725,9 +725,9 @@ if ($num > 0) { } if ($user->hasRight('cron', 'delete')) { print ''.img_picto($langs->trans('CronDelete'), 'delete', '', false, 0, 0, '', 'marginleftonly').'   '; + print '" title="'.dol_escape_htmltag($langs->trans('CronDelete')).'">'.img_picto($langs->trans('CronDelete'), 'delete', '', 0, 0, 0, '', 'marginleftonly').'   '; } else { - print ''.img_picto($langs->trans('NotEnoughPermissions'), 'delete', '', false, 0, 0, '', 'marginleftonly').'   '; + print ''.img_picto($langs->trans('NotEnoughPermissions'), 'delete', '', 0, 0, 0, '', 'marginleftonly').'   '; } if ($user->hasRight('cron', 'execute')) { if (!empty($obj->status)) { @@ -735,12 +735,12 @@ if ($num > 0) { print(!getDolGlobalString('CRON_KEY') ? '' : '&securitykey=' . getDolGlobalString('CRON_KEY')); print($sortfield ? '&sortfield='.$sortfield : ''); print($sortorder ? '&sortorder='.$sortorder : ''); - print $param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'), "play", '', false, 0, 0, '', 'marginleftonly').''; + print $param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'), "play", '', 0, 0, 0, '', 'marginleftonly').''; } else { - print ''.img_picto($langs->trans('JobDisabled'), "playdisabled", '', false, 0, 0, '', 'marginleftonly').''; + print ''.img_picto($langs->trans('JobDisabled'), "playdisabled", '', 0, 0, 0, '', 'marginleftonly').''; } } else { - print ''.img_picto($langs->trans('NotEnoughPermissions'), "playdisabled", '', false, 0, 0, '', 'marginleftonly').''; + print ''.img_picto($langs->trans('NotEnoughPermissions'), "playdisabled", '', 0, 0, 0, '', 'marginleftonly').''; } print ''; diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 003cbf6effb..c8ae6a4f658 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -432,7 +432,7 @@ print '
'; // Toolbar $url = ((!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) ? '#' : ($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module ? '&module='.$module : '').($section ? '&section='.$section : ''))); print ''; -print img_picto('', 'refresh', 'id="refreshbutton"', false, 0, 0, '', 'size15x marginrightonly'); +print img_picto('', 'refresh', 'id="refreshbutton"', 0, 0, 0, '', 'size15x marginrightonly'); print ''; print '
'; diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index 39ce910c986..9a36b208cda 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -372,33 +372,33 @@ class EmailCollectorAction extends CommonObject return $this->labelStatus[$status]; } elseif ($mode == 2) { if ($status == 1) { - return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + return img_picto($this->labelStatus[$status], 'statut4', '', 0, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($status == 0) { - return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + return img_picto($this->labelStatus[$status], 'statut5', '', 0, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } } elseif ($mode == 3) { if ($status == 1) { - return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + return img_picto($this->labelStatus[$status], 'statut4', '', 0, 0, 0, '', 'valignmiddle'); } elseif ($status == 0) { - return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return img_picto($this->labelStatus[$status], 'statut5', '', 0, 0, 0, '', 'valignmiddle'); } } elseif ($mode == 4) { if ($status == 1) { - return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + return img_picto($this->labelStatus[$status], 'statut4', '', 0, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($status == 0) { - return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + return img_picto($this->labelStatus[$status], 'statut5', '', 0, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } } elseif ($mode == 5) { if ($status == 1) { - return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', 0, 0, 0, '', 'valignmiddle'); } elseif ($status == 0) { - return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', 0, 0, 0, '', 'valignmiddle'); } } elseif ($mode == 6) { if ($status == 1) { - return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', 0, 0, 0, '', 'valignmiddle'); } elseif ($status == 0) { - return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', 0, 0, 0, '', 'valignmiddle'); } } return ""; diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index d4cbaac1bf4..fd6495d28e7 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -386,33 +386,33 @@ class EmailCollectorFilter extends CommonObject return $this->labelStatus[$status]; } elseif ($mode == 2) { if ($status == 1) { - return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + return img_picto($this->labelStatus[$status], 'statut4', '', 0, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($status == 0) { - return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + return img_picto($this->labelStatus[$status], 'statut5', '', 0, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } } elseif ($mode == 3) { if ($status == 1) { - return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + return img_picto($this->labelStatus[$status], 'statut4', '', 0, 0, 0, '', 'valignmiddle'); } elseif ($status == 0) { - return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return img_picto($this->labelStatus[$status], 'statut5', '', 0, 0, 0, '', 'valignmiddle'); } } elseif ($mode == 4) { if ($status == 1) { - return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + return img_picto($this->labelStatus[$status], 'statut4', '', 0, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($status == 0) { - return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + return img_picto($this->labelStatus[$status], 'statut5', '', 0, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } } elseif ($mode == 5) { if ($status == 1) { - return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', 0, 0, 0, '', 'valignmiddle'); } elseif ($status == 0) { - return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', 0, 0, 0, '', 'valignmiddle'); } } elseif ($mode == 6) { if ($status == 1) { - return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', 0, 0, 0, '', 'valignmiddle'); } elseif ($status == 0) { - return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', 0, 0, 0, '', 'valignmiddle'); } } return ""; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 25b54b13ba6..6cbb5f422f7 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2323,11 +2323,11 @@ if ($action == 'create') { print ' '; print ''.$langs->trans("UploadANewFileNow"); - print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); + print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', 0, 0, 0, '', 'marginleftonly'); print ''; if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) { print '   -   '.$langs->trans("AttachTheNewLineToTheDocument"); - print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); + print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', 0, 0, 0, '', 'marginleftonly'); print ''; } @@ -2478,11 +2478,11 @@ if ($action == 'create') { print ''; print ''; print ''.$langs->trans("UploadANewFileNow"); - print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); + print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', 0, 0, 0, '', 'marginleftonly'); print ''; if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) { print '   -   '.$langs->trans("AttachTheNewLineToTheDocument"); - print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); + print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', 0, 0, 0, '', 'marginleftonly'); print ''; } diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index e60a7d09725..257fbca5e3f 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -346,7 +346,7 @@ if (($id || $ref) && $action == 'edit') { print ''; print ''; // if (!empty($val['picto'])) { - // print img_picto('', $val['picto'], '', false, 0, 0, '', 'pictofixedwidth'); + // print img_picto('', $val['picto'], '', 0, 0, 0, '', 'pictofixedwidth'); // } // if (in_array($val['type'], array('int', 'integer'))) { // $value = GETPOSTISSET($key) ? GETPOST($key, 'int') : $sk->$key; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 7eeca16cf0e..5f6caa42dbb 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1029,7 +1029,7 @@ if ($step == 4 && $datatoimport) { print '
'; print ''; $s = $langs->trans("SelectImportFieldsSource", '{s1}'); - $s = str_replace('{s1}', img_picto('', 'grip_title', '', false, 0, 0, '', '', 0), $s); + $s = str_replace('{s1}', img_picto('', 'grip_title', '', 0, 0, 0, '', '', 0), $s); print $s; print ' '; $htmlother->select_import_model($importmodelid, 'importmodelid', $datatoimport, 1, $user->id); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2a614ed16e0..652e554b08b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2309,11 +2309,11 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { $logouthtmltext .= $langs->trans("Logout").'
'; $logouttext .= ''; - $logouttext .= img_picto($langs->trans('Logout').' ('.$stringforfirstkey.' l)', 'sign-out', '', false, 0, 0, '', 'atoplogin valignmiddle'); + $logouttext .= img_picto($langs->trans('Logout').' ('.$stringforfirstkey.' l)', 'sign-out', '', 0, 0, 0, '', 'atoplogin valignmiddle'); $logouttext .= ''; } else { $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]); - $logouttext .= img_picto($langs->trans('Logout').' ('.$stringforfirstkey.' l)', 'sign-out', '', false, 0, 0, '', 'atoplogin valignmiddle opacitymedium'); + $logouttext .= img_picto($langs->trans('Logout').' ('.$stringforfirstkey.' l)', 'sign-out', '', 0, 0, 0, '', 'atoplogin valignmiddle opacitymedium'); } } @@ -3700,7 +3700,7 @@ function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinpu $ret .= '
'.$title.'
'; } $ret .= '
'; - $ret .= img_picto('', $img, '', false, 0, 0, '', 'paddingright width20'); + $ret .= img_picto('', $img, '', 0, 0, 0, '', 'paddingright width20'); $ret .= ' 0) { // Define $linktoenabledisable to show after module title if (isModEnabled($modulelowercase)) { // If module is already activated $linktoenabledisable .= ''; - $linktoenabledisable .= img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', '', 1); + $linktoenabledisable .= img_picto($langs->trans("Activated"), 'switch_on', '', 0, 0, 0, '', '', 1); $linktoenabledisable .= ''; $linktoenabledisable .= $form->textwithpicto('', $langs->trans("Warning").' : '.$langs->trans("ModuleIsLive"), -1, 'warning'); @@ -3322,7 +3322,7 @@ if (is_array($listofmodules) && count($listofmodules) > 0) { } else { if (is_object($moduleobj)) { $linktoenabledisable .= ''; - $linktoenabledisable .= img_picto($langs->trans("ModuleIsNotActive", $urltomodulesetup), 'switch_off', 'style="padding-right: 8px"', false, 0, 0, '', 'classfortooltip', 1); + $linktoenabledisable .= img_picto($langs->trans("ModuleIsNotActive", $urltomodulesetup), 'switch_off', 'style="padding-right: 8px"', 0, 0, 0, '', 'classfortooltip', 1); $linktoenabledisable .= "\n"; } } diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index acfac153f22..67e49a82d3e 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -416,7 +416,7 @@ $comments = $object->getComments(); if (!empty($comments)) { foreach ($comments as $comment) { if ($user->hasRight('opensurvey', 'write')) { - print ' '.img_picto('', 'delete.png', '', false, 0, 0, '', '', 0).' '; + print ' '.img_picto('', 'delete.png', '', 0, 0, 0, '', '', 0).' '; } print dol_htmlentities($comment->usercomment).': '.dol_nl2br(dol_htmlentities($comment->comment))."
"; diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index ce744ace43e..b80ec4f864e 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -688,7 +688,7 @@ print ''."\n"; // loop to show the delete link if ($user->hasRight('opensurvey', 'write')) { for ($i = 0; isset($toutsujet[$i]); $i++) { - print ''."\n"; + print ''."\n"; } } @@ -835,7 +835,7 @@ while ($compteur < $num) { print ''."\n"; if ($user->hasRight('opensurvey', 'write')) { - print ''."\n"; + print ''."\n"; } // Name @@ -1044,7 +1044,7 @@ if (empty($testligneamodifier)) { } // Affichage du bouton de formulaire pour inscrire un nouvel utilisateur dans la base - print ''."\n"; + print ''."\n"; print ''."\n"; } diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index ec005f9600e..36cd5bdb994 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -239,8 +239,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Status'); $formorder->selectOrderStatus($search_status, 1, 'search_status'); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print '
'; print '
'; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 3047847b242..738314d3060 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -240,8 +240,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Status'); $formorder->selectSupplierOrderStatus($search_status, 1, 'search_status'); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print '
'; print '
'; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 9046187a464..cb967284491 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2014 Florian Henry + * 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 @@ -313,8 +314,8 @@ if ($id > 0 || !empty($ref)) { print $hookmanager->resPrint; print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 8c99976e7b6..35f78bcb875 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -221,8 +221,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/facturerec.php b/htdocs/product/stats/facturerec.php index 64f6402edd8..a1d3d861002 100644 --- a/htdocs/product/stats/facturerec.php +++ b/htdocs/product/stats/facturerec.php @@ -237,8 +237,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php index 0de7a78eb6d..5ed0dc2f98d 100644 --- a/htdocs/product/stats/mo.php +++ b/htdocs/product/stats/mo.php @@ -217,8 +217,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index c8a45dcdf5f..3e24565d797 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -223,8 +223,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stock/stats/commande_fournisseur.php b/htdocs/product/stock/stats/commande_fournisseur.php index 52680fe20af..d7bbfa4b032 100644 --- a/htdocs/product/stock/stats/commande_fournisseur.php +++ b/htdocs/product/stock/stats/commande_fournisseur.php @@ -5,6 +5,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2014 Florian Henry * Copyright (C) 2023 Gauthier VERDOL + * 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 @@ -296,8 +297,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stock/stats/expedition.php b/htdocs/product/stock/stats/expedition.php index 31d1ee17f46..a93aea4988d 100644 --- a/htdocs/product/stock/stats/expedition.php +++ b/htdocs/product/stock/stats/expedition.php @@ -1,10 +1,11 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2014 Florian Henry - * Copyright (C) 2023 Gauthier VERDOL +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2023 Gauthier VERDOL + * 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 @@ -295,8 +296,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stock/stats/mo.php b/htdocs/product/stock/stats/mo.php index 5e26155ea57..d0e7525f0f3 100644 --- a/htdocs/product/stock/stats/mo.php +++ b/htdocs/product/stock/stats/mo.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2021 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2023 Gauthier VERDOL + * 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 @@ -237,8 +238,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stock/stats/reception.php b/htdocs/product/stock/stats/reception.php index 2d1f23edc7c..03208c4807c 100644 --- a/htdocs/product/stock/stats/reception.php +++ b/htdocs/product/stock/stats/reception.php @@ -5,6 +5,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2014 Florian Henry * Copyright (C) 2023 Gauthier VERDOL + * 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 @@ -294,8 +295,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 9fdfe356f69..da31b0aeb2e 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -803,19 +803,19 @@ if ($action == "dosign" && empty($cancel)) { if ($object->status == $object::STATUS_SIGNED) { print '
'; if ($message == 'signed') { - print img_picto('', 'check', '', false, 0, 0, '', 'size2x').'
'; + print img_picto('', 'check', '', 0, 0, 0, '', 'size2x').'
'; print ''.$langs->trans("PropalSigned").''; } else { - print img_picto('', 'check', '', false, 0, 0, '', 'size2x').'
'; + print img_picto('', 'check', '', 0, 0, 0, '', 'size2x').'
'; print ''.$langs->trans("PropalAlreadySigned").''; } } elseif ($object->status == $object::STATUS_NOTSIGNED) { print '
'; if ($message == 'refused') { - print img_picto('', 'cross', '', false, 0, 0, '', 'size2x').'
'; + print img_picto('', 'cross', '', 0, 0, 0, '', 'size2x').'
'; print ''.$langs->trans("PropalRefused").''; } else { - print img_picto('', 'cross', '', false, 0, 0, '', 'size2x').'
'; + print img_picto('', 'cross', '', 0, 0, 0, '', 'size2x').'
'; print ''.$langs->trans("PropalAlreadyRefused").''; } } else { diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 1ea0f68211d..67fcaa31cf6 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2015 Laurent Destailleur * Copyright (C) 2014 Marcos García * 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 @@ -713,7 +714,7 @@ if ($ligneamodifier < 0 && (!isset($_SESSION['nom']))) { } // Show button to add a new line into database - print ''."\n"; + print ''."\n"; print ''."\n"; } @@ -839,9 +840,9 @@ if ($comments) { print '
'; if (in_array($obj->usercomment, $listofvoters)) { - print ' '.img_picto('', 'delete.png', '', false, 0, 0, '', 'nomarginleft').' '; + print ' '.img_picto('', 'delete.png', '', 0, 0, 0, '', 'nomarginleft').' '; } - //else print img_picto('', 'ellipsis-h', '', false, 0, 0, '', 'nomarginleft').' '; + //else print img_picto('', 'ellipsis-h', '', 0, 0, 0, '', 'nomarginleft').' '; print img_picto('', 'user', 'class="pictofixedwidth"').dol_htmlentities($obj->usercomment).': '.dol_nl2br(dol_htmlentities($obj->comment))."
"; } } diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index a61e640b739..6efc1670553 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2015 Marcos García * 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 @@ -303,11 +304,11 @@ if ($result > 0) { print ''; print ''; - print img_picto('', 'contact', '', false, 0, 0, '', 'paddingright'); + print img_picto('', 'contact', '', 0, 0, 0, '', 'paddingright'); print $form->selectarray("contactid", $newlistofemails, '', 1, 0, 0, '', 0, 0, 0, '', 'minwidth100imp maxwidthonsmartphone'); print ''; print ''; - print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright'); + print img_picto('', 'object_action', '', 0, 0, 0, '', 'paddingright'); print $form->selectarray("actionid", $actions, '', 1, 0, 0, '', 0, 0, 0, '', 'minwidth100imp maxwidthonsmartphone'); print ''; print ''; @@ -351,7 +352,7 @@ if ($result > 0) { $label = ($langs->trans("Notify_".$obj->code) != "Notify_".$obj->code ? $langs->trans("Notify_".$obj->code) : $obj->label); print ''; - print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').$label; + print img_picto('', 'object_action', '', 0, 0, 0, '', 'paddingright').$label; print ''; print ''; if ($obj->type == 'email') { diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index dda526d3cf4..99aa69d34dc 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2015 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2024 Destailleur Laurent + * 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 @@ -490,7 +491,7 @@ class ActionsTicket extends CommonHookActions print ''; print $object->LibStatut($status, 3, 1).' '; - //print img_picto($langs->trans($object->labelStatusShort[$status]), 'statut'.$status.'.png@ticket', '', false, 0, 0, '', 'valignmiddle').' '; + //print img_picto($langs->trans($object->labelStatusShort[$status]), 'statut'.$status.'.png@ticket', '', 0, 0, 0, '', 'valignmiddle').' '; print $langs->trans($object->labelStatusShort[$status]); print ''; print ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index cc6ec1c56f1..070c02063ee 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -1159,7 +1159,7 @@ while ($i < $imaxinloop) { $creation_date = $object->datec; $hour_diff_creation = ($now - $creation_date) / 3600 ; if ($hour_diff_creation > getDolGlobalInt('TICKET_DELAY_BEFORE_FIRST_RESPONSE')) { - print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE')), 'warning', 'style="color: red;"', false, 0, 0, '', ''); + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE')), 'warning', 'style="color: red;"', 0, 0, 0, '', ''); } } elseif (getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE') && $hour_diff > getDolGlobalInt('TICKET_DELAY_SINCE_LAST_RESPONSE')) { print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE')), 'warning'); diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 57fe8bcf933..024b34d7b06 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -312,7 +312,7 @@ if ($result > 0) { } print ''; print ''; - print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').$form->selectarray("actionid", $actions, '', 1); + print img_picto('', 'object_action', '', 0, 0, 0, '', 'paddingright').$form->selectarray("actionid", $actions, '', 1); print ''; print ''; $type = array('email' => $langs->trans("EMail")); @@ -357,7 +357,7 @@ if ($result > 0) { print ''; print ''; $label = ($langs->trans("Notify_".$obj->code) != "Notify_".$obj->code ? $langs->trans("Notify_".$obj->code) : $obj->label); - print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').$label; + print img_picto('', 'object_action', '', 0, 0, 0, '', 'paddingright').$label; print ''; print ''; if ($obj->type == 'email') { diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 1f5736228ee..0f318cf1ca1 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -6,7 +6,8 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2020 Tobias Sekan - * Copyright (C) 2024 MDW + * 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 @@ -604,7 +605,7 @@ if ($result) { print ''.img_picto($langs->trans("AdministratorDesc"), 'star').''; } else { print ''; - print img_picto($langs->trans("Active"), 'switch_on', '', false, 0, 0, '', 'opacitymedium'); + print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium'); print ''; } print ''; @@ -619,7 +620,7 @@ if ($result) { print ''; } else { print ''; - print img_picto($langs->trans("Active"), 'switch_on', '', false, 0, 0, '', 'opacitymedium'); + print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium'); print ''; } print ''; @@ -628,7 +629,7 @@ if ($result) { print ''; if (in_array($obj->id, $permsgroupbyentitypluszero)) { // Permission granted by group print ''; - print img_picto($langs->trans("Active"), 'switch_on', '', false, 0, 0, '', 'opacitymedium'); + print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium'); //print img_picto($langs->trans("Active"), 'tick'); print ''; print ''; @@ -644,7 +645,7 @@ if ($result) { print ''; } else { print ''; - print img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', 'opacitymedium'); + print img_picto($langs->trans("Disabled"), 'switch_off', '', 0, 0, 0, '', 'opacitymedium'); print ''; } print ''; @@ -661,7 +662,7 @@ if ($result) { print ''; } else { print ''; - print img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', 'opacitymedium'); + print img_picto($langs->trans("Disabled"), 'switch_off', '', 0, 0, 0, '', 'opacitymedium'); print ''; } print ''; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 13da613ff29..11a8fd2bf8d 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3444,9 +3444,9 @@ if (!GETPOST('hide_websitemenu')) { print ''; @@ -3600,13 +3600,13 @@ if (!GETPOST('hide_websitemenu')) { $disableeditinline = 0; if ($disableeditinline) { //print ''; - print ''.img_picto($langs->trans("OnlyEditionOfSourceForGrabbedContent"), 'switch_off', '', false, 0, 0, '', 'nomarginleft').''; + print ''.img_picto($langs->trans("OnlyEditionOfSourceForGrabbedContent"), 'switch_off', '', 0, 0, 0, '', 'nomarginleft').''; } else { //print ''; if (!getDolGlobalString('WEBSITE_EDITINLINE')) { - print ''.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').''; + print ''.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', 0, 0, 0, '', 'nomarginleft').''; } else { - print ''.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').''; + print ''.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', 0, 0, 0, '', 'nomarginleft').''; } } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 7173724b82f..9eac701b685 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -85,7 +85,6 @@ parameters: - '# (print_projecttasks(_array)?|dol_time_plus_duree|get_default_tva|get_default_npr) expects int, array#' - '# (fetchObjectByElement|print_actions_filter|dol_mktime|dol_get_first_day|dol_get_last_day|dol_remove_file_process|displayUsersListWithPicto) expects int, array\|string given.#' - '# (CSMSFile) constructor expects int, array\|string given.#' - - "# (img_picto) expects int<0, 1>, (false|'') given.#" - '#expects float\|string#' - '#expects float\|null#' - '#expects float, string given.#' From 3d3cdc51f2bcf6e7b2ebc1db5c097f1e73a626a5 Mon Sep 17 00:00:00 2001 From: Nicolas Bouquet Date: Wed, 25 Sep 2024 22:41:52 +0200 Subject: [PATCH 141/203] Ensure $id is available fot object fetching (#31098) --- htdocs/delivery/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 0d7bda4986d..a8743a38a9f 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -60,6 +60,7 @@ if (isModEnabled('incoterm')) { $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); +$id = GETPOSTINT('id'); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context @@ -81,7 +82,6 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'inclu $error = 0; // Security check -$id = GETPOSTINT('id'); if ($user->socid) { $socid = $user->socid; } From 4cd799adfa860d716e866250b72397a826b1c178 Mon Sep 17 00:00:00 2001 From: Nicolas Bouquet Date: Wed, 25 Sep 2024 22:41:52 +0200 Subject: [PATCH 142/203] Ensure $id is available fot object fetching (#31098) --- htdocs/delivery/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 909a7078dc9..d8633ef6965 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -59,6 +59,7 @@ if (isModEnabled('incoterm')) { $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); +$id = GETPOSTINT('id'); $object = new Delivery($db); $extrafields = new ExtraFields($db); @@ -78,7 +79,6 @@ $hookmanager->initHooks(array('deliverycard', 'globalcard')); $error = 0; // Security check -$id = GETPOSTINT('id'); if ($user->socid) { $socid = $user->socid; } From 11352fefce4c729e1d9479dd0bd55e9b17164f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 25 Sep 2024 22:45:23 +0200 Subject: [PATCH 143/203] fix phpstan (#31094) * fix phpstan * fix phpstan --- htdocs/public/bookcal/index.php | 2 +- phpstan.neon.dist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/bookcal/index.php b/htdocs/public/bookcal/index.php index fe941cda62e..f4bc0a324d6 100644 --- a/htdocs/public/bookcal/index.php +++ b/htdocs/public/bookcal/index.php @@ -242,7 +242,7 @@ if ($action == 'add' ) { // Test on permission not required here (anonymous acti } if (!$error) { - $dateend = dol_time_plus_duree(GETPOSTINT("datetimebooking"), GETPOST("durationbooking"), 'i'); + $dateend = dol_time_plus_duree(GETPOSTINT("datetimebooking"), GETPOSTINT("durationbooking"), 'i'); $actioncomm->label = $langs->trans("BookcalBookingTitle"); $actioncomm->type = 'AC_RDV'; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 9eac701b685..3bbd3503e02 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -82,7 +82,7 @@ parameters: - '# EmailCollector::getpart\(\) expects string#' - '#expects int, float#' - '#::saveboxorder\(\) expects int, array#' - - '# (print_projecttasks(_array)?|dol_time_plus_duree|get_default_tva|get_default_npr) expects int, array#' + - '# (print_projecttasks(_array)?|get_default_tva|get_default_npr) expects int, array#' - '# (fetchObjectByElement|print_actions_filter|dol_mktime|dol_get_first_day|dol_get_last_day|dol_remove_file_process|displayUsersListWithPicto) expects int, array\|string given.#' - '# (CSMSFile) constructor expects int, array\|string given.#' - '#expects float\|string#' From 28df02f039d4aec2ec2e9215734e0595eb13b256 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 25 Sep 2024 22:52:25 +0200 Subject: [PATCH 144/203] FIX avoid odt errors (#31126) --- htdocs/core/class/commondocgenerator.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index bb344ac7d8a..37700574114 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -346,6 +346,10 @@ abstract class CommonDocGenerator // phpcs:enable global $extrafields; + if (!is_object($object)) { + return array(); + } + if (empty($object->country) && !empty($object->country_code)) { $object->country = $outputlangs->transnoentitiesnoconv("Country".$object->country_code); } @@ -954,7 +958,7 @@ abstract class CommonDocGenerator // phpcs:enable global $conf; - if (is_array($extrafields->attributes[$object->table_element]['label'])) { + if (isset($extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { $formatedarrayoption = $object->array_options; From e4a93da82ed2da43f9ee5ed05e0d4bbfa581a53a Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Wed, 25 Sep 2024 22:54:31 +0200 Subject: [PATCH 145/203] FIX mysql error during dump for enable sandbox M999999 (#31116) --- htdocs/core/class/utils.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 6f75db0b150..e78cf55d344 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -532,13 +532,13 @@ class Utils } elseif ($compression == 'zstd') { fclose($handle); } - if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg)) { // No error + if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg) || preg_match('/^\/\*M?!999999/', $errormsg)) { // Start of file is ok, NOT an error $errormsg = ''; } else { - // Renommer fichier sortie en fichier erreur + // Rename file out into a file error //print "$outputfile -> $outputerror"; @dol_delete_file($outputerror, 1, 0, 0, null, false, 0); - @rename($outputfile, $outputerror); + @dol_move($outputfile, $outputerror, '0', 1, 0, 0); // Si safe_mode on et command hors du parametre exec, on a un fichier out vide donc errormsg vide if (!$errormsg) { $langs->load("errors"); From 1640fa801749299223f907966e19f35c54e925e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 25 Sep 2024 22:56:28 +0200 Subject: [PATCH 146/203] fix phpstan (#31093) * fix phpstan * fix phpstan * fix phpstan * fix phpstan --------- Co-authored-by: Laurent Destailleur --- htdocs/compta/localtax/clients.php | 6 +++--- htdocs/compta/stats/cabyprodserv.php | 4 ++-- .../movement/doc/pdf_standard_movementstock.modules.php | 4 ++-- phpstan.neon.dist | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index f69a32bdd3c..8e22f8dae98 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -1,8 +1,8 @@ * Copyright (C) 2014 Ferran Marcet - * Copyright (C) 2018 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2018-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 @@ -54,7 +54,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e if (empty($q)) { if (GETPOST("month")) { $date_start = dol_get_first_day($year_start, GETPOST("month"), false); - $date_end = dol_get_last_day($year_start, GETPOST("month"), false); + $date_end = dol_get_last_day($year_start, GETPOSTINT("month"), false); } else { $date_start = dol_get_first_day($year_start, !getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false); if (!getDolGlobalString('MAIN_INFO_VAT_RETURN') || getDolGlobalInt('MAIN_INFO_VAT_RETURN') == 2) { diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 8d84c797a6b..64c22e5eea4 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -88,8 +88,8 @@ if ($selected_type == '') { } // Date range -$year = GETPOST("year"); -$month = GETPOST("month"); +$year = GETPOSTINT("year"); +$month = GETPOSTINT("month"); $date_startyear = GETPOST("date_startyear"); $date_startmonth = GETPOST("date_startmonth"); $date_startday = GETPOST("date_startday"); diff --git a/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php b/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php index 21045e9ec21..9e64261ba51 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php @@ -166,8 +166,8 @@ class pdf_standard_movementstock extends ModelePDFMovement $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'movementlist'; $idproduct = GETPOSTINT('idproduct'); - $year = GETPOST("year"); - $month = GETPOST("month"); + $year = GETPOSTINT("year"); + $month = GETPOSTINT("month"); $search_ref = GETPOST('search_ref', 'alpha'); $search_movement = GETPOST("search_movement"); $search_product_ref = trim(GETPOST("search_product_ref")); diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 3bbd3503e02..49f34927141 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -82,8 +82,7 @@ parameters: - '# EmailCollector::getpart\(\) expects string#' - '#expects int, float#' - '#::saveboxorder\(\) expects int, array#' - - '# (print_projecttasks(_array)?|get_default_tva|get_default_npr) expects int, array#' - - '# (fetchObjectByElement|print_actions_filter|dol_mktime|dol_get_first_day|dol_get_last_day|dol_remove_file_process|displayUsersListWithPicto) expects int, array\|string given.#' + - '# (fetchObjectByElement|print_actions_filter|dol_mktime|dol_get_first_day|dol_remove_file_process|displayUsersListWithPicto) expects int, array\|string given.#' - '# (CSMSFile) constructor expects int, array\|string given.#' - '#expects float\|string#' - '#expects float\|null#' From 22729516fe001612133c7c02a4c63c4ea079245d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= <81741011+altairis-noe@users.noreply.github.com> Date: Wed, 25 Sep 2024 23:18:16 +0200 Subject: [PATCH 147/203] NEW Add mode Customer price + level price (#31091) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * NEW: customer price and level price together * NEW: translation * FIX: If a price per customer exist * FIX: do not use default price if the customer price and level price option is active * Don't display the price level amount if the customer price is known * FIX: double check and php cs correction * FIX: vatrate call * FIX: get_htmloutput_msg call --------- Co-authored-by: Mélina JOUM --- htdocs/comm/card.php | 2 +- htdocs/comm/propal/card.php | 51 +- htdocs/commande/card.php | 52 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/conf.class.php | 2 +- htdocs/core/class/html.form.class.php | 14 +- htdocs/core/lib/company.lib.php | 2 +- htdocs/core/lib/pdf.lib.php | 4 +- htdocs/langs/en_US/products.lang | 1 + htdocs/langs/fr_FR/products.lang | 1 + htdocs/product/admin/product.php | 5 + htdocs/product/ajax/products.php | 8 +- htdocs/product/card.php | 2 +- htdocs/product/class/product.class.php | 56 +- htdocs/product/price.php | 666 +++++++++++------------ htdocs/societe/class/societe.class.php | 4 +- htdocs/societe/list.php | 4 +- htdocs/societe/price.php | 4 +- 18 files changed, 513 insertions(+), 367 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 260f4ea7341..9936beaae5f 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -530,7 +530,7 @@ if ($object->id > 0) { // Multiprice level - if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { print ''; print ''; print ''; diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 7cca33a775f..a0c379f078a 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -112,7 +112,7 @@ if ($action == 'fetch' && !empty($id)) { if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { $needchangeaccordingtothirdparty = 1; } - if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { $needchangeaccordingtothirdparty = 1; } if ($needchangeaccordingtothirdparty) { @@ -135,7 +135,7 @@ if ($action == 'fetch' && !empty($id)) { } //Set price level according to thirdparty - if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { $price_level = $thirdpartytemp->price_level; } } @@ -167,7 +167,7 @@ if ($action == 'fetch' && !empty($id)) { } // Multiprice (1 price per level) - if (!$found && isset($price_level) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { // If we need a particular price level (from 1 to 6) + if (!$found && isset($price_level) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) { // If we need a particular price level (from 1 to 6) $sql = "SELECT price, price_ttc, price_base_type,"; $sql .= " tva_tx, default_vat_code"; // Vat rate and code will be used if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on. $sql .= " FROM ".MAIN_DB_PREFIX."product_price "; @@ -200,7 +200,7 @@ if ($action == 'fetch' && !empty($id)) { } // Price by customer - if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { + if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; $prodcustprice = new ProductCustomerPrice($db); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 77f511c6e48..bf905a1b9dd 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1748,7 +1748,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
'; if (!getDolGlobalString('PRODUCT_DISABLE_PRICES')) { - if (getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { // We do no show price array on create when multiprices enabled. // We must set them on prices tab. print '
'; print $langs->trans("PriceLevel"); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index d6a78f296c7..18e118a614e 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1137,8 +1137,51 @@ if (empty($reshook)) { $price_min_ttc = $prod->price_min_ttc; $price_base_type = $prod->price_base_type; - // If price per segment - if (getDolGlobalString('PRODUIT_MULTIPRICES') && $object->thirdparty->price_level) { + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { + // If price per customer + require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; + $prodcustprice = new ProductCustomerPrice($db); + $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id); + + // If a price per customer exist + $pricebycustomerexist = false; + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); + if ($result) { + // If there is some prices specific to the customer + if (count($prodcustprice->lines) > 0) { + $pricebycustomerexist = true; + $pu_ht = price($prodcustprice->lines[0]->price); + $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_min = price($prodcustprice->lines[0]->price_min); + $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); + $price_base_type = $prodcustprice->lines[0]->price_base_type; + /*$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); + if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { + $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + } + $tva_npr = $prodcustprice->lines[0]->recuperableonly; + if (empty($tva_tx)) { + $tva_npr = 0; + }*/ + } + } + + if ( !$pricebycustomerexist && $object->thirdparty->price_level) { // If price per segment + $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; + $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; + $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; + $price_min_ttc = $prod->multiprices_min_ttc[$object->thirdparty->price_level]; + $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; + if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility + if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) { + $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level]; + } + if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) { + $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level]; + } + } + } + } elseif (getDolGlobalString('PRODUIT_MULTIPRICES') && $object->thirdparty->price_level) { // If price per segment $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; @@ -1549,11 +1592,11 @@ if (empty($reshook)) { $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $price_min = $product->price_min; - if (getDolGlobalString('PRODUIT_MULTIPRICES') && !empty($object->thirdparty->price_level)) { + if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($object->thirdparty->price_level)) { $price_min = $product->multiprices_min[$object->thirdparty->price_level]; } $price_min_ttc = $product->price_min_ttc; - if (getDolGlobalString('PRODUIT_MULTIPRICES') && !empty($object->thirdparty->price_level)) { + if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($object->thirdparty->price_level)) { $price_min_ttc = $product->multiprices_min_ttc[$object->thirdparty->price_level]; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 9e1b721b58f..71dc431ec52 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -839,6 +839,54 @@ if (empty($reshook)) { $price_min_ttc = $prod->price_min_ttc; $price_base_type = $prod->price_base_type; + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { + // If price per customer + require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; + + $prodcustprice = new ProductCustomerPrice($db); + + $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id); + + // If a price per customer exist + $pricebycustomerexist = false; + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); + if ($result >= 0) { + if (count($prodcustprice->lines) > 0) { + $pricebycustomerexist = true; + $pu_ht = price($prodcustprice->lines[0]->price); + $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_min = price($prodcustprice->lines[0]->price_min); + $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); + $price_base_type = $prodcustprice->lines[0]->price_base_type; + $tva_tx = $prodcustprice->lines[0]->tva_tx; + if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { + $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + } + $tva_npr = $prodcustprice->lines[0]->recuperableonly; + if (empty($tva_tx)) { + $tva_npr = 0; + } + } + } else { + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); + } + + if ( !$pricebycustomerexist && !empty($object->thirdparty->price_level)) { //// If price per segment + $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; + $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; + $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; + $price_min_ttc = $prod->multiprices_min_ttc[$object->thirdparty->price_level]; + $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; + if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility + if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) { + $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level]; + } + if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) { + $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level]; + } + } + } + } // If price per segment if (getDolGlobalString('PRODUIT_MULTIPRICES') && !empty($object->thirdparty->price_level)) { $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; @@ -1241,11 +1289,11 @@ if (empty($reshook)) { $type = $product->type; $price_min = $product->price_min; - if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !empty($object->thirdparty->price_level)) { + if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($object->thirdparty->price_level)) { $price_min = $product->multiprices_min[$object->thirdparty->price_level]; } $price_min_ttc = $product->price_min_ttc; - if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !empty($object->thirdparty->price_level)) { + if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($object->thirdparty->price_level)) { $price_min_ttc = $product->multiprices_min_ttc[$object->thirdparty->price_level]; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8c7d624c50c..18c3017d973 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1893,7 +1893,7 @@ abstract class CommonObject $this->thirdparty = $thirdparty; // Use first price level if level not defined for third party - if (getDolGlobalString('PRODUIT_MULTIPRICES') && empty($this->thirdparty->price_level)) { + if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && empty($this->thirdparty->price_level)) { $this->thirdparty->price_level = 1; } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index e69628e64e0..961fa9f686e 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -1041,7 +1041,7 @@ class Conf extends stdClass $this->holiday->approve->warning_delay = (isset($this->global->MAIN_DELAY_HOLIDAYS) ? (int) $this->global->MAIN_DELAY_HOLIDAYS : 0) * 86400; } - if (!empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT)) { + if ((!empty($this->global->PRODUIT_MULTIPRICES) || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT)) { $this->global->PRODUIT_MULTIPRICES_LIMIT = 5; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6600ddcf9da..8ab62d55d6b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2949,7 +2949,7 @@ class Form } //Price by customer - if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { + if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { $sql .= ', pcp.rowid as idprodcustprice, pcp.price as custprice, pcp.price_ttc as custprice_ttc,'; $sql .= ' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx, pcp.default_vat_code as custdefault_vat_code, pcp.ref_customer as custref'; $selectFields .= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx, custdefault_vat_code, custref"; @@ -3007,7 +3007,7 @@ class Form } //Price by customer - if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { + if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid"; } // Units @@ -3087,7 +3087,7 @@ class Form if (getDolGlobalInt('MAIN_MULTILANGS')) { $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'"; } - if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { + if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) { $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'"; } if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { @@ -3223,7 +3223,9 @@ class Form $objp->price_ttc = price2num($objp->price_ttc, 'MU'); } } - + if (getDolGlobalInt('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES') && !empty($objp->custprice)) { + $price_level = ''; + } $this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected, $hidepriceinlabel, $filterkey); // Add new entry // "key" value of json key array is used by jQuery automatically as selected value @@ -3445,7 +3447,7 @@ class Form $labeltoshowprice = ''; $labeltoshowhtmlprice = ''; // If we need a particular price level (from 1 to n) - if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { + if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) { $sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code"; $sql .= " FROM " . $this->db->prefix() . "product_price"; $sql .= " WHERE fk_product = " . ((int) $objp->rowid); @@ -3516,7 +3518,7 @@ class Form } // Price by customer - if (empty($hidepriceinlabel) && getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { + if (empty($hidepriceinlabel) && (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) { if (!empty($objp->idprodcustprice)) { $found = 1; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index f687e80cab1..e1e369bbbb0 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -121,7 +121,7 @@ function societe_prepare_head(Societe $object) $head[$h][2] = 'customer'; $h++; - if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { $langs->load("products"); // price $head[$h][0] = DOL_URL_ROOT.'/societe/price.php?socid='.$object->id; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 8a5d3f6c7d1..57cb50e6a7e 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1506,7 +1506,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $prodser = new Product($db); - if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { include_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; } } @@ -1685,7 +1685,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, } else { $ref_prodserv = $prodser->ref; // Show local ref only - if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { $productCustomerPriceStatic = new ProductCustomerPrice($db); $filter = array('fk_product' => $idprod, 'fk_soc' => $object->socid); diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 7181b24d39b..0b8825cf058 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -437,3 +437,4 @@ AllowStockMovementVariantParentHelp=By default, a parent of a variant is a virtu ConfirmSetToDraftInventory=Are you sure you want to go back to Draft status?
The quantities currently set in the inventory will be reset. WarningLineProductNotToSell=Product or service "%s" is not to sell and was cloned PriceLabel=Price label +PriceByCustomeAndMultiPricesAbility=Different prices for each customer + Multiple price segments per product/service (each customer is in one price segment) diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 3a1c8f85c41..dc4f4dce330 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -437,3 +437,4 @@ AllowStockMovementVariantParentHelp=Par défaut, un parent d'une variante est un ConfirmSetToDraftInventory=Êtes-vous sûr de vouloir revenir à l'état de brouillon ?
Les quantités actuellement définies dans l'inventaire seront réinitialisées. WarningLineProductNotToSell=Le produit ou le service "%s" n'est pas à vendre et a été cloné. PriceLabel=Libellé du prix +PriceByCustomeAndMultiPricesAbility=Prix différents pour chaque client + Plusieurs niveaux de prix par produit/service (chaque client est dans un et un seul niveau) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 7608a84cbe1..c3f56c1e2b9 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -59,6 +59,7 @@ $select_pricing_rules = array( 'PRODUCT_PRICE_UNIQ' => $langs->trans('PriceCatalogue'), // Unique price 'PRODUIT_MULTIPRICES' => $langs->trans('MultiPricesAbility'), // Several prices according to a customer level 'PRODUIT_CUSTOMER_PRICES' => $langs->trans('PriceByCustomer'), // Different price for each customer + 'PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'=>$langs->trans('PriceByCustomeAndMultiPricesAbility'), // Different price for each customer and several prices according to a customer level ); $keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY'; if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || getDolGlobalString($keyforparam)) { @@ -113,6 +114,7 @@ if ($action == 'other') { $res = dolibarr_set_const($db, 'PRODUIT_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES', 0, 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'PRODUCT_PRICE_UNIQ', 1, 'chaine', 0, '', $conf->entity); } else { $multirule = explode('&', $princingrules); @@ -587,6 +589,9 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { $current_rule = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'; } +if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { + $current_rule = 'PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'; +} print $form->selectarray("princingrule", $select_pricing_rules, $current_rule, 0, 0, 0, '', 1, 0, 0, '', 'maxwidth400', 1); print '
'; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index b526c465d79..53431f38463 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2276,8 +2276,54 @@ class Product extends CommonObject $price_min = $this->price_min; $price_base_type = $this->price_base_type; - // If price per segment - if (getDolGlobalString('PRODUIT_MULTIPRICES') && !empty($thirdparty_buyer->price_level)) { + // if price by customer / level + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { + require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; + + $prodcustprice = new ProductCustomerPrice($this->db); + + $filter = array('t.fk_product' => $this->id, 't.fk_soc' => $thirdparty_buyer->id); + + // If a price per customer exist + $pricebycustomerexist = false; + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); + if ($result) { + if (count($prodcustprice->lines) > 0) { + $pricebycustomerexist = true; + $pu_ht = price($prodcustprice->lines[0]->price); + $price_min = price($prodcustprice->lines[0]->price_min); + $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_base_type = $prodcustprice->lines[0]->price_base_type; + $tva_tx = $prodcustprice->lines[0]->tva_tx; + if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { + $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + } + $tva_npr = $prodcustprice->lines[0]->recuperableonly; + if (empty($tva_tx)) { + $tva_npr = 0; + } + } + } + + if ( !$pricebycustomerexist && !empty($thirdparty_buyer->price_level)) { + $pu_ht = $this->multiprices[$thirdparty_buyer->price_level]; + $pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level]; + $price_min = $this->multiprices_min[$thirdparty_buyer->price_level]; + $price_base_type = $this->multiprices_base_type[$thirdparty_buyer->price_level]; + if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { + // using this option is a bug. kept for backward compatibility + if (isset($this->multiprices_tva_tx[$thirdparty_buyer->price_level])) { + $tva_tx = $this->multiprices_tva_tx[$thirdparty_buyer->price_level]; + } + if (isset($this->multiprices_recuperableonly[$thirdparty_buyer->price_level])) { + $tva_npr = $this->multiprices_recuperableonly[$thirdparty_buyer->price_level]; + } + if (empty($tva_tx)) { + $tva_npr = 0; + } + } + } + } elseif (getDolGlobalString('PRODUIT_MULTIPRICES') && !empty($thirdparty_buyer->price_level)) { // // If price per segment $pu_ht = $this->multiprices[$thirdparty_buyer->price_level]; $pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level]; $price_min = $this->multiprices_min[$thirdparty_buyer->price_level]; @@ -2576,7 +2622,7 @@ class Product extends CommonObject // If multiprices are enabled, then we check if the current product is subject to price autogeneration // Price will be modified ONLY when the first one is the one that is being modified - if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !$ignore_autogen && $this->price_autogen && ($level == 1)) { + if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !$ignore_autogen && $this->price_autogen && ($level == 1)) { return $this->generateMultiprices($user, $newprice, $newpricebase, $newvat, $newnpr, $newpbq); } @@ -2976,7 +3022,7 @@ class Product extends CommonObject } // Load multiprices array - if (getDolGlobalString('PRODUIT_MULTIPRICES') && empty($ignore_price_load)) { // prices per segment + if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && empty($ignore_price_load)) { // prices per segment $produit_multiprices_limit = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT'); for ($i = 1; $i <= $produit_multiprices_limit; $i++) { $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; @@ -3042,7 +3088,7 @@ class Product extends CommonObject return -1; } } - } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && empty($ignore_price_load)) { // prices per customers + } elseif ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && empty($ignore_price_load)) { // prices per customers // Nothing loaded by default. List may be very long. } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') && empty($ignore_price_load)) { // prices per quantity $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 9f993cb9271..8e1bd9f562a 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_expression.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; -if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { +if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; $prodcustprice = new ProductCustomerPrice($db); @@ -76,7 +76,7 @@ if ($id > 0 || !empty($ref)) { } // Clean param -if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT')) { +if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT')) { $conf->global->PRODUIT_MULTIPRICES_LIMIT = 5; } @@ -204,7 +204,7 @@ if (empty($reshook)) { } if (!$error) { - if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { $produit_multiprices_limit = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); for ($i = 1; $i <= $produit_multiprices_limit; $i++) { // Force the update of the price of the product using the new VAT @@ -261,7 +261,7 @@ if (empty($reshook)) { $action = ''; } - if (($action == 'update_price') && !$cancel && $object->getRights()->creer) { + if (($action == 'update_price' || $action == 'update_level_price') && !$cancel && $object->getRights()->creer) { $error = 0; $pricestoupdate = array(); @@ -285,7 +285,7 @@ if (empty($reshook)) { } // Multiprices - if (!$error && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { + if (!$error && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || ($action == 'update_level_price' && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')))) { $newprice = GETPOST('price', 'array'); $newprice_min = GETPOST('price_min', 'array'); $newpricebase = GETPOST('multiprices_base_type', 'array'); @@ -916,7 +916,7 @@ print '
'; print '
'; // Price per customer segment/level -if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { +if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { // Price and min price are variable (depends on level of company). if (!empty($socid)) { $soc = new Societe($db); @@ -1375,7 +1375,7 @@ if (!$action || $action == 'delete' || $action == 'showlog_customer_price' || $a print ''; } } else { - if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { print ''; } else { @@ -1383,7 +1383,7 @@ if (!$action || $action == 'delete' || $action == 'showlog_customer_price' || $a } } - if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { print ''; } else { @@ -1391,7 +1391,7 @@ if (!$action || $action == 'delete' || $action == 'showlog_customer_price' || $a } } - if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { print ''; } else { @@ -1399,7 +1399,7 @@ if (!$action || $action == 'delete' || $action == 'showlog_customer_price' || $a } if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { - print ''; + print ''; } else { print '
' . $langs->trans("UpdateLevelPrices") . '
'; } @@ -1442,11 +1442,11 @@ if ($action == 'edit_vat' && ($user->hasRight('produit', 'creer') || $user->hasR print '

'; } -if ($action == 'edit_price' && $object->getRights()->creer) { +if (($action == 'edit_price' || $action == 'edit_level_price') && $object->getRights()->creer) { print '
'; print load_fiche_titre($langs->trans("NewPrice"), ''); - if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && $action != 'edit_level_price') { print ''."\n"; print ''; print ''; @@ -1559,7 +1559,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) { print $form->buttonsSaveCancel(); print ''; - } else { + } elseif ($action == 'edit_level_price' && $object->getRights()->creer) { print ''."\n"; ?> '; print ''; From fdb885f0a326597f3f53afe20be6d352d41fa391 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 26 Sep 2024 22:46:20 +0200 Subject: [PATCH 198/203] Warehouse list display mode (#31013) Co-authored-by: Laurent Destailleur --- htdocs/product/class/html.formproduct.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index a440abd3471..8b45888d3ea 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -235,7 +235,10 @@ class FormProduct // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return full path to current warehouse in $tab (recursive function) - * + * Set Hidden conf MAIN_WAREHOUSE_LIST_DISPLAY_MODE at 0 || 1 || 2 to unlock display + * 0 : Default behavior, display parents of warehouse + * 1 : Display only current warehouse label only + * 2 : Display last parent warehouse label * @param array $tab warehouse data in $this->cache_warehouses line * @param string $final_label full label with all parents, separated by ' >> ' (completed on each call) * @return string full label with all parents, separated by ' >> ' @@ -247,11 +250,14 @@ class FormProduct $final_label = $tab['label']; } - if (empty($tab['parent_id'])) { + if (empty($tab['parent_id']) || getDolGlobalInt('MAIN_WAREHOUSE_LIST_DISPLAY_MODE') === 1) { return $final_label; } else { if (!empty($this->cache_warehouses[$tab['parent_id']])) { - $final_label = $this->cache_warehouses[$tab['parent_id']]['label'].' >> '.$final_label; + if (getDolGlobalInt('MAIN_WAREHOUSE_LIST_DISPLAY_MODE') !== 2 || (getDolGlobalInt('MAIN_WAREHOUSE_LIST_DISPLAY_MODE') === 2 && empty($this->cache_warehouses[$tab['parent_id']]['parent_id']))) { + $final_label = $this->cache_warehouses[$tab['parent_id']]['label'] . ' >> ' . $final_label; + } + return $this->get_parent_path($this->cache_warehouses[$tab['parent_id']], $final_label); } } From 797957dfd3fa13e738efe583aa0815ed184524e1 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Thu, 26 Sep 2024 22:46:50 +0200 Subject: [PATCH 199/203] work on date edit event (#31112) Co-authored-by: Laurent Destailleur --- htdocs/comm/action/card.php | 47 ++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 5fffaba8636..cf7f82f83d2 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1227,7 +1227,29 @@ if ($action == 'create') { console.log("setdatefields"); setdatefields(); }); - + var old_startdate = null; + $("#ap").focus(function() { + old_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val()); + }); + $("#ap").next(".ui-datepicker-trigger").click(function() { + old_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val()); + }); + $("#ap").change(function() { + setTimeout(function() { + if ($("#p2").val() !== "") { + var new_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val()); + var old_enddate = new Date($("#p2year").val(), $("#p2month").val() - 1, $("#p2day").val()); + if (new_startdate > old_enddate) { + var timeDiff = old_enddate - old_startdate; + var new_enddate = new Date(new_startdate.getTime() + timeDiff); + $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '")); + $("#p2day").val(new_enddate.getDate()); + $("#p2month").val(new_enddate.getMonth() + 1); + $("#p2year").val(new_enddate.getFullYear()); + } + } + }, 0); + }); $("#actioncode").change(function() { if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired"); else $("#dateend").removeClass("fieldrequired"); @@ -1819,6 +1841,29 @@ if ($id > 0) { $("#fullday").change(function() { setdatefields(); }); + var old_startdate = null; + $("#ap").focus(function() { + old_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val()); + }); + $("#ap").next(".ui-datepicker-trigger").click(function() { + old_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val()); + }); + $("#ap").change(function() { + setTimeout(function() { + if ($("#p2").val() !== "") { + var new_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val()); + var old_enddate = new Date($("#p2year").val(), $("#p2month").val() - 1, $("#p2day").val()); + if (new_startdate > old_enddate) { + var timeDiff = old_enddate - old_startdate; + var new_enddate = new Date(new_startdate.getTime() + timeDiff); + $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '")); + $("#p2day").val(new_enddate.getDate()); + $("#p2month").val(new_enddate.getMonth() + 1); + $("#p2year").val(new_enddate.getFullYear()); + } + } + }, 0); + }); $("#actioncode").change(function() { if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired"); else $("#dateend").removeClass("fieldrequired"); From 4a25c289681f9a8b39501b864e1a21cb3a34435a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 26 Sep 2024 22:57:35 +0200 Subject: [PATCH 200/203] add phpdoc (#31149) --- htdocs/commande/class/commandestats.class.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index fcf4f6704bb..ca2bc3e8826 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Marcos García * Copyright (C) 2020 Maxime DEMAREST + * 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 @@ -40,15 +41,49 @@ class CommandeStats extends Stats */ public $table_element; + /** + * @var int ID + */ public $socid; + + /** + * @var int ID + */ public $userid; + /** + * @var string To store the FROM part of the main table of the SQL request + */ public $from; + + /** + * @var string To store the FROM part of the lines table of the SQL request + */ public $from_line; + + /** + * @var string To store the field + */ public $field; + + /** + * @var string To store the field of the line table of the SQL request + */ public $field_line; + + /** + * @var string To store the FROM part of the categorie table of the SQL request + */ public $categ_link; + + /** + * @var string To store the WHERE part of the main table of the SQL request + */ public $where = ''; + + /** + * @var string To store the join + */ public $join; From c62e015410e489b63bf3bdd58dfd93f38214e5f1 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 26 Sep 2024 23:01:02 +0200 Subject: [PATCH 201/203] Qual: Fix (propal|facture|contrat|fichinter)/card, commonobject, files.lib/card_presend.tpl (#31087) # Qual: Fix (propal|facture|contrat|fichinter)/card, commonobject, files.lib/card_presend.tpl Fix phan notices in these files Co-authored-by: Laurent Destailleur --- dev/tools/phan/baseline.txt | 40 ++++++------ htdocs/comm/propal/card.php | 16 +++-- htdocs/compta/facture/card.php | 7 ++- htdocs/contrat/card.php | 23 +++++-- htdocs/core/class/commonobject.class.php | 49 ++++++++++----- htdocs/core/lib/files.lib.php | 61 +++++++++++-------- htdocs/core/tpl/card_presend.tpl.php | 3 +- htdocs/fichinter/card.php | 4 +- .../variants/class/ProductAttribute.class.php | 2 +- 9 files changed, 125 insertions(+), 80 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 8a07bc1fe82..b0be4551f2b 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -10,14 +10,14 @@ return [ // # Issue statistics: // PhanPluginUnknownPropertyType : 1490+ occurrences - // PhanUndeclaredProperty : 840+ occurrences + // PhanUndeclaredProperty : 830+ occurrences // PhanTypeMismatchArgumentProbablyReal : 740+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 730+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 720+ occurrences // PhanUndeclaredGlobalVariable : 440+ occurrences // PhanPluginUnknownArrayMethodReturnType : 430+ occurrences // PhanPluginUnknownArrayMethodParamType : 360+ occurrences - // PhanPossiblyUndeclaredVariable : 330+ occurrences - // PhanPluginUnknownObjectMethodCall : 230+ occurrences + // PhanPossiblyUndeclaredVariable : 320+ occurrences + // PhanPluginUnknownObjectMethodCall : 200+ occurrences // PhanTypeMismatchProperty : 200+ occurrences // PhanPluginUnknownArrayFunctionReturnType : 160+ occurrences // PhanPluginUnknownArrayFunctionParamType : 150+ occurrences @@ -27,22 +27,22 @@ return [ // PhanPluginEmptyStatementIf : 55+ occurrences // PhanRedefineFunction : 50+ occurrences // PhanTypeSuspiciousNonTraversableForeach : 50+ occurrences - // PhanTypeMismatchDimFetch : 40+ occurrences + // PhanTypeMismatchDimFetch : 35+ occurrences // PhanTypeExpectedObjectPropAccess : 25+ occurrences // PhanPossiblyNullTypeMismatchProperty : 15+ occurrences // PhanTypeComparisonFromArray : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanEmptyForeach : 10+ occurrences // PhanPluginConstantVariableNull : 10+ occurrences - // PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences // PhanPluginSuspiciousParamPosition : 10+ occurrences // PhanUndeclaredMethod : 9 occurrences // PhanPluginBothLiteralsBinaryOp : 8 occurrences // PhanPluginDuplicateArrayKey : 8 occurrences + // PhanPluginDuplicateExpressionBinaryOp : 7 occurrences // PhanTypeMismatchDimFetchNullable : 7 occurrences // PhanTypeExpectedObjectPropAccessButGotNull : 6 occurrences + // PhanParamTooMany : 3 occurrences // PhanInvalidFQSENInClasslike : 2 occurrences - // PhanParamTooMany : 2 occurrences // PhanAccessMethodProtected : 1 occurrence // PhanEmptyFQSENInClasslike : 1 occurrence @@ -60,7 +60,7 @@ return [ 'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/asset/admin/setup.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/asset/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/asset/class/assetaccountancycodes.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'], @@ -120,7 +120,7 @@ return [ 'htdocs/comm/mailing/class/html.formadvtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/comm/mailing/class/mailing.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'], - 'htdocs/comm/propal/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/comm/propal/card.php' => ['PhanTypeMismatchProperty'], 'htdocs/comm/propal/class/api_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/comm/propal/class/propal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/comm/propal/class/propalestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], @@ -151,7 +151,7 @@ return [ 'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], - 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/cashcontrol/class/cashcontrol.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -237,7 +237,7 @@ return [ 'htdocs/contact/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contact/perso.php' => ['PhanTypeMismatchProperty'], 'htdocs/contrat/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/contrat/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], + 'htdocs/contrat/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/contrat/class/api_contracts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/contrat/messaging.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contrat/services_list.php' => ['PhanEmptyForeach', 'PhanTypeMismatchArgumentProbablyReal'], @@ -247,10 +247,10 @@ return [ 'htdocs/core/actions_comments.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/actions_extrafields.inc.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/actions_lineupdown.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/actions_linkedfiles.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/actions_linkedfiles.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/actions_massactions.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/actions_setmoduleoptions.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/core/ajax/ajaxdirpreview.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/core/ajax/ajaxdirtree.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -289,7 +289,7 @@ return [ 'htdocs/core/class/commondocgenerator.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], 'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/core/class/commoninvoice.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/class/commonobject.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], + 'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'], 'htdocs/core/class/commonobjectline.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/commonorder.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'], @@ -300,7 +300,6 @@ return [ 'htdocs/core/class/ctypent.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/ctyperesource.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/core/class/cunits.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/class/defaultvalues.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/class/diasporahandler.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/core/class/discount.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/doleditor.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], @@ -372,7 +371,7 @@ return [ 'htdocs/core/lib/expedition.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/expensereport.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/fichinter.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall'], - 'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], + 'htdocs/core/lib/files.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/fourn.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/ftp.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/lib/functions.lib.php' => ['PhanPluginDuplicateArrayKey'], @@ -632,7 +631,6 @@ return [ 'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/fichinter/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/fichinter.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall'], 'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], @@ -788,11 +786,11 @@ return [ 'htdocs/product/dynamic_price/class/price_parser.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/product/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/product/inventory/card.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/inventory/class/inventory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/product/inventory/class/inventory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/product/inventory/inventory.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/inventory/lib/inventory.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/product/inventory/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'], 'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray'], @@ -881,7 +879,7 @@ return [ 'htdocs/public/stripe/ipn.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/public/test/test_forms.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'], + 'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'], 'htdocs/public/ticket/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/webportal/index.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], @@ -1011,7 +1009,7 @@ return [ 'htdocs/user/param_ihm.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/user/passwordforgotten.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/variants/ajax/get_attribute_values.php' => ['PhanTypeComparisonFromArray'], - 'htdocs/variants/class/ProductAttribute.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/variants/class/ProductAttribute.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/variants/class/ProductCombination.class.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/variants/combinations.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], 'htdocs/variants/tpl/productattributevalueline_edit.tpl.php' => ['PhanUndeclaredProperty'], diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index cee5c96d5e4..4f458313b26 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -547,7 +547,7 @@ if (empty($reshook)) { $element = $subelement = 'contrat'; } if ($element == 'inter') { - $element = $subelement = 'ficheinter'; + $element = $subelement = 'fichinter'; } if ($element == 'shipping') { $element = $subelement = 'expedition'; @@ -568,6 +568,7 @@ if (empty($reshook)) { $classname = ucfirst($subelement); $srcobject = new $classname($db); + '@phan-var-force Commande|Propal|Contrat|Fichinter|Expedition $srcobject'; // Can be other class, but CommonObject is too generic dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); $result = $srcobject->fetch($object->origin_id); @@ -1885,6 +1886,7 @@ if ($action == 'create') { $classname = ucfirst($subelement); $objectsrc = new $classname($db); + '@phan-var-force Commande|Propal|Contrat|Expedition $objectsrc'; // Can be other class, but CommonObject is too generic $objectsrc->fetch($originid); if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) { $objectsrc->fetch_lines(); @@ -2002,7 +2004,7 @@ if ($action == 'create') { } else { print '
'; $filter = '((s.client:IN:1,2,3) AND (s.status:=:1))'; - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); // reload page to retrieve customer information if (!getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) { print '