From c2f91b2e15cec9f680041aef260d348a2b2213cd Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 3 Feb 2023 14:02:46 +0100 Subject: [PATCH 01/97] FIX attach file and send by mail in ticket --- htdocs/core/class/html.formticket.class.php | 8 ++++---- htdocs/ticket/class/ticket.class.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index cea007f8e61..cd6b9ecd7fc 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -910,7 +910,7 @@ class FormTicket $langs->loadLangs(array('other', 'mails')); // Clear temp files. Must be done at beginning, before call of triggers - if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { + if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { $this->clear_attached_files(); } @@ -943,10 +943,10 @@ class FormTicket $listofmimes = array(); $keytoavoidconflict = empty($this->trackid) ? '' : '-'.$this->trackid; // this->trackid must be defined - if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { - if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) { + if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { + if (!empty($arraydefaultmessage->joinfiles) && !empty($this->param['fileinit']) && is_array($this->param['fileinit'])) { foreach ($this->param['fileinit'] as $file) { - $this->add_attached_files($file, basename($file), dol_mimetype($file)); + $formmail->add_attached_files($file, basename($file), dol_mimetype($file)); } } } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index e03bdabe617..d12df619bb0 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2454,7 +2454,7 @@ class Ticket extends CommonObject $maxheightmini = 72; $formmail = new FormMail($this->db); - + $formmail->trackid = 'tic'.$this->id; $attachedfiles = $formmail->get_attached_files(); $filepath = $attachedfiles['paths']; From 2c826a4fccec04a00748deb6fd2a0a4a46113342 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Wed, 1 Feb 2023 15:33:14 +0100 Subject: [PATCH 02/97] FIX: Remove orphelan $this->db->rollback() in the function insertExtrafields() --- htdocs/core/class/commonobject.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d322260175a..f91f34c0867 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6296,7 +6296,6 @@ abstract class CommonObject $new_array_options[$key] = $object->id; } else { $this->error = "Id/Ref '".$value."' for object '".$object->element."' not found"; - $this->db->rollback(); return -1; } } From 31984b8f2eef16d6bda64e2aa630db24ff6a24c1 Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Sun, 5 Feb 2023 09:33:54 +0100 Subject: [PATCH 03/97] update --- htdocs/comm/index.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index a57c7232885..167005cf2f4 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -60,19 +60,11 @@ if (isset($user->socid) && $user->socid > 0) { $socid = $user->socid; } +restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); + $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; $now = dol_now(); -// Security check -$socid = GETPOST("socid", 'int'); -if ($user->socid > 0) { - $action = ''; - $id = $user->socid; -} else { - $id = 0; -} -restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0); - $maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD); From edb81d19553983b80869f36baad258fc4437485d Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Sun, 5 Feb 2023 11:43:09 +0100 Subject: [PATCH 04/97] update --- htdocs/comm/action/peruser.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 87def7240f5..724a6a89a59 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -915,6 +915,11 @@ while ($currentdaytoshow < $lastdaytoshow) { if ($usergroup > 0) { $sql .= " AND ug.fk_usergroup = ".((int) $usergroup); } + if ($user->socid > 0) + { + // External users should see only contacts of their company + $sql .= " AND fk_soc=" . $socid; + } //print $sql; $resql = $db->query($sql); From d2a6d89fca58163b07fcbc2a15b90f04afd85415 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 5 Feb 2023 10:48:29 +0000 Subject: [PATCH 05/97] Fixing style errors. --- htdocs/comm/action/peruser.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 724a6a89a59..e0e6e9ff004 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -915,8 +915,7 @@ while ($currentdaytoshow < $lastdaytoshow) { if ($usergroup > 0) { $sql .= " AND ug.fk_usergroup = ".((int) $usergroup); } - if ($user->socid > 0) - { + if ($user->socid > 0) { // External users should see only contacts of their company $sql .= " AND fk_soc=" . $socid; } From a0f8a2454b05e9ed3919f15850806c7c65a8c639 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Feb 2023 00:04:19 +0100 Subject: [PATCH 06/97] Update peruser.php --- htdocs/comm/action/peruser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index e0e6e9ff004..9448ea0b77b 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -917,7 +917,7 @@ while ($currentdaytoshow < $lastdaytoshow) { } if ($user->socid > 0) { // External users should see only contacts of their company - $sql .= " AND fk_soc=" . $socid; + $sql .= " AND fk_soc = ".((int) $user->socid); } //print $sql; From b52203b4e0bf438b1a69fe98af216921d34c982e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Feb 2023 00:05:06 +0100 Subject: [PATCH 07/97] Update peruser.php --- htdocs/comm/action/peruser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 9448ea0b77b..ba631ba8c59 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -917,7 +917,7 @@ while ($currentdaytoshow < $lastdaytoshow) { } if ($user->socid > 0) { // External users should see only contacts of their company - $sql .= " AND fk_soc = ".((int) $user->socid); + $sql .= " AND u.fk_soc = ".((int) $user->socid); } //print $sql; From 2e7371eee649798adbab3d73dcbb54773ba73bde Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 6 Feb 2023 08:45:44 +0100 Subject: [PATCH 08/97] Fix #23795 --- htdocs/comm/propal/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index eb8ac018979..c702cf66434 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -132,7 +132,6 @@ $permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown // Security check if (!empty($user->socid)) { $socid = $user->socid; - $object->id = $user->socid; } restrictedArea($user, 'propal', $object->id); From 394c3f847c4ffb1fb62a08d2d3f45450fb387797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Mon, 6 Feb 2023 17:03:51 +0100 Subject: [PATCH 09/97] FIX clicktodial backtopage --- 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 f9adc7bcf40..dafa33242df 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3410,7 +3410,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli $type = 'AC_FAX'; } if (!empty($conf->global->AGENDA_ADDACTIONFORPHONE)) { - $link = ''.img_object($langs->trans("AddAction"), "calendar").''; + $link = ''.img_object($langs->trans("AddAction"), "calendar").''; } if ($link) { $newphone = '
'.$newphone.' '.$link.'
'; From fc767cbfbef84278a5998dd0d08c649133d01eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 6 Feb 2023 17:56:21 +0100 Subject: [PATCH 10/97] FIX discount wasn't taken into account when adding a line in BOM --- htdocs/bom/class/bom.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 0e57bebd922..e414954d1a5 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1058,8 +1058,10 @@ class BOM extends CommonObject return -1; } $line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp); - if (empty($line->unit_cost)) { - if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) { + if ((empty($line->unit_cost)) && ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0)) { + if ($productFournisseur->fourn_remise_percent != "0") { + $line->unit_cost = $productFournisseur->fourn_unitprice_with_discount; + } else { $line->unit_cost = $productFournisseur->fourn_unitprice; } } From 016d1117a69f3818485b3b7ad8e8c0d4a321fa7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 6 Feb 2023 18:02:28 +0100 Subject: [PATCH 11/97] added my name to the file --- htdocs/bom/class/bom.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index e414954d1a5..8b866e221de 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2019 Laurent Destailleur + * Copyright (C) 2023 Benjamin Falière * * 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 From eb5f1b6649272cdf4e8bb0cc8c12c0fca592cbf2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Feb 2023 22:26:09 +0100 Subject: [PATCH 12/97] Fix filter on supplier categories --- htdocs/compta/stats/supplier_turnover_by_thirdparty.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index 19088a6d2fa..10cec544e19 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -239,9 +239,9 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= " sum(f.total_ht) as amount, sum(f.total_ttc) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s"; if ($selected_cat === -2) { // Without any category - $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; + $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; } elseif ($selected_cat) { // Into a specific category - $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; + $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_fournisseur as cs"; } $sql .= " WHERE f.fk_statut in (1,2)"; $sql .= " AND f.type IN (0,2)"; @@ -266,9 +266,9 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= ", ".MAIN_DB_PREFIX."paiementfourn as p"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if ($selected_cat === -2) { // Without any category - $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; + $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; } elseif ($selected_cat) { // Into a specific category - $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; + $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_fournisseur as cs"; } $sql .= " WHERE p.rowid = pf.fk_paiementfourn"; $sql .= " AND pf.fk_facturefourn = f.rowid"; From 3dc8937ad32c52de4a7c9c7b1798b9c1b2eeed58 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Feb 2023 00:11:33 +0100 Subject: [PATCH 13/97] Provide an object for computed extrafields --- htdocs/core/class/commonobject.class.php | 2 ++ htdocs/core/lib/functions.lib.php | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f91f34c0867..7baa35d0f27 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6066,6 +6066,8 @@ abstract class CommonObject if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { //var_dump($conf->disable_compute); if (empty($conf->disable_compute)) { + global $objectoffield; // We set a global variable to $objectoffield so + $objectoffield = $this; // we can use it inside computed formula $this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, ''); } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f9adc7bcf40..9bff1a8e49e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8599,10 +8599,12 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' // Only global variables can be changed by eval function and returned to caller global $db, $langs, $user, $conf, $website, $websitepage; global $action, $mainmenu, $leftmenu; + global $mysoc; + global $objectoffield; + + // Old variables used global $rights; global $object; - global $mysoc; - global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object global $soc; // For backward compatibility From 55d6e2ead026cf7dde9124e26432d97e3b63a9b5 Mon Sep 17 00:00:00 2001 From: tnegre Date: Tue, 7 Feb 2023 17:24:16 +0100 Subject: [PATCH 14/97] Fix prelevement line : the link to the facture was to a customer facture, even when it was a facturefourn. --- htdocs/compta/prelevement/line.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index cba7777b734..6eb10ce6a1a 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -309,7 +309,11 @@ if ($id) { print img_object($langs->trans("ShowBill"), "bill"); print ' '; - print ''.$obj->ref."\n"; + if ($type == 'bank-transfer') { + print ''.$obj->ref."\n"; + } else { + print ''.$obj->ref."\n"; + } print ''; print img_object($langs->trans("ShowCompany"), "company").' '.$obj->name."\n"; From b880029ac048e3b3e256fac1baf24f2451348a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Wed, 8 Feb 2023 09:58:30 +0100 Subject: [PATCH 15/97] typos in getAttchments() $arrayobject --- htdocs/emailcollector/class/emailcollector.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 53889ef9c07..5d0c92b4c32 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1951,7 +1951,7 @@ class EmailCollector extends CommonObject 'ticket' => array('table' => 'ticket', 'fields' => array('ref'), 'class' => 'ticket/class/ticket.class.php', - 'object' => ' Ticket'), + 'object' => 'Ticket'), 'knowledgemanagement' => array('table' => 'knowledgemanagement_knowledgerecord', 'fields' => array('ref'), 'class' => 'knowledgemanagement/class/knowledgemanagement.class.php', @@ -1969,7 +1969,7 @@ class EmailCollector extends CommonObject 'class' => 'compta/facture/class/facture.class.php', 'object' => 'Facture'), 'fournisseur/facture' => array('table' => 'facture_fourn', - 'fields' => array('ref', ref_client), + 'fields' => array('ref', 'ref_client'), 'class' => 'fourn/class/fournisseur.facture.class.php', 'object' => 'FactureFournisseur'), 'produit' => array('table' => 'product', From 98bfba1f461be23fcce1451cd1f275ab82c9020e Mon Sep 17 00:00:00 2001 From: avolani <31508728+avolani@users.noreply.github.com> Date: Wed, 8 Feb 2023 16:20:47 +0100 Subject: [PATCH 16/97] Add missing table_element This allow usage of extrafields logic (still missing table and setup pages) --- htdocs/expensereport/class/expensereport.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index bc7e0f36baa..04c16fc2654 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2680,6 +2680,11 @@ class ExpenseReportLine extends CommonObjectLine * @var DoliDB Database handler. */ public $db; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'expensereport_det'; /** * @var string Error code (or message) From 637603731a3785eadbdd454ae96ecc79ed570b7a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 8 Feb 2023 15:26:10 +0000 Subject: [PATCH 17/97] Fixing style errors. --- htdocs/expensereport/class/expensereport.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 04c16fc2654..6ee3c8e19e7 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2680,11 +2680,11 @@ class ExpenseReportLine extends CommonObjectLine * @var DoliDB Database handler. */ public $db; - + /** - * @var string Name of table without prefix where object is stored - */ - public $table_element = 'expensereport_det'; + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'expensereport_det'; /** * @var string Error code (or message) From 01e0503b0f073fa39056f168b8fe6cf049e0cd3e Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 9 Feb 2023 11:52:41 +0100 Subject: [PATCH 18/97] FIX several email sent to the same recipient when adding message from ticket --- htdocs/ticket/class/ticket.class.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index d12df619bb0..122c5ae35ab 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2576,24 +2576,24 @@ class Ticket extends CommonObject $assigned_user = new User($this->db); $assigned_user->fetch($this->fk_user_assign); if (!empty($assigned_user->email)) { - $sendto[] = $assigned_user->getFullName($langs)." <".$assigned_user->email.">"; + $sendto[$assigned_user->email] = $assigned_user->getFullName($langs)." <".$assigned_user->email.">"; } else { $assigned_user_dont_have_email = $assigned_user->getFullName($langs); } } if (empty($sendto)) { if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL)) { - $sendto[] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL; + $sendto[$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL; } elseif (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } } // Add global email address recipient if (!empty($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS) && - !empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto) + !empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto) ) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } if (!empty($sendto)) { @@ -2677,7 +2677,7 @@ class Ticket extends CommonObject if ($info_sendto['email'] != '') { if (!empty($info_sendto['email'])) { - $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; + $sendto[$info_sendto['email']] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; } //Contact type @@ -2693,9 +2693,9 @@ class Ticket extends CommonObject $message .= '
'.$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.$object->track_id.'
'; // Add global email address recipient - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { + if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } } @@ -2755,7 +2755,7 @@ class Ticket extends CommonObject if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) { if (!empty($info_sendto['email'])) { - $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; + $sendto[$info_sendto['email']] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; } $recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')'; @@ -2775,21 +2775,21 @@ class Ticket extends CommonObject $message .= '
'.$message_signature; if (!empty($object->origin_email)) { - $sendto[] = $object->origin_email; + $sendto[$object->origin_email] = $object->origin_email; } - if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) { + if ($object->fk_soc > 0 && !array_key_exists($object->origin_email, $sendto)) { $object->socid = $object->fk_soc; $object->fetch_thirdparty(); if (!empty($object->thirdparty->email)) { - $sendto[] = $object->thirdparty->email; + $sendto[$object->thirdparty->email] = $object->thirdparty->email; } } // altairis: Add global email address reciepient - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { + if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } } From e83559afb0ab7963a0187dbdcb4f8d5ea89f72fa Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 9 Feb 2023 15:20:07 +0100 Subject: [PATCH 19/97] FIX strato pdf --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 1875cfb833c..e9c53f4b354 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -230,7 +230,7 @@ class pdf_strato extends ModelePDFContract $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + $heightforfooter = $this->marge_basse + 9; // Height reserved to output the footer (value include bottom margin) if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) { $heightforfooter += 6; } @@ -383,7 +383,6 @@ class pdf_strato extends ModelePDFContract $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txtpredefinedservice, dol_concatdesc($txt, $desc)), 0, 1, 0); $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page $pdf->AddPage('', '', true); @@ -437,6 +436,9 @@ class pdf_strato extends ModelePDFContract $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if(empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } if (!empty($tplidx)) { $pdf->useTemplate($tplidx); } @@ -459,6 +461,7 @@ class pdf_strato extends ModelePDFContract } } + // Show square if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); From 78e1fad6bdf26548511a671f0c9a1b7830817939 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 9 Feb 2023 14:27:50 +0000 Subject: [PATCH 20/97] Fixing style errors. --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index e9c53f4b354..05e409ac9ed 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -436,7 +436,7 @@ class pdf_strato extends ModelePDFContract $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - if(empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { $this->_pagehead($pdf, $object, 0, $outputlangs); } if (!empty($tplidx)) { From 69b690c45e01ec898a3402fed24d282b15f5929a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 15:29:07 +0100 Subject: [PATCH 21/97] Merge pull request #23817 from elcf/develop Added key name to unique constraint --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 7c38fb59b6d..bee0477665f 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -688,7 +688,7 @@ ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext; DELETE FROM llx_boxes WHERE box_id IN (select rowid FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year')); DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year'); -ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label); +ALTER TABLE llx_takepos_floor_tables ADD UNIQUE uk_takepos_floor_tables (entity,label); ALTER TABLE llx_partnership ADD COLUMN url_to_check varchar(255); ALTER TABLE llx_c_partnership_type ADD COLUMN keyword varchar(128); From 8bd6f070aab2fd5efe01c4ce78fd274ee8002ac5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 9 Feb 2023 17:22:45 +0100 Subject: [PATCH 22/97] FIX: product ref fourn same size in supplier order/invoice as in product price fourn --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql | 2 +- htdocs/install/mysql/tables/llx_facture_fourn_det.sql | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 5621ca6fad8..bef7621d282 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -530,3 +530,6 @@ ALTER TABLE llx_element_tag ADD CONSTRAINT fk_element_tag_categorie_rowid FOREIG -- Idea is to update this column manually in v15 with value in currency of company for bank that are not into the main currency and the transfer -- into accounting will use it in priority if value is not null. The script repair.sql contains the sequence to fix datas in llx_bank. ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL; + +ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN ref varchar(128); +ALTER TABLE llx_facture_fourn_det MODIFY COLUMN ref varchar(128); diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql index f6092bc4c74..0dfed7152aa 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql @@ -25,7 +25,7 @@ create table llx_commande_fournisseurdet fk_commande integer NOT NULL, fk_parent_line integer NULL, fk_product integer, - ref varchar(50), -- supplier product ref + ref varchar(128), -- supplier product ref label varchar(255), -- product label description text, vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here. diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql index 30f57fa184b..8daf658fa68 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql @@ -24,7 +24,7 @@ create table llx_facture_fourn_det fk_facture_fourn integer NOT NULL, fk_parent_line integer NULL, fk_product integer NULL, - ref varchar(50), -- supplier product ref + ref varchar(128), -- supplier product ref label varchar(255), -- product label description text, pu_ht double(24,8), -- unit price excluding tax From 802ee770c3cac69d7efdb792d23b28d59b95ce70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 19:24:16 +0100 Subject: [PATCH 23/97] FIX #23860 --- htdocs/compta/facture/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 90f45018489..69155ecd8c7 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2981,7 +2981,11 @@ if ($action == 'create') { } // when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value - $fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account; + if ($socid > 0 && $fk_account) { // A company has already been set and it has a default fk_account + $fk_account = GETPOSTISSET('fk_account') ? GETPOST("fk_account", 'int') : $fk_account; // The GETPOST is used only if form was posted to avoid to take default value, because in such case, the default must be the one of the company + } else { // No company forced + $fk_account = GETPOST("fk_account", 'int'); + } if (!empty($soc->id)) { $absolute_discount = $soc->getAvailableDiscounts(); From 73b894dca3bee2895c4dd4ab5039dff2f202e029 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 23:19:58 +0100 Subject: [PATCH 24/97] Fix the qty in stock when product has no lot --- htdocs/product/reassortlot.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 690d3f3f261..6da51124919 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -214,7 +214,7 @@ $morecss = array(); $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql .= ' p.fk_product_type, p.tms as datem,'; $sql .= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,'; -$sql .= ' ps.fk_entrepot,'; +$sql .= ' ps.fk_entrepot, ps.reel,'; $sql .= ' e.ref as warehouse_ref, e.lieu as warehouse_lieu, e.fk_parent as warehouse_parent,'; $sql .= ' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,'; $sql .= ' pl.rowid as lotid, pl.eatby, pl.sellby,'; @@ -313,7 +313,7 @@ foreach ($search as $key => $val) { $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,"; $sql .= " p.fk_product_type, p.tms,"; $sql .= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,"; -$sql .= " ps.fk_entrepot,"; +$sql .= " ps.fk_entrepot, ps.reel,"; $sql .= " e.ref, e.lieu, e.fk_parent,"; $sql .= " pb.batch, pb.eatby, pb.sellby,"; $sql .= " pl.rowid, pl.eatby, pl.sellby"; @@ -322,7 +322,7 @@ if ($toolowstock) { $sql_having .= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet } if ($search_stock_physique != '') { - $natural_search_physique = natural_search('SUM(' . $db->ifsql('pb.qty IS NULL', '0', 'pb.qty') . ')', $search_stock_physique, 1, 1); + $natural_search_physique = natural_search('SUM(' . $db->ifsql('pb.qty IS NULL', $db->ifsql('ps.reel IS NULL', '0', 'ps.reel'), 'pb.qty') . ')', $search_stock_physique, 1, 1); $natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters if (!empty($sql_having)) { $sql_having .= " AND"; @@ -689,7 +689,15 @@ while ($i < $imaxinloop) { print ''; //if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; - print $objp->stock_physique; + if (is_null($objp->stock_physique)) { + if (!empty($objp->reel)) { + print price2num($objp->reel, 'MS'); + } + } else { + if (!empty($objp->stock_physique)) { + print price2num($objp->stock_physique, 'MS'); + } + } print ''; print ''; From 1bc16f47c0633332e9a855bcc499b4b73d5ceb39 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 10 Feb 2023 15:00:27 +0100 Subject: [PATCH 25/97] FIX : Missing right to edit service note when module product is disabled --- htdocs/product/note.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/note.php b/htdocs/product/note.php index b758f414035..52d912933eb 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -49,7 +49,7 @@ if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); } -$permissionnote = $user->rights->produit->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = ($user->rights->produit->creer || $user->rights->service->creer); // Used by the include of actions_setnotes.inc.php if ($object->id > 0) { if ($object->type == $object::TYPE_PRODUCT) { From 23b4e999fbeabad0eba22b782cf497e6a2aacbfa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 19:44:34 +0100 Subject: [PATCH 26/97] Better sql for unique index --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index bee0477665f..f4b7689d6df 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -688,7 +688,7 @@ ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext; DELETE FROM llx_boxes WHERE box_id IN (select rowid FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year')); DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year'); -ALTER TABLE llx_takepos_floor_tables ADD UNIQUE uk_takepos_floor_tables (entity,label); +ALTER TABLE llx_takepos_floor_tables ADD UNIQUE INDEX uk_takepos_floor_tables (entity,label); ALTER TABLE llx_partnership ADD COLUMN url_to_check varchar(255); ALTER TABLE llx_c_partnership_type ADD COLUMN keyword varchar(128); From 9c706061bea8a5011dd273edee6bd815c3fe49aa Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 11 Feb 2023 08:48:09 +0100 Subject: [PATCH 27/97] FIX Object of class LDAP\Connection could not be converted to string --- htdocs/core/class/ldap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 7b3c6c4ac2c..847a1bf32e3 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -1058,7 +1058,7 @@ class Ldap if (is_array($attributeArray)) { // Return list with required fields $attributeArray = array_values($attributeArray); // This is to force to have index reordered from 0 (not make ldap_search fails) - dol_syslog(get_class($this)."::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter." attributeArray=(".join(',', $attributeArray).")"); + dol_syslog(get_class($this)."::getRecords connection=".get_resource_type($this->connection)." userDn=".$userDn." filter=".$filter." attributeArray=(".join(',', $attributeArray).")"); //var_dump($attributeArray); $this->result = @ldap_search($this->connection, $userDn, $filter, $attributeArray); } else { From f569048eb2bd823525bce4ef52316e7a83e3345c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 13:50:40 +0100 Subject: [PATCH 28/97] Fix #hunter7a048bb7-bfdd-4299-931e-9bc283e92bc8 --- htdocs/main.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 98de8c12e5c..44ee262b700 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -167,16 +167,20 @@ function testSqlAndScriptInject($val, $type) $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $val); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $val); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $val); + // More not into the previous list + $inj += preg_match('/on(repeat|begin|finish|beforeinput)\s*=/i', $val); // We refuse html into html because some hacks try to obfuscate evil strings by inserting HTML into HTML. Example: error=alert(1) to bypass test on onerror $tmpval = preg_replace('/<[^<]+>/', '', $val); // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers - $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val); // onmousexxx can be set on img or any html tag like + $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $tmpval); // onmousexxx can be set on img or any html tag like $inj += preg_match('/on(abort|afterprint|animation|auxclick|beforecopy|beforecut|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $tmpval); $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $tmpval); $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $tmpval); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $tmpval); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $tmpval); + // More not into the previous list + $inj += preg_match('/on(repeat|begin|finish|beforeinput)\s*=/i', $tmpval); //$inj += preg_match('/on[A-Z][a-z]+\*=/', $val); // To lock event handlers onAbort(), ... $inj += preg_match('/:|:|:/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...' From e9c5f515ced36ccdfd5312049d76d7dc3c1e68d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 14:35:02 +0100 Subject: [PATCH 29/97] Fix #huntrb1412070-740e-4119-8e4b-61bdc3af42aa --- htdocs/accountancy/admin/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 02b95cfd043..535463822db 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -41,7 +41,7 @@ $ref = GETPOST('ref', 'alpha'); $rowid = GETPOST('rowid', 'int'); $cancel = GETPOST('cancel', 'alpha'); -$account_number = GETPOST('account_number', 'string'); +$account_number = GETPOST('account_number', 'alphanohtml'); $label = GETPOST('label', 'alpha'); // Security check From c3fc14a45af041919c1098c06781a2727b430b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 13 Feb 2023 16:05:12 +0100 Subject: [PATCH 30/97] FIX bad check on if in get_all_ways --- htdocs/categories/class/categorie.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 27a301776b8..23495e9c5c1 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2023 Benjamin Falière * * 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 @@ -1463,7 +1464,7 @@ class Categorie extends CommonObject $ways = array(); $parents = $this->get_meres(); - if (!empty($parents)) { + if (is_array($parents)) { foreach ($parents as $parent) { $allways = $parent->get_all_ways(); foreach ($allways as $way) { From cac9a00bac0a522c2d54e7557c8c0a2912b66566 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Mon, 13 Feb 2023 16:19:00 +0100 Subject: [PATCH 31/97] fix loi de finance 525 --- htdocs/blockedlog/README-fr.md | 2 +- htdocs/blockedlog/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/blockedlog/README-fr.md b/htdocs/blockedlog/README-fr.md index e92bd5a09fe..a5d709ca7a7 100644 --- a/htdocs/blockedlog/README-fr.md +++ b/htdocs/blockedlog/README-fr.md @@ -4,7 +4,7 @@ LOG INALTERABLE ## Fonctionnalité Ce module trace, en temps réel, certains évènements métiers dans une log inaltérable (que vous ne pouvez pas modifier une fois enregistrés) de type blockchain. -Ce module est requis pour la compatibilité avec les exigences légales de certains pays (comme la France avec la loi Fincance 2016 - Norme NF535). +Ce module est requis pour la compatibilité avec les exigences légales de certains pays (comme la France avec la loi Finance 2016 - Norme NF525). **Les évènements tracés de manière inaltérables sont:** diff --git a/htdocs/blockedlog/README.md b/htdocs/blockedlog/README.md index ec3174fb847..7bd9b10787e 100644 --- a/htdocs/blockedlog/README.md +++ b/htdocs/blockedlog/README.md @@ -4,7 +4,7 @@ BLOCKED LOG ## Feature This module tracks, in real time, some events into a non reversible log (that you can't modify once recorded) into a block chain. -This module provides compatibility with requirements of laws of some countries (like France with the law Fincance 2016 - Norme NF535). +This module provides compatibility with requirements of laws of some countries (like France with the law Finance 2016 - Norme NF525). **The tracked events are:** From 5217ae28f8159ace983f4ddfdf2f2cb0b7f4ef9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 21:35:48 +0100 Subject: [PATCH 32/97] Fix load of margin infos --- htdocs/compta/facture/list.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 40b672cbd9e..1fea36daf54 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1199,6 +1199,18 @@ if ($resql) { $i = 0; $totalarray = array(); + + $with_margin_info = false; + if (!empty($conf->margin->enabled) && ( + !empty($arrayfields['total_pa']['checked']) + || !empty($arrayfields['total_margin']['checked']) + || !empty($arrayfields['total_margin_rate']['checked']) + || !empty($arrayfields['total_mark_rate']['checked']) + ) + ) { + $with_margin_info = true; + } + while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -1281,7 +1293,7 @@ if ($resql) $facturestatic->alreadypaid = $paiement; $marginInfo = array(); - if (!empty($conf->margin->enabled)) { + if ($with_margin_info === true) { $facturestatic->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($facturestatic); } From 89a2f7a0c10054de042ec5fe33be3a4004c67c5a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 14 Feb 2023 10:53:59 +0100 Subject: [PATCH 33/97] FIX multicompany compatibility --- htdocs/core/lib/signature.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index c59acbea209..600f3878a0a 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -120,7 +120,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1) // For multicompany if (!empty($out) && !empty($conf->multicompany->enabled)) { - $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities + $out .= "&entity=".$object->entity; // Check the entity because we may have the same reference in several entities } return $out; From 670ae506e3f940ee42d21f1e51f86adb0c038945 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 15 Feb 2023 10:47:25 +0100 Subject: [PATCH 34/97] Fix: Bad assignation for external users access --- htdocs/comm/propal/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3a037d4b4a2..b36415f5b15 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2010-2023 Juanjo Menent * Copyright (C) 2010-2021 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Cedric Salvador @@ -131,7 +131,6 @@ $permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown // Security check if (!empty($user->socid)) { $socid = $user->socid; - $object->id = $user->socid; } restrictedArea($user, 'propal', $object->id); From 7653a7126b0280982664922ed1002284f1d8831a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 15 Feb 2023 13:47:55 +0100 Subject: [PATCH 35/97] FIX wrong url param name action --- htdocs/core/multicompany_page.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/multicompany_page.php b/htdocs/core/multicompany_page.php index 4a3bcba51fb..1161b7f07c9 100644 --- a/htdocs/core/multicompany_page.php +++ b/htdocs/core/multicompany_page.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/multicompany_page.php + * \file htdocs/core/multicompany_page.php * \brief File to return a page with the list of all entities user can switch to */ @@ -41,7 +41,7 @@ if (!defined('NOREQUIREMENU')) { require_once '../main.inc.php'; -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ'); $entityid = GETPOST('entity', 'int'); $backtourl = GETPOST('backtourl'); if (empty($backtourl)) { @@ -63,7 +63,7 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); * Actions */ -if (GETPOST('acction', 'aZ') == 'switchentity') { +if ($action == 'switchentity') { if (is_object($mc)) { $mc->switchEntity($entityid); } From 1b925ec53f152585ffba83cab3ca387f4e60c034 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Feb 2023 17:57:19 +0100 Subject: [PATCH 36/97] FIX Profit calculation on project preview tab. --- htdocs/projet/element.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 16b67dd4876..858e64cfced 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -584,9 +584,9 @@ $listofreferent = array( 'name'=>"MouvementStockAssociated", 'title'=>"ListMouvementStockProject", 'class'=>'MouvementStock', - 'margin'=>'minus', 'table'=>'stock_mouvement', 'datefieldname'=>'datem', + 'margin'=>'minus', 'disableamount'=>0, 'test'=>($conf->stock->enabled && $user->rights->stock->mouvement->lire && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))), 'salaries'=>array( @@ -752,6 +752,7 @@ $total_revenue_ht = 0; $balance_ht = 0; $balance_ttc = 0; +// Loop on each element type (proposal, sale order, invoices, ...) foreach ($listofreferent as $key => $value) { $parameters = array( 'total_revenue_ht' =>& $total_revenue_ht, @@ -787,6 +788,7 @@ foreach ($listofreferent as $key => $value) { $total_ht = 0; $total_ttc = 0; + // Loop on each object for the current element type $num = count($elementarray); for ($i = 0; $i < $num; $i++) { $tmp = explode('_', $elementarray[$i]); @@ -871,7 +873,7 @@ foreach ($listofreferent as $key => $value) { $defaultvat = get_default_tva($mysoc, $mysoc); $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)), 'MT'); } elseif ($key == 'loan') { - $total_ttc_by_line = $total_ht_by_line; // For loan there is actually no taxe managed in Dolibarr + $total_ttc_by_line = $total_ht_by_line; // For loan there is actually no taxe managed in Dolibarr } else { $total_ttc_by_line = $element->total_ttc; } @@ -892,19 +894,14 @@ foreach ($listofreferent as $key => $value) { } // Each element with at least one line is output - $qualifiedforfinalprofit = true; - if ($key == 'intervention' && empty($conf->global->PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT)) { - $qualifiedforfinalprofit = false; - } - //var_dump($key.' '.$qualifiedforfinalprofit); // Calculate margin - if ($qualifiedforfinalprofit) { - if ($margin == 'add') { + if ($margin) { + if ($margin === 'add') { $total_revenue_ht += $total_ht; } - if ($margin != "add") { // Revert sign + if ($margin === "minus") { // Revert sign $total_ht = -$total_ht; $total_ttc = -$total_ttc; } @@ -923,10 +920,10 @@ foreach ($listofreferent as $key => $value) { if ($key == 'intervention' && !$qualifiedforfinalprofit) { print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; } else { - print price($total_ht); if ($key == 'propal') { print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).''; } + print price($total_ht); } print ''; // Amount TTC @@ -934,10 +931,10 @@ foreach ($listofreferent as $key => $value) { if ($key == 'intervention' && !$qualifiedforfinalprofit) { print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; } else { - print price($total_ttc); if ($key == 'propal') { print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).''; } + print price($total_ttc); } print ''; print ''; From d04043f3d823e3a203501b792086b854cc5c06f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Feb 2023 17:57:19 +0100 Subject: [PATCH 37/97] FIX Profit calculation on project preview tab. --- htdocs/projet/element.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 80fccce7912..b8981dd07f2 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -579,9 +579,9 @@ $listofreferent = array( 'name'=>"MouvementStockAssociated", 'title'=>"ListMouvementStockProject", 'class'=>'MouvementStock', - 'margin'=>'minus', 'table'=>'stock_mouvement', 'datefieldname'=>'datem', + 'margin'=>'minus', 'disableamount'=>0, 'test'=>($conf->stock->enabled && $user->rights->stock->mouvement->lire && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))), 'salaries'=>array( @@ -747,6 +747,7 @@ $total_revenue_ht = 0; $balance_ht = 0; $balance_ttc = 0; +// Loop on each element type (proposal, sale order, invoices, ...) foreach ($listofreferent as $key => $value) { $parameters = array( 'total_revenue_ht' =>& $total_revenue_ht, @@ -782,6 +783,7 @@ foreach ($listofreferent as $key => $value) { $total_ht = 0; $total_ttc = 0; + // Loop on each object for the current element type $num = count($elementarray); for ($i = 0; $i < $num; $i++) { $tmp = explode('_', $elementarray[$i]); @@ -866,7 +868,7 @@ foreach ($listofreferent as $key => $value) { $defaultvat = get_default_tva($mysoc, $mysoc); $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)), 'MT'); } elseif ($key == 'loan') { - $total_ttc_by_line = $total_ht_by_line; // For loan there is actually no taxe managed in Dolibarr + $total_ttc_by_line = $total_ht_by_line; // For loan there is actually no taxe managed in Dolibarr } else { $total_ttc_by_line = $element->total_ttc; } @@ -887,19 +889,14 @@ foreach ($listofreferent as $key => $value) { } // Each element with at least one line is output - $qualifiedforfinalprofit = true; - if ($key == 'intervention' && empty($conf->global->PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT)) { - $qualifiedforfinalprofit = false; - } - //var_dump($key.' '.$qualifiedforfinalprofit); // Calculate margin - if ($qualifiedforfinalprofit) { - if ($margin == 'add') { + if ($margin) { + if ($margin === 'add') { $total_revenue_ht += $total_ht; } - if ($margin != "add") { // Revert sign + if ($margin === "minus") { // Revert sign $total_ht = -$total_ht; $total_ttc = -$total_ttc; } @@ -918,10 +915,10 @@ foreach ($listofreferent as $key => $value) { if ($key == 'intervention' && !$qualifiedforfinalprofit) { print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; } else { - print price($total_ht); if ($key == 'propal') { print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).''; } + print price($total_ht); } print ''; // Amount TTC @@ -929,10 +926,10 @@ foreach ($listofreferent as $key => $value) { if ($key == 'intervention' && !$qualifiedforfinalprofit) { print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; } else { - print price($total_ttc); if ($key == 'propal') { print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).''; } + print price($total_ttc); } print ''; print ''; From 32d27887b11e757ba00032c82da87a7c30bef5c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Feb 2023 18:11:25 +0100 Subject: [PATCH 38/97] Fix message for profit calculation --- htdocs/langs/en_US/interventions.lang | 2 +- htdocs/projet/element.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index ef5df43e546..bce9c04aeb3 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -50,7 +50,7 @@ UseDateWithoutHourOnFichinter=Hides hours and minutes off the date field for int InterventionStatistics=Statistics of interventions NbOfinterventions=No. of intervention cards NumberOfInterventionsByMonth=No. of intervention cards by month (date of validation) -AmountOfInteventionNotIncludedByDefault=Amount of intervention is not included by default into profit (in most cases, timesheets are used to count time spent). Add option PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT to 1 into home-setup-other to include them. +AmountOfInteventionNotIncludedByDefault=Amount of intervention is not included by default into profit (in most cases, timesheets are used to count time spent). You can use PROJECT_ELEMENTS_FOR_ADD_MARGIN and PROJECT_ELEMENTS_FOR_MINUS_MARGIN option into home-setup-other to complete list of element included into profit. InterId=Intervention id InterRef=Intervention ref. InterDateCreation=Date creation intervention diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index b8981dd07f2..cebe109b0c5 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -469,7 +469,7 @@ $listofreferent = array( 'table'=>'fichinter', 'datefieldname'=>'date_valid', 'disableamount'=>0, - 'margin'=>'minus', + 'margin'=>'', 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'interventions', 'buttonnew'=>'AddIntervention', @@ -912,7 +912,7 @@ foreach ($listofreferent as $key => $value) { print ''.$i.''; // Amount HT print ''; - if ($key == 'intervention' && !$qualifiedforfinalprofit) { + if ($key == 'intervention' && !$margin) { print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; } else { if ($key == 'propal') { @@ -923,7 +923,7 @@ foreach ($listofreferent as $key => $value) { print ''; // Amount TTC print ''; - if ($key == 'intervention' && !$qualifiedforfinalprofit) { + if ($key == 'intervention' && !$margin) { print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; } else { if ($key == 'propal') { From b57d1ed26372b7cc6076531bb29ad912a7fee3d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Feb 2023 17:57:19 +0100 Subject: [PATCH 39/97] FIX Profit calculation on project preview tab. --- htdocs/projet/element.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index c805552d7a5..7b1179ed597 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -581,9 +581,9 @@ $listofreferent = array( 'name'=>"MouvementStockAssociated", 'title'=>"ListMouvementStockProject", 'class'=>'MouvementStock', - 'margin'=>'minus', 'table'=>'stock_mouvement', 'datefieldname'=>'datem', + 'margin'=>'minus', 'disableamount'=>0, 'test'=>($conf->stock->enabled && $user->rights->stock->mouvement->lire && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))), 'salaries'=>array( @@ -749,6 +749,7 @@ $total_revenue_ht = 0; $balance_ht = 0; $balance_ttc = 0; +// Loop on each element type (proposal, sale order, invoices, ...) foreach ($listofreferent as $key => $value) { $parameters = array( 'total_revenue_ht' =>& $total_revenue_ht, @@ -784,6 +785,7 @@ foreach ($listofreferent as $key => $value) { $total_ht = 0; $total_ttc = 0; + // Loop on each object for the current element type $num = count($elementarray); for ($i = 0; $i < $num; $i++) { $tmp = explode('_', $elementarray[$i]); @@ -868,7 +870,7 @@ foreach ($listofreferent as $key => $value) { $defaultvat = get_default_tva($mysoc, $mysoc); $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)), 'MT'); } elseif ($key == 'loan') { - $total_ttc_by_line = $total_ht_by_line; // For loan there is actually no taxe managed in Dolibarr + $total_ttc_by_line = $total_ht_by_line; // For loan there is actually no taxe managed in Dolibarr } else { $total_ttc_by_line = $element->total_ttc; } @@ -889,19 +891,14 @@ foreach ($listofreferent as $key => $value) { } // Each element with at least one line is output - $qualifiedforfinalprofit = true; - if ($key == 'intervention' && empty($conf->global->PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT)) { - $qualifiedforfinalprofit = false; - } - //var_dump($key.' '.$qualifiedforfinalprofit); // Calculate margin - if ($qualifiedforfinalprofit) { - if ($margin == 'add') { + if ($margin) { + if ($margin === 'add') { $total_revenue_ht += $total_ht; } - if ($margin != "add") { // Revert sign + if ($margin === "minus") { // Revert sign $total_ht = -$total_ht; $total_ttc = -$total_ttc; } @@ -920,10 +917,10 @@ foreach ($listofreferent as $key => $value) { if ($key == 'intervention' && !$qualifiedforfinalprofit) { print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; } else { - print price($total_ht); if ($key == 'propal') { print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).''; } + print price($total_ht); } print ''; // Amount TTC @@ -931,10 +928,10 @@ foreach ($listofreferent as $key => $value) { if ($key == 'intervention' && !$qualifiedforfinalprofit) { print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; } else { - print price($total_ttc); if ($key == 'propal') { print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).''; } + print price($total_ttc); } print ''; print ''; From 89817c8ead0cdb718e0d9bb44c16fef619e01d53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Feb 2023 18:11:25 +0100 Subject: [PATCH 40/97] Fix message for profit calculation --- htdocs/langs/en_US/interventions.lang | 2 +- htdocs/projet/element.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 51079fca278..513bfebd78f 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -50,7 +50,7 @@ UseDateWithoutHourOnFichinter=Hides hours and minutes off the date field for int InterventionStatistics=Statistics of interventions NbOfinterventions=No. of intervention cards NumberOfInterventionsByMonth=No. of intervention cards by month (date of validation) -AmountOfInteventionNotIncludedByDefault=Amount of intervention is not included by default into profit (in most cases, timesheets are used to count time spent). Add option PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT to 1 into home-setup-other to include them. +AmountOfInteventionNotIncludedByDefault=Amount of intervention is not included by default into profit (in most cases, timesheets are used to count time spent). You can use PROJECT_ELEMENTS_FOR_ADD_MARGIN and PROJECT_ELEMENTS_FOR_MINUS_MARGIN option into home-setup-other to complete list of element included into profit. InterId=Intervention id InterRef=Intervention ref. InterDateCreation=Date creation intervention diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 7b1179ed597..537215896a1 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -471,7 +471,7 @@ $listofreferent = array( 'table'=>'fichinter', 'datefieldname'=>'date_valid', 'disableamount'=>0, - 'margin'=>'minus', + 'margin'=>'', 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'interventions', 'buttonnew'=>'AddIntervention', @@ -914,7 +914,7 @@ foreach ($listofreferent as $key => $value) { print ''.$i.''; // Amount HT print ''; - if ($key == 'intervention' && !$qualifiedforfinalprofit) { + if ($key == 'intervention' && !$margin) { print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; } else { if ($key == 'propal') { @@ -925,7 +925,7 @@ foreach ($listofreferent as $key => $value) { print ''; // Amount TTC print ''; - if ($key == 'intervention' && !$qualifiedforfinalprofit) { + if ($key == 'intervention' && !$margin) { print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; } else { if ($key == 'propal') { From c259ca09b8c20d492ae0cc783df5fa0494d80574 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Feb 2023 20:14:48 +0100 Subject: [PATCH 41/97] Enhance script to repair database when stock by lot differ from stock --- htdocs/install/repair.php | 99 +++++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 40 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 802711f4ff3..1e912b54f95 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -903,9 +903,8 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha')) { $sql = "SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb ON ps.rowid = pb.fk_product_stock"; $sql .= " WHERE p.rowid = ps.fk_product"; - $sql .= " AND p.tobatch > 0"; $sql .= " GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel"; - $sql .= " HAVING reel != SUM(pb.qty) or SUM(pb.qty) IS NULL"; + $sql .= " HAVING (SUM(pb.qty) IS NOT NULL AND reel != SUM(pb.qty)) OR (SUM(pb.qty) IS NULL AND p.tobatch > 0)"; print $sql; $resql = $db->query($sql); if ($resql) { @@ -915,53 +914,73 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha')) { $i = 0; while ($i < $num) { $obj = $db->fetch_object($resql); - print 'Product '.$obj->rowid.'-'.$obj->ref.' in warehose '.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' (product_stock.reel) != '.($obj->reelbatch ? $obj->reelbatch : '0').' (sum product_batch)'; + print 'Product '.$obj->rowid.'-'.$obj->ref.' in warehouse id='.$obj->fk_entrepot.' -> product_stock.id='.$obj->psrowid.': '.$obj->reel.' (product_stock.reel) != '.($obj->reelbatch ? $obj->reelbatch : '0').' (sum product_batch)'; - // Fix + // Fix is required if ($obj->reel != $obj->reelbatch) { - if ($methodtofix == 'updatebatch') { - // Method 1 - print ' -> Insert qty '.($obj->reel - $obj->reelbatch).' with lot 000000 linked to fk_product_stock='.$obj->psrowid; + if (empty($obj->tobatch)) { + // If product is not a product that support batches, we can clean stock by deleting the product batch lines + print ' -> Delete qty '.$obj->reelbatch.' for any lot linked to fk_product_stock='.$obj->psrowid; + $sql2 = "DELETE FROM ".MAIN_DB_PREFIX."product_batch"; + $sql2 .= " WHERE fk_product_stock = ".$obj->psrowid; + print '
'.$sql2; + if (GETPOST('clean_product_stock_batch') == 'confirmed') { - $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_batch(fk_product_stock, batch, qty)"; - $sql2 .= "VALUES(".$obj->psrowid.", '000000', ".($obj->reel - $obj->reelbatch).")"; $resql2 = $db->query($sql2); if (!$resql2) { - // TODO If it fails, we must make update - //$sql2 ="UPDATE ".MAIN_DB_PREFIX."product_batch"; - //$sql2.=" SET ".$obj->psrowid.", '000000', ".($obj->reel - $obj->reelbatch).")"; - //$sql2.=" WHERE fk_product_stock = ".((int) $obj->psrowid) - } - } - } - if ($methodtofix == 'updatestock') { - // Method 2 - print ' -> Update qty of product_stock with qty = '.($obj->reelbatch ? ((float) $obj->reelbatch) : '0').' for ps.rowid = '.((int) $obj->psrowid); - if (GETPOST('clean_product_stock_batch') == 'confirmed') { - $error = 0; - - $db->begin(); - - $sql2 = "UPDATE ".MAIN_DB_PREFIX."product_stock"; - $sql2 .= " SET reel = ".($obj->reelbatch ? ((float) $obj->reelbatch) : '0')." WHERE rowid = ".((int) $obj->psrowid); - $resql2 = $db->query($sql2); - if ($resql2) { - // We update product_stock, so we must fill p.stock into product too. - $sql3 = 'UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid)'; - $resql3 = $db->query($sql3); - if (!$resql3) { - $error++; - dol_print_error($db); - } - } else { $error++; dol_print_error($db); } + } + } else { + if ($methodtofix == 'updatebatch') { + // Method 1 + print ' -> Insert qty '.($obj->reel - $obj->reelbatch).' with lot 000000 linked to fk_product_stock='.$obj->psrowid; + $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_batch(fk_product_stock, batch, qty)"; + $sql2 .= "VALUES(".$obj->psrowid.", '000000', ".($obj->reel - $obj->reelbatch).")"; + print '
'.$sql2; - if (!$error) { - $db->commit(); - } else { - $db->rollback(); + if (GETPOST('clean_product_stock_batch') == 'confirmed') { + $resql2 = $db->query($sql2); + if (!$resql2) { + // TODO If it fails, we must make update + //$sql2 ="UPDATE ".MAIN_DB_PREFIX."product_batch"; + //$sql2.=" SET ".$obj->psrowid.", '000000', ".($obj->reel - $obj->reelbatch).")"; + //$sql2.=" WHERE fk_product_stock = ".((int) $obj->psrowid) + } + } + } + if ($methodtofix == 'updatestock') { + // Method 2 + print ' -> Update qty of product_stock with qty = '.($obj->reelbatch ? ((float) $obj->reelbatch) : '0').' for ps.rowid = '.((int) $obj->psrowid); + $sql2 = "UPDATE ".MAIN_DB_PREFIX."product_stock"; + $sql2 .= " SET reel = ".($obj->reelbatch ? ((float) $obj->reelbatch) : '0')." WHERE rowid = ".((int) $obj->psrowid); + print '
'.$sql2; + + if (GETPOST('clean_product_stock_batch') == 'confirmed') { + $error = 0; + + $db->begin(); + + $resql2 = $db->query($sql2); + if ($resql2) { + // We update product_stock, so we must fill p.stock into product too. + $sql3 = 'UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid)'; + $resql3 = $db->query($sql3); + if (!$resql3) { + $error++; + dol_print_error($db); + } + } else { + $error++; + dol_print_error($db); + } + + if (!$error) { + $db->commit(); + } else { + $db->rollback(); + } } } } From 94002bf85c5299f4d02c129f388a2b0332c93e81 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Feb 2023 20:38:38 +0100 Subject: [PATCH 42/97] Fix sql --- htdocs/install/repair.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 1e912b54f95..11f94ac00d6 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -922,7 +922,7 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha')) { // If product is not a product that support batches, we can clean stock by deleting the product batch lines print ' -> Delete qty '.$obj->reelbatch.' for any lot linked to fk_product_stock='.$obj->psrowid; $sql2 = "DELETE FROM ".MAIN_DB_PREFIX."product_batch"; - $sql2 .= " WHERE fk_product_stock = ".$obj->psrowid; + $sql2 .= " WHERE fk_product_stock = ".((int) $obj->psrowid); print '
'.$sql2; if (GETPOST('clean_product_stock_batch') == 'confirmed') { @@ -937,7 +937,7 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha')) { // Method 1 print ' -> Insert qty '.($obj->reel - $obj->reelbatch).' with lot 000000 linked to fk_product_stock='.$obj->psrowid; $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_batch(fk_product_stock, batch, qty)"; - $sql2 .= "VALUES(".$obj->psrowid.", '000000', ".($obj->reel - $obj->reelbatch).")"; + $sql2 .= "VALUES(".((int) $obj->psrowid).", '000000', ".((float) ($obj->reel - $obj->reelbatch)).")"; print '
'.$sql2; if (GETPOST('clean_product_stock_batch') == 'confirmed') { From 6163f84d258df4cf87e01cebdf7b11a549bbe9b1 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 15 Feb 2023 22:10:03 +0100 Subject: [PATCH 43/97] move log after variable updates to get good informations in logs --- htdocs/core/class/CMailFile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 94fb05d5346..47f8fd900cb 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -184,9 +184,6 @@ class CMailFile // On defini alternative_boundary $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars) - dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); - dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); - if (empty($subject)) { dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject"); $this->error = 'ErrorSubjectIsRequired'; @@ -314,6 +311,9 @@ class CMailFile } } + dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); + // We set all data according to choosed sending method. // We also set a value for ->msgid if ($this->sendmode == 'mail') { From f24ffe5b91da2b2a3187cf4a98a8ad4ac41645b6 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 16 Feb 2023 10:20:37 +0100 Subject: [PATCH 44/97] Supplier proposal - List - SQL error on total_ht --- htdocs/supplier_proposal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index ba68fb82a77..c179b44146e 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -344,7 +344,7 @@ if ($search_login) { $sql .= natural_search(array('u.lastname', 'u.firstname', 'u.login'), $search_login); } if ($search_montant_ht) { - $sql .= natural_search('sp.total_ht=', $search_montant_ht, 1); + $sql .= natural_search('sp.total_ht', $search_montant_ht, 1); } if ($search_montant_vat != '') { $sql .= natural_search("sp.total_tva", $search_montant_vat, 1); From 9e1b8bcd4ca7aa6e53730a9e9147a2ae6cc2e004 Mon Sep 17 00:00:00 2001 From: GregM Date: Thu, 16 Feb 2023 11:33:43 +0100 Subject: [PATCH 45/97] FIX parse error and NAN --- htdocs/compta/resultat/result.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index bf7eee28609..4d2aa61673f 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -333,6 +333,9 @@ if ($modecompta == 'CREANCES-DETTES') { // Previous Fiscal year (N-1) foreach ($sommes as $code => $det) { + if (is_null($det['NP'])){ + $det['NP'] = 0; + } $vars[$code] = $det['NP']; } @@ -340,8 +343,11 @@ if ($modecompta == 'CREANCES-DETTES') { //var_dump($result); //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1, 1, '1'); - //var_dump($r); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; @@ -360,6 +366,9 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; $sommes[$code]['N'] += $r; @@ -374,6 +383,9 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; $sommes[$code]['M'][$k] += $r; @@ -388,6 +400,9 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; $sommes[$code]['M'][$k] += $r; @@ -416,8 +431,10 @@ if ($modecompta == 'CREANCES-DETTES') { $arrayofaccountforfilter = array(); - foreach ($cpts as $i => $cpt) { // Loop on each account. - $arrayofaccountforfilter[] = $cpt['account_number']; + foreach ($cpts as $i => $cpt) {// Loop on each account. + if (!empty($cpt['account_number'])){ + $arrayofaccountforfilter[] = $cpt['account_number']; + } } // N-1 From 390e7c83b2ae12861b3c43d90da8c8b97174e0a9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 16 Feb 2023 10:48:41 +0000 Subject: [PATCH 46/97] Fixing style errors. --- htdocs/compta/resultat/result.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 4d2aa61673f..1a31c3d7eb1 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -333,7 +333,7 @@ if ($modecompta == 'CREANCES-DETTES') { // Previous Fiscal year (N-1) foreach ($sommes as $code => $det) { - if (is_null($det['NP'])){ + if (is_null($det['NP'])) { $det['NP'] = 0; } $vars[$code] = $det['NP']; @@ -345,7 +345,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, '1'); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -366,7 +366,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -383,7 +383,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -400,7 +400,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -432,7 +432,7 @@ if ($modecompta == 'CREANCES-DETTES') { $arrayofaccountforfilter = array(); foreach ($cpts as $i => $cpt) {// Loop on each account. - if (!empty($cpt['account_number'])){ + if (!empty($cpt['account_number'])) { $arrayofaccountforfilter[] = $cpt['account_number']; } } From 33e345a280ea993804ca0532776a547df6667d5a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 16 Feb 2023 15:51:55 +0100 Subject: [PATCH 47/97] FIX missing getEntity filter --- htdocs/core/lib/invoice.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 43e4879e62f..b532b9db108 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -281,13 +281,16 @@ function getNumberInvoicesPieChart($mode) $sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd15, 'Y-m-d')."'", 1, 0).") as nbnotlate15"; $sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd30, 'Y-m-d')."'", 1, 0).") as nbnotlate30"; if ($mode == 'customers') { + $element = 'invoice'; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; } elseif ($mode == 'fourn' || $mode == 'suppliers') { + $element = 'supplier_invoice'; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; } else { return ''; } - $sql .= " WHERE f.type <> 2"; + $sql .= " WHERE f.entity IN (".getEntity($element).")"; + $sql .= " AND f.type <> 2"; $sql .= " AND f.fk_statut = 1"; if (isset($user->socid) && $user->socid > 0) { $sql .= " AND f.fk_soc = ".((int) $user->socid); From 3a58e025badea87a7758d149d7d435b017032fc8 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 16 Feb 2023 21:44:38 +0100 Subject: [PATCH 48/97] better logs --- htdocs/core/class/CMailFile.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 47f8fd900cb..0269b25fd6c 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -142,6 +142,9 @@ class CMailFile { global $conf, $dolibarr_main_data_root, $user; + dol_syslog("CMailFile::CMailfile: charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); + // Clean values of $mimefilename_list if (is_array($mimefilename_list)) { foreach ($mimefilename_list as $key => $val) { @@ -311,8 +314,7 @@ class CMailFile } } - dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); - dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." addr_bcc=$addr_bcc, replyto=$replyto", LOG_DEBUG); // We set all data according to choosed sending method. // We also set a value for ->msgid From 86e2f46fe7a4cebc24de3039c23e4e07891ac82b Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 16 Feb 2023 21:46:27 +0100 Subject: [PATCH 49/97] addr_bcc could be set --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 0269b25fd6c..90c16dc589f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -142,7 +142,7 @@ class CMailFile { global $conf, $dolibarr_main_data_root, $user; - dol_syslog("CMailFile::CMailfile: charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); // Clean values of $mimefilename_list From bf9a44ac6faab0ef0abeda1d329011c14236b0fe Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 16 Feb 2023 21:48:55 +0100 Subject: [PATCH 50/97] msg is not defined --- htdocs/core/class/CMailFile.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 67c3387fbc8..f16bfb856b1 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -60,6 +60,7 @@ class CMailFile public $atleastonefile; + public $msg; public $eol; public $eol2; From e212019ddf353b637ba8298a237a8da1dcbb65fd Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 17 Feb 2023 00:10:00 +0100 Subject: [PATCH 51/97] FIX: SQL error "unknown column p.fk_soc" because ANSI-92 joins take precedence over ANSI-89 joins cf. https://stackoverflow.com/questions/4065985/mysql-unknown-column-in-on-clause --- htdocs/comm/propal/class/propalestats.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 52956fa46fd..834ecd2bacb 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -248,7 +248,7 @@ class PropaleStats extends Stats global $user; $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; - $sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; + $sql .= " FROM (".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product)"; if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } From c3e42f1961a4d46d0c1b40553727eebcf7be12de Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 17 Feb 2023 16:12:06 +0100 Subject: [PATCH 52/97] Propale stats: replace old-style joins with inner joins --- .../comm/propal/class/propalestats.class.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 834ecd2bacb..eb699e01c86 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -247,17 +247,19 @@ class PropaleStats extends Stats { global $user; - $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; - $sql .= " FROM (".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product)"; - if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + $sql = 'SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.' . $this->field_line . ') as total, AVG(tl.' . $this->field_line . ') as avg'; + $sql .= ' FROM ' . $this->from; + $sql .= ' INNER JOIN ' . $this->from_line . ' ON p.rowid = tl.fk_propal'; + $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'product as product ON tl.fk_product = product.rowid'; + if (empty($user->rights->societe->client->voir) && ! $user->socid) { + $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ' . ((int) $user->id); } $sql .= $this->join; - $sql .= " WHERE ".$this->where; - $sql .= " AND p.rowid = tl.fk_propal AND tl.fk_product = product.rowid"; - $sql .= " AND ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'"; - $sql .= " GROUP BY product.ref"; + $sql .= ' WHERE ' . $this->where; + $sql .= ' AND ' . $this->field_date . " BETWEEN '" . $this->db->idate(dol_get_first_day($year, 1, false)) . "' AND '" . $this->db->idate(dol_get_last_day($year, 12, false)) . "'"; + $sql .= ' GROUP BY product.ref'; $sql .= $this->db->order('nb', 'DESC'); + //$sql.= $this->db->plimit(20); return $this->_getAllByProduct($sql, $limit); From 992fe1286d5b17f83e2248e98f4df80eb430de18 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 18 Feb 2023 16:08:19 +0100 Subject: [PATCH 53/97] FIX request new password with "mc" and "twofactor" authentication --- htdocs/user/class/user.class.php | 3 +++ htdocs/user/passwordforgotten.php | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 9a495a04a91..9ee9bcae43e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2425,6 +2425,9 @@ class User extends CommonObject //print $password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id; $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword'; $url .= '&username='.urlencode($this->login)."&passworduidhash=".urlencode(dol_hash($password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id)); + if (!empty($conf->multicompany->enabled)) { + $url .= '&entity='.(!empty($user->entity) ? $user->entity : 1); + } $msgishtml = 1; diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index dabac0727dc..c529dcc0e19 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -87,7 +87,7 @@ if (empty($reshook)) { // Validate new password if ($action == 'validatenewpassword' && $username && $passworduidhash) { $edituser = new User($db); - $result = $edituser->fetch('', $username); + $result = $edituser->fetch('', $username, '', 0, $conf->entity); if ($result < 0) { $message = '
'.dol_escape_htmltag($langs->trans("ErrorLoginDoesNotExists", $username)).'
'; } else { @@ -122,9 +122,9 @@ if (empty($reshook)) { $isanemail = preg_match('/@/', $username); $edituser = new User($db); - $result = $edituser->fetch('', $username, '', 1); + $result = $edituser->fetch('', $username, '', 1, $conf->entity); if ($result == 0 && $isanemail) { - $result = $edituser->fetch('', '', '', 1, -1, $username); + $result = $edituser->fetch('', '', '', 1, $conf->entity, $username); } if ($result <= 0 && $edituser->error == 'USERNOTFOUND') { From 5b81880b9721f4ddb26725887c3b98e5d12354e3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 18 Feb 2023 16:24:56 +0100 Subject: [PATCH 54/97] FIX object $user is not defined --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 9ee9bcae43e..f5566cc30e7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2426,7 +2426,7 @@ class User extends CommonObject $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword'; $url .= '&username='.urlencode($this->login)."&passworduidhash=".urlencode(dol_hash($password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id)); if (!empty($conf->multicompany->enabled)) { - $url .= '&entity='.(!empty($user->entity) ? $user->entity : 1); + $url .= '&entity='.(!empty($this->entity) ? $this->entity : 1); } $msgishtml = 1; From 50721f8df3eb8399930d4f7b7dd2c5e3e1012a39 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 18 Feb 2023 16:31:59 +0100 Subject: [PATCH 55/97] TODO object $user parameter is not use in send_password() ! --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f5566cc30e7..752cbf15c34 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2359,7 +2359,7 @@ class User extends CommonObject /** * Send new password by email * - * @param User $user Object user that send the email (not the user we send too) + * @param User $user Object user that send the email (not the user we send too) @todo object $user is not used ! * @param string $password New password * @param int $changelater 0=Send clear passwod into email, 1=Change password only after clicking on confirm email. @todo Add method 2 = Send link to reset password * @return int < 0 si erreur, > 0 si ok From 35d496de3876859952774cdb1a280b0ca22519ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 02:41:53 +0100 Subject: [PATCH 56/97] Update user.class.php --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 752cbf15c34..3329e4fe71e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2359,7 +2359,7 @@ class User extends CommonObject /** * Send new password by email * - * @param User $user Object user that send the email (not the user we send too) @todo object $user is not used ! + * @param User $user Object user that send the email (not the user we send to) @todo object $user is not used ! * @param string $password New password * @param int $changelater 0=Send clear passwod into email, 1=Change password only after clicking on confirm email. @todo Add method 2 = Send link to reset password * @return int < 0 si erreur, > 0 si ok From 80199faf1acffa0c92e9b0bb8d01e5362bcce700 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 20 Feb 2023 11:27:14 +0100 Subject: [PATCH 57/97] FIX filter sql accounting account --- .../accountancy/class/accountancycategory.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 7ae48c749c2..4d825d721c9 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -861,20 +861,29 @@ class AccountancyCategory // extends CommonObject exit(); } + $pcgverid = $conf->global->CHARTOFACCOUNTS; + $pcgvercode = dol_getIdFromCode($this->db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version'); + if(empty($pcgvercode)) { + $pcgvercode = $pcgverid; + } + if (!empty($cat_id)) { $sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t"; $sql .= " WHERE t.fk_accounting_category = ".((int) $cat_id); $sql .= " AND t.entity = ".$conf->entity; + $sql .= " AND t.active = 1"; + $sql .= " AND t.fk_pcg_version = '".$pcgvercode."'"; $sql .= " ORDER BY t.account_number"; } else { $sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t"; $sql .= " WHERE ".$predefinedgroupwhere; $sql .= " AND t.entity = ".$conf->entity; + $sql .= ' AND t.active = 1'; + $sql .= " AND t.fk_pcg_version = '".$pcgvercode."'"; $sql .= " ORDER BY t.account_number"; } - //echo $sql; $resql = $this->db->query($sql); if ($resql) { From 66b5917013a914946be71d2708bb0a8dc9d85e26 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 20 Feb 2023 10:50:52 +0000 Subject: [PATCH 58/97] Fixing style errors. --- htdocs/accountancy/class/accountancycategory.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 4d825d721c9..22064092c4e 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -863,7 +863,7 @@ class AccountancyCategory // extends CommonObject $pcgverid = $conf->global->CHARTOFACCOUNTS; $pcgvercode = dol_getIdFromCode($this->db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version'); - if(empty($pcgvercode)) { + if (empty($pcgvercode)) { $pcgvercode = $pcgverid; } From b9fc6d5a2f10369f9a051b5bb9e36481cd957320 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 20 Feb 2023 12:01:42 +0100 Subject: [PATCH 59/97] fix travis --- htdocs/accountancy/class/accountancycategory.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 4d825d721c9..038071a21f9 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -873,7 +873,7 @@ class AccountancyCategory // extends CommonObject $sql .= " WHERE t.fk_accounting_category = ".((int) $cat_id); $sql .= " AND t.entity = ".$conf->entity; $sql .= " AND t.active = 1"; - $sql .= " AND t.fk_pcg_version = '".$pcgvercode."'"; + $sql .= " AND t.fk_pcg_version = '".$this->db->escape($pcgvercode)."'"; $sql .= " ORDER BY t.account_number"; } else { $sql = "SELECT t.rowid, t.account_number, t.label as account_label"; @@ -881,7 +881,7 @@ class AccountancyCategory // extends CommonObject $sql .= " WHERE ".$predefinedgroupwhere; $sql .= " AND t.entity = ".$conf->entity; $sql .= ' AND t.active = 1'; - $sql .= " AND t.fk_pcg_version = '".$pcgvercode."'"; + $sql .= " AND t.fk_pcg_version = '".$this->db->escape($pcgvercode)."'"; $sql .= " ORDER BY t.account_number"; } From 9d43d51888111d944232af3180c364eff8e82ede Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 20 Feb 2023 12:57:14 +0100 Subject: [PATCH 60/97] FIX: #23966 Error "Param dbt_keyfield is required but not defined" --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 798ba265643..18db40e0d87 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -682,7 +682,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl // Array to define rules of checks to do $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object - $checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). + $checkother = array('contact', 'agenda', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet', 'project'); // Test for project object $checktask = array('projet_task'); // Test for task object $checkhierarchy = array('expensereport', 'holiday'); From 1f3aa24c8a27e6e851829057bbf668c4f68bbb4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 16:56:16 +0100 Subject: [PATCH 61/97] Fix missing date delivery on invoice --- htdocs/core/lib/pdf.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index fef33262a0f..86ed5fb107d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2386,6 +2386,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] .= ' / '; $linkedobjects[$objecttype]['ref_value'] .= $outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_delivery, 'day', '', $outputlangs); } else { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending"); if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''); From 70c99b1f7937ec8b73360e31999e03a85997b975 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 18:32:36 +0100 Subject: [PATCH 62/97] Fix pdf --- htdocs/core/lib/pdf.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 86ed5fb107d..7a80193b221 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2386,11 +2386,12 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] .= ' / '; $linkedobjects[$objecttype]['ref_value'] .= $outputlangs->transnoentities($elementobject->ref); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_delivery, 'day', '', $outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping, 'day', '', $outputlangs); } else { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending"); if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''); $linkedobjects[$objecttype]['ref_value'] .= ' / '.$outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['date_value'] = dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping, 'day', '', $outputlangs); } } } From 07036453044f66811ad92b44f6c98284aecc9134 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 20:47:35 +0100 Subject: [PATCH 63/97] Fix missing protection on ajax public ticket page --- htdocs/public/ticket/ajax/ajax.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/public/ticket/ajax/ajax.php b/htdocs/public/ticket/ajax/ajax.php index a75c796539c..0ddc6529996 100644 --- a/htdocs/public/ticket/ajax/ajax.php +++ b/htdocs/public/ticket/ajax/ajax.php @@ -57,6 +57,14 @@ $action = GETPOST('action', 'aZ09'); $id = GETPOST('id', 'int'); $email = GETPOST('email', 'alphanohtml'); +if (!isModEnabled('ticket')) { + httponly_accessforbidden('Module Ticket not enabled'); +} + +if (empty($conf->global->TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST)) { + httponly_accessforbidden('Option TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST of module ticket is not enabled'); +} + /* * View From be82f51f68d738cce205f4ce5b469ef42ed82d9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 20:50:26 +0100 Subject: [PATCH 64/97] Fix regression --- htdocs/public/ticket/ajax/ajax.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/public/ticket/ajax/ajax.php b/htdocs/public/ticket/ajax/ajax.php index 0ddc6529996..e125b0122e7 100644 --- a/htdocs/public/ticket/ajax/ajax.php +++ b/htdocs/public/ticket/ajax/ajax.php @@ -57,12 +57,13 @@ $action = GETPOST('action', 'aZ09'); $id = GETPOST('id', 'int'); $email = GETPOST('email', 'alphanohtml'); + if (!isModEnabled('ticket')) { - httponly_accessforbidden('Module Ticket not enabled'); + accessforbidden('', 0, 0, 1); } if (empty($conf->global->TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST)) { - httponly_accessforbidden('Option TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST of module ticket is not enabled'); + accessforbidden('', 0, 0, 1); } From 1555e0242b64ada57d1573fa8343fce1a2093d41 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Feb 2023 10:28:30 +0100 Subject: [PATCH 65/97] FIX label dictionary is used by barcode and member module --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index ed5e4c06b3d..e6af95d77cb 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -512,7 +512,7 @@ $tabcond[25] = !empty($conf->website->enabled); $tabcond[27] = !empty($conf->societe->enabled); $tabcond[28] = !empty($conf->holiday->enabled); $tabcond[29] = !empty($conf->project->enabled); -$tabcond[30] = !empty($conf->label->enabled); +$tabcond[30] = (isModEnabled('barcode') || isModEnabled('adherent')); //$tabcond[31]= !empty($conf->accounting->enabled); $tabcond[32] = (!empty($conf->holiday->enabled) || !empty($conf->hrm->enabled)); $tabcond[33] = !empty($conf->hrm->enabled); From 08bcd4af319548bcd874c4e12339e3aa54f5541d Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 22 Feb 2023 12:19:36 +0100 Subject: [PATCH 66/97] FIX : mandatory date for service didnt work for invoice --- htdocs/core/tpl/objectline_view.tpl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index c4ddc7d0c4c..7489d99a765 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -182,10 +182,11 @@ if (($line->info_bits & 2) == 2) { if ($line->date_start || $line->date_end) { print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; } + if (!$line->date_start || !$line->date_end) { // show warning under line // we need to fetch product associated to line for some test - if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') { + if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'facture' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') { $res = $line->fetch_product(); if ($res > 0 ) { if ($line->product->isService() && $line->product->isMandatoryPeriod()) { From f1a7b5b0b4766b2b33ada22ff2ead165bbef1868 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 13:53:46 +0100 Subject: [PATCH 67/97] Update dict.php --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e6af95d77cb..774ade233bd 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -512,7 +512,7 @@ $tabcond[25] = !empty($conf->website->enabled); $tabcond[27] = !empty($conf->societe->enabled); $tabcond[28] = !empty($conf->holiday->enabled); $tabcond[29] = !empty($conf->project->enabled); -$tabcond[30] = (isModEnabled('barcode') || isModEnabled('adherent')); +$tabcond[30] = (isModEnabled('label') || isModEnabled('barcode') || isModEnabled('adherent')); // stickers format dictionary //$tabcond[31]= !empty($conf->accounting->enabled); $tabcond[32] = (!empty($conf->holiday->enabled) || !empty($conf->hrm->enabled)); $tabcond[33] = !empty($conf->hrm->enabled); From e7546e6da1baf5f71f5f31845ff64048c53e0d74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 14:29:36 +0100 Subject: [PATCH 68/97] FIX #23804 --- htdocs/core/class/html.formticket.class.php | 1 + htdocs/ticket/card.php | 3 ++- htdocs/ticket/class/ticket.class.php | 7 ++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index cd6b9ecd7fc..6b54ee86c33 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -164,6 +164,7 @@ class FormTicket print '
'; print ''; print ''; + print ''; foreach ($this->param as $key => $value) { print ''; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 1b3dd4c8e37..334dcdf6aa4 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -266,7 +266,7 @@ if (empty($reshook)) { if (!$error) { // File transfer - $object->copyFilesForTicket(); + $object->copyFilesForTicket(''); // trackid is forced to '' because files were uploaded when no id for ticket exists yet and trackid was '' } if (!$error) { @@ -689,6 +689,7 @@ if ($action == 'create' || $action == 'presend') { print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket'); + $formticket->trackid = ''; // TODO Use a unique key to avoid conflict in upload file feature $formticket->withfromsocid = $socid ? $socid : $user->socid; $formticket->withfromcontactid = $contactid ? $contactid : ''; $formticket->withtitletopic = 1; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 122c5ae35ab..7e3d17dc32d 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2437,9 +2437,10 @@ class Ticket extends CommonObject * Used for files linked into messages. * Files may be renamed during copy to avoid overwriting existing files. * - * @return array Array with final path/name/mime of files. + * @param string $forcetrackid Force trackid + * @return array Array with final path/name/mime of files. */ - public function copyFilesForTicket() + public function copyFilesForTicket($forcetrackid = null) { global $conf; @@ -2454,7 +2455,7 @@ class Ticket extends CommonObject $maxheightmini = 72; $formmail = new FormMail($this->db); - $formmail->trackid = 'tic'.$this->id; + $formmail->trackid = (is_null($forcetrackid) ? 'tic'.$this->id : ''); $attachedfiles = $formmail->get_attached_files(); $filepath = $attachedfiles['paths']; From d326e59beba5e5d997384f323f6f22c57c55a17e Mon Sep 17 00:00:00 2001 From: pratushraj Date: Thu, 23 Feb 2023 13:00:31 +0530 Subject: [PATCH 69/97] issue #24014 --- htdocs/projet/class/task.class.php | 9 ++++++--- htdocs/projet/tasks.php | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 87ab0afdc47..3c58a147d39 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -813,7 +813,7 @@ class Task extends CommonObjectLine * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action * @return array Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1) + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '') { global $conf, $hookmanager; @@ -953,8 +953,11 @@ class Task extends CommonObjectLine } } - - $sql .= " ORDER BY p.ref, t.rang, t.dateo"; + if($sortfield && $sortorder) { + $sql .= $this->db->order($sortfield, $sortorder); + } else { + $sql .= " ORDER BY p.ref, t.rang, t.dateo"; + } //print $sql;exit; dol_syslog(get_class($this)."::getTasksArray", LOG_DEBUG); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index ffba37abb7d..22258bd3b18 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -124,12 +124,12 @@ $search_array_options = $extrafields->getOptionalsFromPost($taskstatic->table_el // Default sort order (if not yet defined by previous GETPOST) -if (!$sortfield) { +/* if (!$sortfield) { reset($object->fields); $sortfield="t.".key($object->fields); } // Set here default search field. By default 1st field in definition. Reset is required to avoid key() to return null. if (!$sortorder) { $sortorder = "ASC"; -} +} */ // Security check @@ -848,7 +848,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). $filteronthirdpartyid = $socid; - $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, $extrafields, 1, $search_array_options); + $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, $extrafields, 1, $search_array_options, 0, 1, $sortfield, $sortorder); // We load also tasks limited to a particular user $tmpuser = new User($db); @@ -998,41 +998,41 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; // print ''.$langs->trans("Project").''; if (!empty($arrayfields['t.ref']['checked'])) { - print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, ''); + print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], 't.ref', '', $param, '', $sortfield, $sortorder, ''); } if (!empty($arrayfields['t.label']['checked'])) { - print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, ''); + print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", '', $param, '', $sortfield, $sortorder, ''); } if (!empty($arrayfields['t.description']['checked'])) { print_liste_field_titre($arrayfields['t.description']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, ''); } if (!empty($arrayfields['t.dateo']['checked'])) { - print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", '', $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['t.datee']['checked'])) { - print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", '', $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['t.planned_workload']['checked'])) { - print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); + print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.duration_effective']['checked'])) { - print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); + print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.progress_calculated']['checked'])) { print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.progress']['checked'])) { - print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); + print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.progress_summary']['checked'])) { print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', '', 1); } if ($object->usage_bill_time) { if (!empty($arrayfields['t.tobill']['checked'])) { - print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "t.tobill", '', $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['t.billed']['checked'])) { - print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "t.billed", '', $param, '', $sortfield, $sortorder, 'right '); } } // Contacts of task, disabled because available by default jsut after @@ -1043,7 +1043,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third */ if (!empty($arrayfields['t.budget_amount']['checked'])) { - print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "t.budget_amount", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['c.assigned']['checked'])) { From af4228064d95a44e62ac9b4342e0d6955d4f87a4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Feb 2023 07:33:16 +0000 Subject: [PATCH 70/97] Fixing style errors. --- htdocs/projet/class/task.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 3c58a147d39..fea80f6d13a 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -953,7 +953,7 @@ class Task extends CommonObjectLine } } - if($sortfield && $sortorder) { + if ($sortfield && $sortorder) { $sql .= $this->db->order($sortfield, $sortorder); } else { $sql .= " ORDER BY p.ref, t.rang, t.dateo"; From b29ebef05fc8394e65196fc5baf8dcb798b7d1cf Mon Sep 17 00:00:00 2001 From: atm-florian Date: Thu, 23 Feb 2023 18:03:00 +0100 Subject: [PATCH 71/97] Propale stats: reworking of the fix to comply with travis rule for SQL string building --- .../comm/propal/class/propalestats.class.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index eb699e01c86..fefc8941970 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -247,19 +247,18 @@ class PropaleStats extends Stats { global $user; - $sql = 'SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.' . $this->field_line . ') as total, AVG(tl.' . $this->field_line . ') as avg'; - $sql .= ' FROM ' . $this->from; - $sql .= ' INNER JOIN ' . $this->from_line . ' ON p.rowid = tl.fk_propal'; - $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'product as product ON tl.fk_product = product.rowid'; - if (empty($user->rights->societe->client->voir) && ! $user->socid) { - $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ' . ((int) $user->id); + $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; + $sql .= " FROM ".$this->from; + $sql .= " INNER JOIN ".$this->from_line." ON p.rowid = tl.fk_propal"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid"; + if (empty($user->rights->societe->client->voir) && !$user->socid) { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; - $sql .= ' WHERE ' . $this->where; - $sql .= ' AND ' . $this->field_date . " BETWEEN '" . $this->db->idate(dol_get_first_day($year, 1, false)) . "' AND '" . $this->db->idate(dol_get_last_day($year, 12, false)) . "'"; - $sql .= ' GROUP BY product.ref'; + $sql .= " WHERE ".$this->where; + $sql .= " AND ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'"; + $sql .= " GROUP BY product.ref"; $sql .= $this->db->order('nb', 'DESC'); - //$sql.= $this->db->plimit(20); return $this->_getAllByProduct($sql, $limit); From 7ec32d2458807731446be5c0f8cc214c9cbd23cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 21:28:58 +0100 Subject: [PATCH 72/97] Fix phpunit --- htdocs/projet/class/task.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index fea80f6d13a..7ff5d651fed 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -811,6 +811,8 @@ class Task extends CommonObjectLine * @param array $search_array_options Array of search * @param int $loadextras Fetch all Extrafields on each task * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action + * @param string $sortfield Sort field + * @param string $sortorder Sort order * @return array Array of tasks */ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '') From f140036f37389341da450d7a1c84e2a43cd543dd Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 24 Feb 2023 15:59:43 +0100 Subject: [PATCH 73/97] FIX shipping list for external user --- htdocs/expedition/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 9b55ff46c14..4c6a764997b 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -71,7 +71,6 @@ $search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_e $search_datereceipt_start = dol_mktime(0, 0, 0, GETPOST('search_datereceipt_startmonth', 'int'), GETPOST('search_datereceipt_startday', 'int'), GETPOST('search_datereceipt_startyear', 'int')); $search_datereceipt_end = dol_mktime(23, 59, 59, GETPOST('search_datereceipt_endmonth', 'int'), GETPOST('search_datereceipt_endday', 'int'), GETPOST('search_datereceipt_endyear', 'int')); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); -$socid = GETPOST('socid', 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); $search_categ_cus = GETPOST("search_categ_cus", 'int'); From 3c58b1cfc75a4e44ca37630186d66922ab749285 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 24 Feb 2023 16:28:15 +0100 Subject: [PATCH 74/97] add comment for Travis to play it again sam --- htdocs/expedition/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 4c6a764997b..3b653aaf17b 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -5,6 +5,7 @@ * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Thibault FOUCART + * Copyright (C) 2023 Christophe Battarel * * 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 From fd371cc52b517ea26f50d588cc2c8cf19bc520ce Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Fri, 24 Feb 2023 23:31:06 +0100 Subject: [PATCH 75/97] Fix member nature display in new.php --- htdocs/public/members/new.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index d3a2a556b07..aa8498a85a1 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -539,6 +539,8 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { // Moral/Physic attribute $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); +print ''.$langs->trans('MemberNature').' *'."\n"; + if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { print ''.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); From a02e88dc281c0545150ecc7e9f2716a0787208a4 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Sun, 26 Feb 2023 22:18:30 +0100 Subject: [PATCH 76/97] Drop the double Must be displayed both in the if and else --- htdocs/public/members/new.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index aa8498a85a1..2df2ec45cbc 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -542,7 +542,6 @@ $morphys["mor"] = $langs->trans("Moral"); print ''.$langs->trans('MemberNature').' *'."\n"; if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { - print ''.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print ''."\n"; } else { From 4877c80c360c78f4bf85192948a44b0238de0a7e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 28 Feb 2023 16:44:32 +0100 Subject: [PATCH 77/97] FIX missing "authorid" for getNomUrl link right access --- htdocs/comm/action/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index b5ec104d02f..8a75dbe9337 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -412,7 +412,7 @@ if ($usergroup > 0) { } $sql .= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail,"; $sql .= " a.id, a.code, a.label, a.note, a.datep as dp, a.datep2 as dp2, a.fulldayevent, a.location,"; -$sql .= ' a.fk_user_author,a.fk_user_action,'; +$sql .= ' a.fk_user_author, a.fk_user_action,'; $sql .= " a.fk_contact, a.note, a.percent as percent,"; $sql .= " a.fk_element, a.elementtype, a.datec, a.tms as datem,"; $sql .= " c.code as type_code, c.libelle as type_label, c.color as type_color, c.type as type_type, c.picto as type_picto,"; @@ -916,6 +916,7 @@ while ($i < $imaxinloop) { $actionstatic->note_private = dol_htmlentitiesbr($obj->note); $actionstatic->datep = $db->jdate($obj->dp); $actionstatic->percentage = $obj->percent; + $actionstatic->authorid = $obj->fk_user_author; // Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid // but only if we need it From 0ddb4eb9b267125b550658f35eeae31355380d83 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 2 Mar 2023 11:51:06 +0100 Subject: [PATCH 78/97] FIX: expense reports: error when selecting mileage fees expense type if MAIN_USE_EXPENSE_IK disabled --- htdocs/expensereport/card.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 20cd4f5227e..73bb84f5feb 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2594,8 +2594,8 @@ if ($action == 'create') { print ''; print ''; - //var_dump($object); - print '