From 77f213832ec9fbc1ec2925066739355b9e85fe27 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 11 Jan 2021 19:40:44 +0100 Subject: [PATCH 01/12] fix: update group name --- htdocs/user/class/usergroup.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 4d858ffbaf9..2c29db85fc7 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -675,6 +675,10 @@ class UserGroup extends CommonObject { global $user, $conf; + if (empty($this->nom) && !empty($this->name)) { + $this->nom = $this->name; + } + $entity = $conf->entity; if (!empty($conf->multicompany->enabled) && $conf->entity == 1) { From 11100b3017a8ff9c3ab3ddbaae8d4ab71290eeaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Jan 2021 15:16:43 +0100 Subject: [PATCH 02/12] missing default value --- htdocs/product/card.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d6f62b34769..d74cab0ada4 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -16,7 +16,7 @@ * Copyright (C) 2016 Charlie Benke * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017 Josep Lluís Amador - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2021 Frédéric France * Copyright (C) 2019-2020 Thibault FOUCART * * This program is free software; you can redistribute it and/or modify @@ -1297,11 +1297,10 @@ else // Accountancy_code_buy print ''.$langs->trans("ProductAccountancyBuyCode").''; print ''; - if ($type == 0) - { + if ($type == 0) { $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT); } else { - $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); + $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT); } print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, ''); print ''; From 1cf86931b3328ec36aab517c41b79a36b383ad09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Jan 2021 12:58:50 +0100 Subject: [PATCH 03/12] Fix graph of opportunity when a status has been removed. --- htdocs/langs/en_US/main.lang | 1 + htdocs/projet/graph_opportunities.inc.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 6d2892cddad..67c78bf2915 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -216,6 +216,7 @@ Value=Value PersonalValue=Personal value NewObject=New %s NewValue=New value +OldValue=Old value %s CurrentValue=Current value Code=Code Type=Type diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 2bb9332c2ae..97977406a48 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -20,9 +20,8 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON p.fk_opp_status = cls.rowid"; // If lead status has been removed, we must show it in stats as unknown $sql .= " WHERE p.entity IN (".getEntity('project').")"; - $sql .= " AND p.fk_opp_status = cls.rowid"; $sql .= " AND p.fk_statut = 1"; // Opend projects only if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")"; if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; @@ -66,7 +65,15 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print '
'; print ''; print ''."\n"; + $listofstatus = array_keys($listofoppstatus); + // Complete with values found into database and not into the dictionary + foreach($valsamount as $key => $val) { + if (!in_array($key, $listofstatus)) { + $listofstatus[] = $key; + } + } + foreach ($listofstatus as $status) { $labelStatus = ''; @@ -74,6 +81,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code'); if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code); if (empty($labelStatus)) $labelStatus = $listofopplabel[$status]; + if (empty($labelStatus)) $labelStatus = $langs->transnoentitiesnoconv('OldValue', $status); // When id is id of an entry no more in dictionary for example. //$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')'; //$labelStatus .= ' - '.price2num($listofoppstatus[$status]).'%'; From 727751e0c1512d2621d7def8c07e41f9f5c645d8 Mon Sep 17 00:00:00 2001 From: zuiko Date: Thu, 14 Jan 2021 14:44:32 +0100 Subject: [PATCH 04/12] Update functions.lib.php Fix #15820 function price2num add underscore in the pattern in instruction $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount); as this: $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount); in order to cover some constantes cases as 20% (TX_NORMAL) or 10% (TX_REDUIT) where underscore is used. I don't know if other characters have to be added to this pattern. --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 023ade28052..6921f9f967a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4725,7 +4725,7 @@ function price2num($amount, $rounding = '', $option = 0) if ($option != 1) { // If not a PHP number or unknown, we change or clean format //print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'
'; if (!is_numeric($amount)) { - $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount); + $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount); } if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123 From fd5948f71637815bd0cc0a988d41961c8f538c32 Mon Sep 17 00:00:00 2001 From: zuiko Date: Thu, 14 Jan 2021 15:00:53 +0100 Subject: [PATCH 05/12] Update functions.lib.php Fix #15820 Fix #15820 function price2num add underscore in the pattern in instruction $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount); as this: $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_\-]/', '', $amount); in order to cover some constantes cases as 20% (TX_NORMAL) or 10% (TX_REDUIT) where underscore is used. it seems that some constantes use also "-" so I added it in the pattern. I don't know if other characters have to be added to this pattern. --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6921f9f967a..7c562357d9a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4725,7 +4725,7 @@ function price2num($amount, $rounding = '', $option = 0) if ($option != 1) { // If not a PHP number or unknown, we change or clean format //print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'
'; if (!is_numeric($amount)) { - $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount); + $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_\-]/', '', $amount); } if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123 From d3cbcedce302e2845d0be253c659948e324f288a Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 15 Jan 2021 09:55:42 +0100 Subject: [PATCH 06/12] FIX 12.0 (ticket) - the "openall" filter on the ticket list does not include tickets with status READ --- htdocs/ticket/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 90cd1fd1ec9..def67225f6a 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -346,11 +346,12 @@ foreach ($search as $key => $val) $newarrayofstatus[] = $val2; } if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) { - $newarrayofstatus[] = Ticket::STATUS_NOT_READ; - $newarrayofstatus[] = Ticket::STATUS_ASSIGNED; - $newarrayofstatus[] = Ticket::STATUS_IN_PROGRESS; - $newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO; - $newarrayofstatus[] = Ticket::STATUS_WAITING; + $newarrayofstatus[] = Ticket::STATUS_NOT_READ; + $newarrayofstatus[] = Ticket::STATUS_READ; + $newarrayofstatus[] = Ticket::STATUS_ASSIGNED; + $newarrayofstatus[] = Ticket::STATUS_IN_PROGRESS; + $newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO; + $newarrayofstatus[] = Ticket::STATUS_WAITING; } if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) { $newarrayofstatus[] = Ticket::STATUS_CLOSED; From fb14f7c0b89016c9d80ec2e49fb5e450d9565baa Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 15 Jan 2021 14:40:55 +0100 Subject: [PATCH 07/12] Modify GETPOST parameters to match with v12 --- htdocs/core/tpl/card_presend.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index d9097ee0919..aaaa043e39b 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -209,7 +209,7 @@ if ($action == 'presend') } $formmail->withto = $liste; - $formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto') ? GETPOST('sendto') : '1') : '1'); + $formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto', 'alpha') ? GETPOST('sendto', 'alpha') : '1') : '1'); $formmail->withtocc = $liste; $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; $formmail->withtopic = $topicmail; From 871691bf69dba1ed973b74957341b93e6a967bc7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jan 2021 16:34:49 +0100 Subject: [PATCH 08/12] Fix missing popup --- htdocs/admin/accountant.php | 1 + htdocs/admin/company.php | 1 + htdocs/admin/openinghours.php | 1 + 3 files changed, 3 insertions(+) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index c8c082db6ae..b017230c677 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -66,6 +66,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) if ($action != 'updateedit' && !$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; } diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 00bd17e865f..02091124b15 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -256,6 +256,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); $db->commit(); } else diff --git a/htdocs/admin/openinghours.php b/htdocs/admin/openinghours.php index d4886bb2a57..05e0658d1d7 100644 --- a/htdocs/admin/openinghours.php +++ b/htdocs/admin/openinghours.php @@ -57,6 +57,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) if ($action != 'updateedit' && !$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; } From 8b9287055e48390227a6e3a660dc1ee25d78cd83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jan 2021 18:34:25 +0100 Subject: [PATCH 09/12] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7c562357d9a..6921f9f967a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4725,7 +4725,7 @@ function price2num($amount, $rounding = '', $option = 0) if ($option != 1) { // If not a PHP number or unknown, we change or clean format //print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'
'; if (!is_numeric($amount)) { - $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_\-]/', '', $amount); + $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount); } if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123 From 33a0cf078c44bbdd01f77e06f38f3fb3e256161b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 18 Jan 2021 09:12:23 +0100 Subject: [PATCH 10/12] better fix --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 03d487ee0c0..a74c9129cb0 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -37,7 +37,8 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ { $mode_search = 0; if (in_array($typ, array('int', 'double', 'real', 'price'))) $mode_search = 1; // Search on a numeric - if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int + if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1' && is_numeric($crit)) $mode_search = 2; // Search on a foreign key int + if (in_array($typ, array('sellist')) && !is_numeric($crit)) $mode_search = 0;// Search on a foreign key string if (in_array($typ, array('chkbxlst', 'checkbox'))) $mode_search = 4; // Search on a multiselect field with sql type = text if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) { From c4f8e81d5d56a740da9888ce7623009ea7d611c0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 18 Jan 2021 09:18:42 +0100 Subject: [PATCH 11/12] better fix --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index a74c9129cb0..d485702ae0f 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -37,7 +37,7 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ { $mode_search = 0; if (in_array($typ, array('int', 'double', 'real', 'price'))) $mode_search = 1; // Search on a numeric - if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1' && is_numeric($crit)) $mode_search = 2; // Search on a foreign key int + if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int if (in_array($typ, array('sellist')) && !is_numeric($crit)) $mode_search = 0;// Search on a foreign key string if (in_array($typ, array('chkbxlst', 'checkbox'))) $mode_search = 4; // Search on a multiselect field with sql type = text if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string From a109dd89486bdea61be5483fab74113782560be7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jan 2021 13:51:35 +0100 Subject: [PATCH 12/12] Fix removed unexpected values in stats graph Conflicts: htdocs/projet/graph_opportunities.inc.php --- htdocs/projet/graph_opportunities.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 97977406a48..bbb2b6f97d9 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -68,8 +68,8 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $listofstatus = array_keys($listofoppstatus); // Complete with values found into database and not into the dictionary - foreach($valsamount as $key => $val) { - if (!in_array($key, $listofstatus)) { + foreach ($valsamount as $key => $val) { + if (!in_array($key, $listofstatus) && $key) { $listofstatus[] = $key; } }
'.$langs->trans("Statistics").' - '.$langs->trans("OpportunitiesStatusForOpenedProjects").'