From d7673084cffc3c5fdb5f4870a33948f6272996f0 Mon Sep 17 00:00:00 2001 From: Jyhere Date: Thu, 25 May 2023 16:53:26 +0200 Subject: [PATCH 01/41] ADD: custom compute for exports --- htdocs/exports/class/export.class.php | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 6563e9d6338..b257269a616 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -706,6 +706,44 @@ class Export $remaintopay = $tmpobjforcomputecall->getRemainToPay(); } $obj->$alias = $remaintopay; + } elseif (is_array($this->array_export_special[$indice][$key]) && + !empty($this->array_export_special[$indice][$key]['rule']) && + $this->array_export_special[$indice][$key]['rule'] == 'compute' + ) { + // Custom compute + $alias = str_replace(array('.', '-', '(', ')'), '_', $key); + $value = ''; + if (!empty($this->array_export_special[$indice][$key]['class']) && + !empty($this->array_export_special[$indice][$key]['classfile']) && + !empty($this->array_export_special[$indice][$key]['method']) + ) { + if (!dol_include_once($this->array_export_special[$indice][$key]['classfile'])) { + $this->error = "Computed field bad configuration: {$this->array_export_special[$indice][$key]['classfile']} not found"; + return -1; + } + + if (!class_exists($this->array_export_special[$indice][$key]['class'])) { + $this->error = "Computed field bad configuration: {$this->array_export_special[$indice][$key]['class']} class doesn't exist"; + return -1; + } + + $className = $this->array_export_special[$indice][$key]['class']; + $tmpObject = new $className($this->db); + if (!method_exists($tmpObject, $this->array_export_special[$indice][$key]['method'])) { + $this->error = "Computed field bad configuration: {$this->array_export_special[$indice][$key]['method']} method doesn't exist"; + return -1; + } + + $methodName = $this->array_export_special[$indice][$key]['method']; + $params = []; + if (!empty($this->array_export_special[$indice][$key]['method_params'])) { + foreach ($this->array_export_special[$indice][$key]['method_params'] as $paramName) { + $params[] = $obj->$paramName ?? null; + } + } + $value = $tmpObject->$methodName(...$params); + } + $obj->$alias = $value; } else { // TODO FIXME // Export of compute field does not work. $obj contains $obj->alias_field and formula may contains $obj->field From 6e0824bf553071bb08e920b81a9bf05e2361404b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 5 Sep 2023 12:26:19 +0200 Subject: [PATCH 02/41] fix: a comment in SQL in -- and space not --comment in one word --- htdocs/install/mysql/tables/llx_adherent.sql | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index 01a87167411..f7bdabd3f7e 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -53,15 +53,15 @@ create table llx_adherent url varchar(255) NULL, socialnetworks text DEFAULT NULL, -- json with socialnetworks - --skype varchar(255), -- deprecated - --twitter varchar(255), -- deprecated - --facebook varchar(255), -- deprecated - --linkedin varchar(255), -- deprecated - --instagram varchar(255), -- deprecated - --snapchat varchar(255), -- deprecated - --googleplus varchar(255), -- deprecated - --youtube varchar(255), -- deprecated - --whatsapp varchar(255), -- deprecated + -- skype varchar(255), -- deprecated + -- twitter varchar(255), -- deprecated + -- facebook varchar(255), -- deprecated + -- linkedin varchar(255), -- deprecated + -- instagram varchar(255), -- deprecated + -- snapchat varchar(255), -- deprecated + -- googleplus varchar(255), -- deprecated + -- youtube varchar(255), -- deprecated + -- whatsapp varchar(255), -- deprecated phone varchar(30), phone_perso varchar(30), From ab7ab5c81790c9760278d77ac0f357d7d8c6ccd3 Mon Sep 17 00:00:00 2001 From: tnegre Date: Tue, 5 Sep 2023 16:19:20 +0200 Subject: [PATCH 03/41] FIX : message order in ticket public view is not coherent with tickets events tab --- htdocs/ticket/class/actions_ticket.class.php | 2 +- htdocs/ticket/class/ticket.class.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index d7d971b4edc..7dd41668c69 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -293,7 +293,7 @@ class ActionsTicket //print ''; print ''; print ''; - print img_picto('', 'object_action', 'class="paddingright"').dol_print_date($arraymsgs['datec'], 'dayhour'); + print img_picto('', 'object_action', 'class="paddingright"').dol_print_date($arraymsgs['datep'], 'dayhour'); print ''; if ($show_user) { print ''; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index e7392c33f1d..c9e678a1d51 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1729,11 +1729,11 @@ class Ticket extends CommonObject // Cache already loaded - $sql = "SELECT id as rowid, fk_user_author, datec, label, note as message, code"; + $sql = "SELECT id as rowid, fk_user_author, datec, datep, label, note as message, code"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm"; $sql .= " WHERE fk_element = ".(int) $this->id; $sql .= " AND elementtype = 'ticket'"; - $sql .= " ORDER BY datec DESC"; + $sql .= " ORDER BY datep DESC"; dol_syslog(get_class($this)."::load_cache_actions_ticket sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); @@ -1745,6 +1745,7 @@ class Ticket extends CommonObject $this->cache_msgs_ticket[$i]['id'] = $obj->rowid; $this->cache_msgs_ticket[$i]['fk_user_author'] = $obj->fk_user_author; $this->cache_msgs_ticket[$i]['datec'] = $this->db->jdate($obj->datec); + $this->cache_msgs_ticket[$i]['datep'] = $this->db->jdate($obj->datep); $this->cache_msgs_ticket[$i]['subject'] = $obj->label; $this->cache_msgs_ticket[$i]['message'] = $obj->message; $this->cache_msgs_ticket[$i]['private'] = ($obj->code == 'TICKET_MSG_PRIVATE' ? 1 : 0); From 9b4f2f920aed9fe8e7aa6df3f9fbbd4f4a2ef8c9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 6 Sep 2023 06:27:12 +0200 Subject: [PATCH 04/41] FIX avoid php8 warning --- htdocs/compta/facture/card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 2800fa7388d..762a0e11528 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2029,6 +2029,8 @@ if (empty($reshook)) { $price_ht_devise = ''; $price_ttc = ''; $price_ttc_devise = ''; + $price_min = ''; + $price_min_ttc = ''; if (GETPOST('price_ht') !== '') { $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); From 927cc91da47e0e06076046613513b465c5e1ccdd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 6 Sep 2023 06:44:10 +0200 Subject: [PATCH 05/41] FIX avoid wrong backtopage url --- htdocs/comm/propal/card.php | 4 ++-- htdocs/commande/card.php | 4 ++-- htdocs/compta/facture/card.php | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 973cfbee9e3..2ea554473e5 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1889,7 +1889,7 @@ if ($action == 'create') { $thirdparty = $soc; $discount_type = 0; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')); + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid'); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; } @@ -2473,7 +2473,7 @@ if ($action == 'create') { $thirdparty = $soc; $discount_type = 0; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); + $backtopage = $_SERVER["PHP_SELF"].'?id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 4c40f086d3e..f6f549a84ef 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1852,7 +1852,7 @@ if ($action == 'create' && $usercancreate) { $thirdparty = $soc; $discount_type = 0; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')); + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid'); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; @@ -2470,7 +2470,7 @@ if ($action == 'create' && $usercancreate) { $thirdparty = $soc; $discount_type = 0; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); + $backtopage = $_SERVER["PHP_SELF"].'?id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 762a0e11528..8bd7b4cbb88 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3169,7 +3169,6 @@ if ($action == 'create') { print ''."\n"; } print ''; - print ''; print ''; print ''; print ''; @@ -4498,7 +4497,7 @@ if ($action == 'create') { print ''; $thirdparty = $soc; $discount_type = 0; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id); + $backtopage = $_SERVER["PHP_SELF"].'?facid='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; From 7a51977cbd541670f4c7f9bd46ba41325f5624a6 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 6 Sep 2023 08:47:31 +0200 Subject: [PATCH 06/41] Fix missing --- htdocs/societe/class/societe.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 86edd8f013f..6273085d601 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2132,6 +2132,7 @@ class Societe extends CommonObject */ public function set_as_client() { + global $conf; // phpcs:enable if ($this->id) { $newclient = 1; From b6e84b1c74526d10924f43895c2b1bb360e4e916 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 6 Sep 2023 10:02:12 +0200 Subject: [PATCH 07/41] FIX use urlencode for origin and originid --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 2ea554473e5..c1586576657 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1889,7 +1889,7 @@ if ($action == 'create') { $thirdparty = $soc; $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid'); + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f6f549a84ef..34561b6ae9c 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1852,7 +1852,7 @@ if ($action == 'create' && $usercancreate) { $thirdparty = $soc; $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid'); + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8bd7b4cbb88..e348c1136e3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3663,7 +3663,7 @@ if ($action == 'create') { $thirdparty = $soc; $discount_type = 0; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin', 'alpha').'&originid='.GETPOST('originid', 'int')); + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; From fccd05a633a82f6bb888b6546944b9227884e503 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Sep 2023 15:20:24 +0200 Subject: [PATCH 08/41] css --- htdocs/user/group/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index f14eace736a..76f3f73f573 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -440,7 +440,7 @@ while ($i < $imaxinloop) { } } - print ''; + print ''; print $object->getNomUrl(1); if (isModEnabled('multicompany') && !$obj->entity) { print img_picto($langs->trans("GlobalGroup"), 'redstar'); @@ -457,12 +457,12 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - print ''.$obj->nb.''; + print ''.dol_escape_htmltag($obj->nb).''; if (!$i) { $totalarray['nbfield']++; } print ''; - print ''.$obj->nbpermissions.''; + print ''.dol_escape_htmltag($obj->nbpermissions).''; print ''; if (!$i) { $totalarray['nbfield']++; From deac0a6a1d847e52d451b69c9e0d4578b83af49f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Sep 2023 15:50:07 +0200 Subject: [PATCH 09/41] Fix when there is more than 2 exclusion filter in emailcollector --- .../class/emailcollector.class.php | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index d1341fb729d..d4e20a7e6f5 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1105,8 +1105,8 @@ class EmailCollector extends CommonObject $searchfilterisanswer = 0; $searchfilterisnotanswer = 0; $searchfilterreplyto = 0; - $searchfilterexcludebody = ''; - $searchfilterexcludesubject = ''; + $searchfilterexcludebodyarray = array(); + $searchfilterexcludesubjectarray = array(); $operationslog = ''; $now = dol_now(); @@ -1298,7 +1298,7 @@ class EmailCollector extends CommonObject if ($rule['type'] == 'subject') { if (strpos($rule['rulevalue'], '!') === 0) { //array_push($criteria, array("NOT SUBJECT" => $rule['rulevalue'])); - $searchfilterexcludesubject = preg_replace('/^!/', '', $rule['rulevalue']); + $searchfilterexcludesubjectarray[] = preg_replace('/^!/', '', $rule['rulevalue']); } else { array_push($criteria, array("SUBJECT" => $rule['rulevalue'])); } @@ -1306,7 +1306,7 @@ class EmailCollector extends CommonObject if ($rule['type'] == 'body') { if (strpos($rule['rulevalue'], '!') === 0) { //array_push($criteria, array("NOT BODY" => $rule['rulevalue'])); - $searchfilterexcludebody = preg_replace('/^!/', '', $rule['rulevalue']); + $searchfilterexcludebodyarray[] = preg_replace('/^!/', '', $rule['rulevalue']); } else { array_push($criteria, array("BODY" => $rule['rulevalue'])); } @@ -1429,7 +1429,7 @@ class EmailCollector extends CommonObject if ($rule['type'] == 'subject') { if (strpos($rule['rulevalue'], '!') === 0) { //$search .= ($search ? ' ' : '').'NOT BODY "'.str_replace('"', '', $rule['rulevalue']).'"'; - $searchfilterexcludesubject = preg_replace('/^!/', '', $rule['rulevalue']); + $searchfilterexcludesubjectarray[] = preg_replace('/^!/', '', $rule['rulevalue']); } else { $search .= ($search ? ' ' : '').'SUBJECT "'.str_replace('"', '', $rule['rulevalue']).'"'; } @@ -1437,7 +1437,7 @@ class EmailCollector extends CommonObject if ($rule['type'] == 'body') { if (strpos($rule['rulevalue'], '!') === 0) { //$search .= ($search ? ' ' : '').'NOT BODY "'.str_replace('"', '', $rule['rulevalue']).'"'; - $searchfilterexcludebody = preg_replace('/^!/', '', $rule['rulevalue']); + $searchfilterexcludebodyarray[] = preg_replace('/^!/', '', $rule['rulevalue']); } else { // Warning: Google doesn't implement IMAP properly, and only matches whole words, $search .= ($search ? ' ' : '').'BODY "'.str_replace('"', '', $rule['rulevalue']).'"'; @@ -1769,12 +1769,14 @@ class EmailCollector extends CommonObject continue; // Exclude email } - if ($searchfilterexcludebody) { - if (preg_match('/'.preg_quote($searchfilterexcludebody, '/').'/ms', $messagetext)) { - $nbemailprocessed++; - $operationslog .= '
Discarded - Email body contains string '.$searchfilterexcludebody; - dol_syslog(" Discarded - Email body contains string ".$searchfilterexcludebody); - continue; // Exclude email + if (!empty($searchfilterexcludebodyarray)) { + foreach ($searchfilterexcludebodyarray as $searchfilterexcludebody) { + if (preg_match('/'.preg_quote($searchfilterexcludebody, '/').'/ms', $messagetext)) { + $nbemailprocessed++; + $operationslog .= '
Discarded - Email body contains string '.$searchfilterexcludebody; + dol_syslog(" Discarded - Email body contains string ".$searchfilterexcludebody); + continue 2; // Exclude email + } } } @@ -1861,12 +1863,14 @@ class EmailCollector extends CommonObject //var_dump($msgid);exit; } - if ($searchfilterexcludesubject) { - if (preg_match('/'.preg_quote($searchfilterexcludesubject, '/').'/ms', $subject)) { - $nbemailprocessed++; - $operationslog .= '
Discarded - Email subject contains string '.$searchfilterexcludesubject; - dol_syslog(" Discarded - Email subject contains string ".$searchfilterexcludesubject); - continue; // Exclude email + if (!empty($searchfilterexcludesubjectarray)) { + foreach ($searchfilterexcludesubjectarray as $searchfilterexcludesubject) { + if (preg_match('/'.preg_quote($searchfilterexcludesubject, '/').'/ms', $subject)) { + $nbemailprocessed++; + $operationslog .= '
Discarded - Email subject contains string '.$searchfilterexcludesubject; + dol_syslog(" Discarded - Email subject contains string ".$searchfilterexcludesubject); + continue 2; // Exclude email + } } } From c55c639f8ecdba27c7c252467342c74f5e13d73a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Sep 2023 16:31:56 +0200 Subject: [PATCH 10/41] FIX emailcollector to search existing thirdparty when extract not found --- .../emailcollector/class/emailcollector.class.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index d4e20a7e6f5..19463d16814 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2274,12 +2274,16 @@ class EmailCollector extends CommonObject } } else { // Regex not found - $idtouseforthirdparty = null; - $nametouseforthirdparty = null; - $emailtouseforthirdparty = null; - $namealiastouseforthirdparty = null; + if (in_array($propertytooverwrite, array('id', 'email', 'name', 'name_alias'))) { + $idtouseforthirdparty = null; + $nametouseforthirdparty = null; + $emailtouseforthirdparty = null; + $namealiastouseforthirdparty = null; - $operationslog .= '
propertytooverwrite='.$propertytooverwrite.' Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtoupper($sourcefield).' -> Not found'; + $operationslog .= '
propertytooverwrite='.$propertytooverwrite.' Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtoupper($sourcefield).' -> Not found. Property searched is critical so we cancel the search.'; + } else { + $operationslog .= '
propertytooverwrite='.$propertytooverwrite.' Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtoupper($sourcefield).' -> Not found'; + } } //var_dump($object->$tmpproperty);exit; } else { From 5af2da11918f78e207b57cab72ff7aaaca7721ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Sep 2023 16:38:45 +0200 Subject: [PATCH 11/41] Log --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 19463d16814..a12411c09e2 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2325,7 +2325,7 @@ class EmailCollector extends CommonObject if (!$errorforactions && ($idtouseforthirdparty || $emailtouseforthirdparty || $nametouseforthirdparty || $namealiastouseforthirdparty)) { // We make another search on thirdparty - $operationslog .= '
We have this data to search thirdparty: '.$idtouseforthirdparty.' '.$emailtouseforthirdparty.' '.$nametouseforthirdparty.' '.$namealiastouseforthirdparty; + $operationslog .= '
We have this data to search thirdparty: id='.$idtouseforthirdparty.', email='.$emailtouseforthirdparty.', name='.$nametouseforthirdparty.', name_alias='.$namealiastouseforthirdparty; $tmpobject = new stdClass(); $tmpobject->element == 'generic'; From 5b4eac734bb2974aec64f97489feaf536dd584d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20Le=20Doar=C3=A9?= Date: Thu, 7 Sep 2023 09:28:20 +0000 Subject: [PATCH 12/41] Fix #25613 --- htdocs/core/class/smtps.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index ee886b5bb83..0ab9bd3ef8d 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -653,6 +653,7 @@ class SMTPs { global $conf; + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; /** * Default return value */ From 53d43ab50f4bfa2457b9fa2270a3715b5e491bc7 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Thu, 7 Sep 2023 14:47:47 +0200 Subject: [PATCH 13/41] FIX 17.0 PHP8: supplier invoice class: - use declared attribute socid instead of fk_soc - fk_project should be null, not 0 (would break constraint) --- htdocs/fourn/class/fournisseur.facture.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index ca81a778fee..e5c7c0097e5 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -938,7 +938,7 @@ class FactureFournisseur extends CommonInvoice $this->ref_ext = $obj->ref_ext; $this->entity = $obj->entity; $this->type = empty($obj->type) ? self::TYPE_STANDARD : $obj->type; - $this->fk_soc = $obj->fk_soc; + $this->socid = $obj->fk_soc; $this->datec = $this->db->jdate($obj->datec); $this->date = $this->db->jdate($obj->datef); $this->datep = $this->db->jdate($obj->datef); @@ -1161,8 +1161,8 @@ class FactureFournisseur extends CommonInvoice if (isset($this->type)) { $this->type = trim($this->type); } - if (isset($this->fk_soc)) { - $this->fk_soc = trim($this->fk_soc); + if (isset($this->socid)) { + $this->socid = trim($this->socid); } if (isset($this->label)) { $this->label = trim($this->label); @@ -1242,14 +1242,14 @@ class FactureFournisseur extends CommonInvoice $sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").","; $sql .= " entity=".(isset($this->entity) ? ((int) $this->entity) : "null").","; $sql .= " type=".(isset($this->type) ? ((int) $this->type) : "null").","; - $sql .= " fk_soc=".(isset($this->fk_soc) ? ((int) $this->fk_soc) : "null").","; + $sql .= " fk_soc=".(isset($this->socid) ? ((int) $this->socid) : "null").","; $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; $sql .= " datef=".(dol_strlen($this->date) != 0 ? "'".$this->db->idate($this->date)."'" : 'null').","; if (dol_strlen($this->tms) != 0) { $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; } $sql .= " libelle=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; - $sql .= " paye=".(isset($this->paye) ? ((int) $this->paye) : "null").","; + $sql .= " paye=".(isset($this->paye) ? ((int) $this->paye) : "0").","; $sql .= " close_code=".(isset($this->close_code) ? "'".$this->db->escape($this->close_code)."'" : "null").","; $sql .= " close_note=".(isset($this->close_note) ? "'".$this->db->escape($this->close_note)."'" : "null").","; $sql .= " localtax1=".(isset($this->localtax1) ? ((float) $this->localtax1) : "null").","; @@ -1261,7 +1261,7 @@ class FactureFournisseur extends CommonInvoice $sql .= " fk_user_author=".(isset($this->author) ? ((int) $this->author) : "null").","; $sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? ((int) $this->fk_user_valid) : "null").","; $sql .= " fk_facture_source=".($this->fk_facture_source ? ((int) $this->fk_facture_source) : "null").","; - $sql .= " fk_projet=".(isset($this->fk_project) ? ((int) $this->fk_project) : "null").","; + $sql .= " fk_projet=".(! empty($this->fk_project) ? ((int) $this->fk_project) : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : "null").","; $sql .= " date_lim_reglement=".(dol_strlen($this->date_echeance) != 0 ? "'".$this->db->idate($this->date_echeance)."'" : 'null').","; $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; From 822981b5616e4379d5237ee8d7fd74559e7c8f4a Mon Sep 17 00:00:00 2001 From: tnegre Date: Thu, 7 Sep 2023 16:56:29 +0200 Subject: [PATCH 14/41] FIX payment : language is not propagated to following pages --- htdocs/public/payment/newpayment.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 208134a1f6a..df57986505b 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -97,6 +97,7 @@ if (!GETPOST("currency", 'alpha')) { } $source = GETPOST("s", 'aZ09') ?GETPOST("s", 'aZ09') : GETPOST("source", 'aZ09'); $download = GETPOST('d', 'int') ?GETPOST('d', 'int') : GETPOST('download', 'int'); +$getpostlang = GETPOST('lang', 'aZ09'); if (!$action) { if (!GETPOST("amount", 'alpha') && !$source) { @@ -242,6 +243,10 @@ if (!empty($entity)) { $urlok .= 'e='.urlencode($entity).'&'; $urlko .= 'e='.urlencode($entity).'&'; } +if (!empty($getpostlang)) { + $urlok .= 'lang='.urlencode($getpostlang).'&'; + $urlko .= 'lang='.urlencode($getpostlang).'&'; +} $urlok = preg_replace('/&$/', '', $urlok); // Remove last & $urlko = preg_replace('/&$/', '', $urlko); // Remove last & @@ -814,7 +819,7 @@ $form = new Form($db); $head = ''; if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) { - $head = ''."\n"; + $head = ''."\n"; } $conf->dol_hide_topmenu = 1; @@ -853,6 +858,7 @@ print ''."\n"; print ''; print ''; +print ''; print "\n"; @@ -2105,6 +2111,7 @@ if ($action != 'dopayment') { } if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled)) { + if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) { $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY = 'integral'; } @@ -2209,6 +2216,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme print ''; print ''; print ''; + print ''; if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) || !empty($conf->global->STRIPE_USE_NEW_CHECKOUT)) { // Use a SCA ready method require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; From 3073a98563778ab566afb6ee1e287054afeaf4e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2023 01:28:11 +0200 Subject: [PATCH 15/41] Fix creation of subdir for website --- htdocs/core/lib/functions.lib.php | 3 ++- htdocs/website/class/website.class.php | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3508fa865a5..0794dfb9955 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6934,7 +6934,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = ' * Creation of a directory (this can create recursive subdir) * * @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir') - * @param string $dataroot Data root directory (To avoid having the data root in the loop. Using this will also lost the warning on first dir PHP has no permission when open_basedir is used) + * @param string $dataroot Data root directory (To avoid having the data root in the loop. Using this will also lost the warning, on first dir, saying PHP has no permission when open_basedir is used) * @param string $newmask Mask for new file (Defaults to $conf->global->MAIN_UMASK or 0755 if unavailable). Example: '0444' * @return int < 0 if KO, 0 = already exists, > 0 if OK */ @@ -6967,6 +6967,7 @@ function dol_mkdir($dir, $dataroot = '', $newmask = '') } else { $ccdir .= $cdir[$i]; } + $regs = array(); if (preg_match("/^.:$/", $ccdir, $regs)) { continue; // Si chemin Windows incomplet, on poursuit par rep suivant } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 9e3237b0a1d..09ca7e21639 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -255,7 +255,7 @@ class Website extends CommonObject if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); - // Create subdirectory per language + // Create a subdirectory for each language (except main language) $tmplangarray = explode(',', $this->otherlang); if (is_array($tmplangarray)) { dol_mkdir($conf->website->dir_output.'/'.$this->ref); @@ -263,10 +263,14 @@ class Website extends CommonObject if (trim($val) == $this->lang) { continue; } - dol_mkdir($conf->website->dir_output.'/'.$this->ref.'/'.trim($val)); + dol_mkdir($conf->website->dir_output.'/'.$this->ref.'/'.trim($val), DOL_DATA_ROOT); } } + // Create subdirectory for images and js + dol_mkdir($conf->medias->multidir_output[$conf->entity].'/image/'.$this->ref, DOL_DATA_ROOT); + dol_mkdir($conf->medias->multidir_output[$conf->entity].'/js/'.$this->ref, DOL_DATA_ROOT); + // Uncomment this and change WEBSITE to your own tag if you // want this action to call a trigger. // if (!$notrigger) { From 0c588ccd60eee620ad182ef947fd73047ea31339 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2023 01:36:26 +0200 Subject: [PATCH 16/41] Sec: Increase list of not allowed function in dol_eval --- htdocs/core/lib/functions.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0794dfb9955..35260c813f8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9246,8 +9246,11 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' $forbiddenphpstrings = array('$$'); $forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST')); - $forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval", "dol_eval", "executeCLI", "verifCond", "base64_decode"); + $forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval"); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64_decode", "rawurldecode", "urldecode")); // decode string functions $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask")); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func")); $forbiddenphpregex = 'global\s+\$|\b('.implode('|', $forbiddenphpfunctions).')\b'; From 32837761b5453ea34029da80c0d07acf899d96fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2023 01:36:26 +0200 Subject: [PATCH 17/41] Sec: Increase list of not allowed function in dol_eval --- htdocs/core/lib/functions.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index aa63097d2ec..c33326ad0ec 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9024,8 +9024,11 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' $forbiddenphpstrings = array('$$'); $forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST')); - $forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval", "dol_eval", "executeCLI", "verifCond", "base64_decode"); + $forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval"); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64_decode", "rawurldecode", "urldecode")); // decode string functions $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask")); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func")); $forbiddenphpregex = 'global\s+\$|\b('.implode('|', $forbiddenphpfunctions).')\b'; From 7819b9586df53e7d54949e79baa2e0f700777223 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2023 04:22:24 +0200 Subject: [PATCH 18/41] Exclude more exec functions --- htdocs/core/lib/functions.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c33326ad0ec..3e674184c5e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9024,12 +9024,13 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' $forbiddenphpstrings = array('$$'); $forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST')); - $forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval"); + $forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen"); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions - $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64_decode", "rawurldecode", "urldecode")); // decode string functions + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64_decode", "rawurldecode", "urldecode")); // decode string functions $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func")); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities $forbiddenphpregex = 'global\s+\$|\b('.implode('|', $forbiddenphpfunctions).')\b'; From c99b5210ded5f4f91c40e1f8654c8921b8daad1e Mon Sep 17 00:00:00 2001 From: atm-greg Date: Fri, 8 Sep 2023 10:32:25 +0200 Subject: [PATCH 19/41] use Product instance for dol_banner --- .idea/php.xml | 22 ++++++++++++++++++---- htdocs/product/fournisseurs.php | 4 +++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.idea/php.xml b/.idea/php.xml index 74fc8003a4b..f324872a8ba 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -1,5 +1,19 @@ - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 9996ad26bfe..ed24a1c0abf 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -102,8 +102,10 @@ if (!$sortorder) { $hookmanager->initHooks(array('pricesuppliercard', 'globalcard')); $object = new ProductFournisseur($db); +$prod = new Product($db); if ($id > 0 || $ref) { $object->fetch($id, $ref); + $prod->fetch($id, $ref); } $usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire'))); @@ -396,7 +398,7 @@ if ($id > 0 || $ref) { $shownav = 0; } - dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); + dol_banner_tab($prod, 'ref', $linkback, $shownav, 'ref'); print '
'; From ec71da27be6bef2fc0253cc1bc4da4c9b4e9a144 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:39:20 +0300 Subject: [PATCH 20/41] Update sendings.lang --- htdocs/langs/en_US/sendings.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 6ed59b35e89..e3696f6c5ac 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -77,7 +77,7 @@ DetailWarehouseFormat= W:%s (Qty: %d) ShipmentDistribution=Shipment distribution -ErrorTooManyCombinationBatchcode=No dispatch for line %s as too many combination warehouse, product, batch code was found (%s). -ErrorNoCombinationBatchcode=No dispatch for line %s as no combination warehouse, product, batch code was found. +ErrorTooManyCombinationBatchcode=No dispatch for line %s as too many combinations of warehouse, product, batch code was found (%s). +ErrorNoCombinationBatchcode=No dispatch for line %s as no combination of warehouse, product, batch code was found. ErrorTooMuchShipped=Quantity shipped should not be greater than quantity ordered for line %s From ea1a1b8bad58a70fc00f04c72d68eaa78baa1110 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:41:59 +0300 Subject: [PATCH 21/41] Update hrm.lang --- htdocs/langs/en_US/hrm.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 227819b4037..771c5246b56 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -92,4 +92,4 @@ JobsExtraFields=Attributs supplémentaires (Job profile) EvaluationsExtraFields=Attributs supplémentaires (Evaluations) NeedBusinessTravels=Need business travels NoDescription=No description -TheJobProfileHasNoSkillsDefinedFixBefore=The evaluated job profile of this employee has not skill defined on it. Please fix this before, then delete and restart the evaluation. \ No newline at end of file +TheJobProfileHasNoSkillsDefinedFixBefore=The evaluated job profile of this employee has no skill defined on it. Please add skill(s), then delete and restart the evaluation. From bd970931c0fc8a321f133c9cdca41157f2efa16a Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:44:25 +0300 Subject: [PATCH 22/41] Update admin.lang --- htdocs/langs/en_US/admin.lang | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5efb9c00aba..0d4abd53335 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1773,15 +1773,15 @@ FreeLegalTextOnDeliveryReceipts=Free text on delivery receipts ##### FCKeditor ##### AdvancedEditor=Advanced editor ActivateFCKeditor=Activate advanced editor for: -FCKeditorForNotePublic=WYSIWIG creation/edition of the field "public notes" of elements -FCKeditorForNotePrivate=WYSIWIG creation/edition of the field "private notes" of elements -FCKeditorForCompany=WYSIWIG creation/edition of the field description of elements (except products/services) -FCKeditorForProductDetails=WYSIWIG creation/edition of products description or lines for objects (lines of proposals, orders, invoices, etc...). +FCKeditorForNotePublic=WYSIWYG creation/edition of the field "public notes" of elements +FCKeditorForNotePrivate=WYSIWYG creation/edition of the field "private notes" of elements +FCKeditorForCompany=WYSIWYG creation/edition of the field description of elements (except products/services) +FCKeditorForProductDetails=WYSIWYG creation/edition of products description or lines for objects (lines of proposals, orders, invoices, etc...). FCKeditorForProductDetails2=Warning: Using this option for this case is seriously not recommended as it can create problems with special characters and page formatting when building PDF files. -FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing) -FCKeditorForUserSignature=WYSIWIG creation/edition of user signature -FCKeditorForMail=WYSIWIG creation/edition for all mail (except Tools->eMailing) -FCKeditorForTicket=WYSIWIG creation/edition for tickets +FCKeditorForMailing= WYSIWYG creation/edition for mass eMailings (Tools->eMailing) +FCKeditorForUserSignature=WYSIWYG creation/edition of user signature +FCKeditorForMail=WYSIWYG creation/edition for all mail (except Tools->eMailing) +FCKeditorForTicket=WYSIWYG creation/edition for tickets ##### Stock ##### StockSetup=Stock module setup IfYouUsePointOfSaleCheckModule=If you use the Point of Sale module (POS) provided by default or an external module, this setup may be ignored by your POS module. Most POS modules are designed by default to create an invoice immediately and decrease stock irrespective of the options here. So if you need or not to have a stock decrease when registering a sale from your POS, check also your POS module setup. From d153d7778fa5df6404e8a339b4f6c70434db0bc6 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:52:47 +0300 Subject: [PATCH 23/41] Update errors.lang --- htdocs/langs/en_US/errors.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 058dc422b81..02e6c2a27ff 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -4,7 +4,7 @@ NoErrorCommitIsDone=No error, we commit # Errors ErrorButCommitIsDone=Errors found but we validate despite this -ErrorBadEMail=Email %s is incorrect +ErrorBadEMail=Email address %s is incorrect ErrorBadMXDomain=Email %s seems incorrect (domain has no valid MX record) ErrorBadUrl=Url %s is incorrect ErrorBadValueForParamNotAString=Bad value for your parameter. It appends generally when translation is missing. From 704cbbe26630ff6240cd27201a81b3da2aba560d Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:59:21 +0300 Subject: [PATCH 24/41] Update main.lang --- htdocs/langs/en_US/main.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index b20aee98e69..c25b445b2d8 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -60,7 +60,7 @@ ErrorFailedToSendMail=Failed to send mail (sender=%s, receiver=%s) ErrorFileNotUploaded=File was not uploaded. Check that size does not exceed maximum allowed, that free space is available on disk and that there is not already a file with same name in this directory. ErrorInternalErrorDetected=Error detected ErrorWrongHostParameter=Wrong host parameter -ErrorYourCountryIsNotDefined=Your country is not defined. Go to Home-Setup-Edit and post the form again. +ErrorYourCountryIsNotDefined=Your country is not defined. Go to Home-Setup-Company/Foundation and post the form again. ErrorRecordIsUsedByChild=Failed to delete this record. This record is used by at least one child record. ErrorWrongValue=Wrong value ErrorWrongValueForParameterX=Wrong value for parameter %s From ea64e69a4108944e66a5d2fa8a01a21027cbb997 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 8 Sep 2023 15:04:53 +0300 Subject: [PATCH 25/41] Update main.lang --- htdocs/langs/en_US/main.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c25b445b2d8..7fc01613941 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -20,7 +20,7 @@ FormatDateShortJava=MM/dd/yyyy FormatDateShortJavaInput=MM/dd/yyyy FormatDateShortJQuery=mm/dd/yy FormatDateShortJQueryInput=mm/dd/yy -FormatHourShortJQuery=HH:MI +FormatHourShortJQuery=HH:MM FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M FormatDateTextShort=%b %d, %Y From 5b6b18e1158bcf23ab9cd969d505522b530fb749 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 8 Sep 2023 15:07:17 +0300 Subject: [PATCH 26/41] Update ticket.lang --- htdocs/langs/en_US/ticket.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index ed0e893b97c..a9960cc3deb 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -311,7 +311,7 @@ TicketNewEmailBodyInfosTrackUrlCustomer=You can view the progress of the ticket TicketCloseEmailBodyInfosTrackUrlCustomer=You can consult the history of this ticket by clicking the following link TicketEmailPleaseDoNotReplyToThisEmail=Please do not reply directly to this email! Use the link to reply into the interface. TicketPublicInfoCreateTicket=This form allows you to record a support ticket in our management system. -TicketPublicPleaseBeAccuratelyDescribe=Please accurately describe your question. Provide the most information possible to allow us to correctly identify your request. +TicketPublicPleaseBeAccuratelyDescribe=Please accurately describe your request. Provide the most information possible to allow us to correctly identify your request. TicketPublicMsgViewLogIn=Please enter ticket tracking ID TicketTrackId=Public Tracking ID OneOfTicketTrackId=One of your tracking ID From c379420d8695e01f2366ebcdcc4a081538afab2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2023 14:12:12 +0200 Subject: [PATCH 27/41] Fix regression in dol_eval --- htdocs/core/lib/functions.lib.php | 4 ++- test/phpunit/SecurityTest.php | 44 ++++++++++++++++++------------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2ae73a96a64..0b2e638d45e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9241,7 +9241,9 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' } } $scheck = preg_replace('/->[a-zA-Z0-9_]+\(/', '->__METHOD__', $s); - $scheck = preg_replace('/\s[a-zA-Z0-9_]+\(/', ' __FUNCTION__', $scheck); + $scheck = preg_replace('/^\(/', '__PARENTHESIS__', $scheck); + $scheck = preg_replace('/\s\(/', '__PARENTHESIS__', $scheck); + $scheck = preg_replace('/(|\s)[a-zA-Z0-9_]+\(/', '$1__FUNCTION__', $scheck); $scheck = preg_replace('/(\^|\')\(/', '__REGEXSTART__', $scheck); // To allow preg_match('/^(aaa|bbb)/'... or isStringVarMatching('leftmenu', '(aaa|bbb)') //print 'scheck='.$scheck." : ".strpos($scheck, '(')."\n"; if (strpos($scheck, '(') !== false) { diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index cf9e223d737..e22e7c8e2a1 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -940,11 +940,11 @@ class SecurityTest extends PHPUnit\Framework\TestCase $db=$this->savdb; $result=dol_eval('1==1', 1, 0); - print "result = ".$result."\n"; + print "result1 = ".$result."\n"; $this->assertTrue($result); $result=dol_eval('1==2', 1, 0); - print "result = ".$result."\n"; + print "result2 = ".$result."\n"; $this->assertFalse($result); include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -952,44 +952,48 @@ class SecurityTest extends PHPUnit\Framework\TestCase $s = '(($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : "Parent project not found"'; $result=dol_eval($s, 1, 1, '2'); - print "result = ".$result."\n"; + print "result3 = ".$result."\n"; $this->assertEquals('Parent project not found', $result); $s = '(($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : \'Parent project not found\''; $result=dol_eval($s, 1, 1, '2'); - print "result = ".$result."\n"; + print "result4 = ".$result."\n"; $this->assertEquals('Parent project not found', $result); $result=dol_eval('$a=function() { }; $a;', 1, 1, '0'); - print "result = ".$result."\n"; + print "result5 = ".$result."\n"; + $this->assertContains('Bad string syntax to evaluate', $result); + + $result=dol_eval('$a=function() { }; $a;', 1, 1, '1'); + print "result6 = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); $result=dol_eval('$a=exec("ls");', 1, 1); - print "result = ".$result."\n"; + print "result7 = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); $result=dol_eval('$a=exec ("ls")', 1, 1); - print "result = ".$result."\n"; + print "result8 = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); $result=dol_eval('$a="test"; $$a;', 1, 0); - print "result = ".$result."\n"; + print "result9 = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); $result=dol_eval('`ls`', 1, 0); - print "result = ".$result."\n"; + print "result10 = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); $result=dol_eval("('ex'.'ec')('echo abc')", 1, 0); - print "result = ".$result."\n"; + print "result11 = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); $result=dol_eval("sprintf(\"%s%s\", \"ex\", \"ec\")('echo abc')", 1, 0); - print "result = ".$result."\n"; + print "result12 = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); $result=dol_eval("90402.38+267678+0", 1, 1, 1); - print "result = ".$result."\n"; + print "result13 = ".$result."\n"; $this->assertEquals('358080.38', $result); global $leftmenu; // Used into strings to eval @@ -1002,32 +1006,36 @@ class SecurityTest extends PHPUnit\Framework\TestCase // Same with a value that does not match $leftmenu = 'XXX'; $result=dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1'); - print "result = ".$result."\n"; + print "result14 = ".$result."\n"; $this->assertFalse($result); $leftmenu = 'AAA'; $result=dol_eval('$conf->currency && isStringVarMatching(\'leftmenu\', \'(AAA|BBB)\')', 1, 1, '1'); - print "result = ".$result."\n"; + print "result15 = ".$result."\n"; $this->assertTrue($result); $leftmenu = 'XXX'; $result=dol_eval('$conf->currency && isStringVarMatching(\'leftmenu\', \'(AAA|BBB)\')', 1, 1, '1'); - print "result = ".$result."\n"; + print "result16 = ".$result."\n"; $this->assertFalse($result); + $string = '(isModEnabled("agenda") || isModEnabled("resource")) && getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 0 && preg_match(\'/^(admintools|all|XXX)/\', $leftmenu)'; + $result=dol_eval($string, 1, 1, '1'); + print "result17 = ".$result."\n"; + $this->assertTrue($result); // Case with param onlysimplestring = 1 $result=dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...' - print "result = ".$result."\n"; + print "result18 = ".$result."\n"; $this->assertFalse($result); $result=dol_eval("(\$a.'aa')", 1, 0); - print "result = ".$result."\n"; + print "result19 = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); $result=dol_eval('$a="abs" && $a(5)', 1, 0); - print "result = a".$result."\n"; + print "result20 = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); } From 803aca262e74f4a7dcbd3b6d0c2e3f7eaa9cd3dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2023 15:25:50 +0200 Subject: [PATCH 28/41] Fix edit colors with html5 component --- htdocs/comm/mailing/card.php | 4 ++-- htdocs/core/class/html.formother.class.php | 7 ++++--- htdocs/core/lib/functions.lib.php | 14 ++++++++++---- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index aaa946fd2fe..27af9dc5149 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -547,7 +547,7 @@ if (empty($reshook)) { $object->title = (string) GETPOST("title"); $object->sujet = (string) GETPOST("sujet"); $object->body = (string) GETPOST("bodyemail", 'restricthtml'); - $object->bgcolor = (string) GETPOST("bgcolor"); + $object->bgcolor = preg_replace('/^#/', '', (string) GETPOST("bgcolor")); $object->bgimage = (string) GETPOST("bgimage"); if (!$object->title) { @@ -641,7 +641,7 @@ if (empty($reshook)) { $mesgs = array(); $object->sujet = (string) GETPOST("sujet"); $object->body = (string) GETPOST("bodyemail", 'restricthtml'); - $object->bgcolor = (string) GETPOST("bgcolor"); + $object->bgcolor = preg_replace('/^#/', '', (string) GETPOST("bgcolor")); $object->bgimage = (string) GETPOST("bgimage"); if (!$object->sujet) { diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 8800d5a59fc..e1356fb5dec 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -825,11 +825,11 @@ class FormOther /** * Output a HTML code to select a color. Field will return an hexa color like '334455'. * - * @param string $set_color Pre-selected color + * @param string $set_color Pre-selected color with format '#......' * @param string $prefix Name of HTML field * @param string $form_name Deprecated. Not used. * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code - * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') + * @param array $arrayofcolors Array of possible colors to choose in the selector. All colors are possible if empty. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @param string $morecss Add css style into input field * @param string $setpropertyonselect Set this property after selecting a color * @param string $default Default color @@ -917,7 +917,8 @@ class FormOther '; $out .= ''; } else { - $out .= ''; + $color = ($set_color !== '' ? $set_color : ($default !== '' ? $default : 'FFFFFF')); + $out .= ''; $out .= '