From 3a8fbd3aa8dfbb8847abbe5e162a29ddbcb633ab Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 6 Feb 2023 10:32:54 +0100 Subject: [PATCH 001/107] update --- htdocs/comm/action/card.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 545088e47e9..1412890b3d8 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -142,9 +142,6 @@ if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) { $TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes')); $result = restrictedArea($user, 'agenda', $object->id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); -if ($user->socid && $socid) { - $result = restrictedArea($user, 'societe', $socid); -} /* From 6163f84d258df4cf87e01cebdf7b11a549bbe9b1 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 15 Feb 2023 22:10:03 +0100 Subject: [PATCH 002/107] 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 3a58e025badea87a7758d149d7d435b017032fc8 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 16 Feb 2023 21:44:38 +0100 Subject: [PATCH 003/107] 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 004/107] 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 e212019ddf353b637ba8298a237a8da1dcbb65fd Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 17 Feb 2023 00:10:00 +0100 Subject: [PATCH 005/107] 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 006/107] 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 80199faf1acffa0c92e9b0bb8d01e5362bcce700 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 20 Feb 2023 11:27:14 +0100 Subject: [PATCH 007/107] 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 008/107] 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 009/107] 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 36e73280bf50d85e5503131d5fc3ba81bb0f91aa Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 20 Feb 2023 12:51:15 +0100 Subject: [PATCH 010/107] 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..264ed290f58 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 9d43d51888111d944232af3180c364eff8e82ede Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 20 Feb 2023 12:57:14 +0100 Subject: [PATCH 011/107] 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 012/107] 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 013/107] 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 014/107] 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 015/107] 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 016/107] 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 017/107] 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 018/107] 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 019/107] 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 020/107] 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 021/107] 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 022/107] 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 023/107] 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 024/107] 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 025/107] 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 026/107] 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 027/107] 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 b191330a79011f2c41392373aaeb656e80ec06bb Mon Sep 17 00:00:00 2001 From: David Pareja Rodriguez Date: Tue, 28 Feb 2023 13:24:11 +0100 Subject: [PATCH 028/107] Ignore localtaxes if localtax1_type or localtax2_type is 0 --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c275e4fd310..73bd7419a8c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5688,7 +5688,7 @@ function isOnlyOneLocalTax($local) function get_localtax_by_third($local) { global $db, $mysoc; - $sql = "SELECT t.localtax1, t.localtax2 "; + $sql = "SELECT t.localtax1_type, t.localtax2_type, t.localtax1, t.localtax2 "; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=t.fk_pays"; $sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND t.active = 1 AND t.taux=("; $sql .= " SELECT max(tt.taux) FROM ".MAIN_DB_PREFIX."c_tva as tt inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=tt.fk_pays"; @@ -5698,9 +5698,9 @@ function get_localtax_by_third($local) $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); - if ($local == 1) { + if ($local == 1 && $obj->localtax1_type > 0) { return $obj->localtax1; - } elseif ($local == 2) { + } elseif ($local == 2 && $obj->localtax2_type > 0) { return $obj->localtax2; } } From 590373a620495bcaf5561089e99ca03c3ef1babd Mon Sep 17 00:00:00 2001 From: David Pareja Rodriguez Date: Tue, 28 Feb 2023 13:33:52 +0100 Subject: [PATCH 029/107] Forgot to loop on the results --- htdocs/core/lib/functions.lib.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 73bd7419a8c..e2bbb122176 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5697,11 +5697,12 @@ function get_localtax_by_third($local) $resql = $db->query($sql); if ($resql) { - $obj = $db->fetch_object($resql); - if ($local == 1 && $obj->localtax1_type > 0) { - return $obj->localtax1; - } elseif ($local == 2 && $obj->localtax2_type > 0) { - return $obj->localtax2; + while ($obj = $db->fetch_object($resql)) { + if ($local == 1 && $obj->localtax1_type > 0) { + return $obj->localtax1; + } elseif ($local == 2 && $obj->localtax2_type > 0) { + return $obj->localtax2; + } } } From 4877c80c360c78f4bf85192948a44b0238de0a7e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 28 Feb 2023 16:44:32 +0100 Subject: [PATCH 030/107] 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 031/107] 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 '