From 29a7a410c8c79ca0cc0e49af5df2f013b21d2480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 28 Nov 2024 13:28:34 +0100 Subject: [PATCH 1/5] backport of https://github.com/Dolibarr/dolibarr/pull/32080 backport of fix part --- htdocs/ticket/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 704fa880adc..9e69271f09c 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -375,6 +375,7 @@ if ($socid > 0) { } foreach ($search as $key => $val) { + $tmpkey = 't.' . $key; if ($key == 'fk_statut' && !empty($search['fk_statut'])) { $newarrayofstatus = array(); foreach ($search['fk_statut'] as $key2 => $val2) { @@ -396,18 +397,18 @@ foreach ($search as $key => $val) { $newarrayofstatus[] = Ticket::STATUS_CANCELED; } if (count($newarrayofstatus)) { - $sql .= natural_search($key, join(',', $newarrayofstatus), 2); + $sql .= natural_search($tmpkey, join(',', $newarrayofstatus), 2); } continue; } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project') { if ($search[$key] > 0) { - $sql .= natural_search($key, $search[$key], 2); + $sql .= natural_search($tmpkey, $search[$key], 2); } continue; } elseif ($key == 'type_code') { $newarrayoftypecodes = is_array($search[$key]) ? $search[$key] : (!empty($search[$key]) ? explode(',', $search[$key]) : array()); if (count($newarrayoftypecodes)) { - $sql .= natural_search($key, join(',', $newarrayoftypecodes), 3); + $sql .= natural_search($tmpkey, join(',', $newarrayoftypecodes), 3); } continue; } @@ -415,7 +416,7 @@ foreach ($search as $key => $val) { $mode_search = ((!empty($object->fields[$key]) && ($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))) ? 1 : 0); // $search[$key] can be an array of values, or a string. We add filter if array not empty or if it is a string. if ((is_array($search[$key]) && !empty($search[$key])) || (!is_array($search[$key]) && $search[$key] != '')) { - $sql .= natural_search($key, $search[$key], $mode_search); + $sql .= natural_search($tmpkey, $search[$key], $mode_search); } } if ($search_all) { @@ -425,7 +426,7 @@ if ($search_societe) { $sql .= natural_search('s.nom', $search_societe); } if ($search_fk_project > 0) { - $sql .= natural_search('fk_project', $search_fk_project, 2); + $sql .= natural_search('t.fk_project', $search_fk_project, 2); } if ($search_date_start) { $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'"; From 0e1744a6ec6757b5402f15d5f46ba0899accc558 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Sun, 1 Dec 2024 10:24:25 +0100 Subject: [PATCH 2/5] throw RestException(500) if update of invoice fails #32134 --- htdocs/compta/facture/class/api_invoices.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index d48740ea68d..9a9320e4897 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -632,8 +632,10 @@ class Invoices extends DolibarrApi } } - if ($this->invoice->update(DolibarrApiAccess::$user)) { + if ($this->invoice->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); + } else { + throw new RestException(500, $this->invoice->error); } return false; From e6712300d544dac04dd4c95a075cf8e0b9d33727 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Mon, 2 Dec 2024 07:29:18 +0100 Subject: [PATCH 3/5] phan fix, remove code never reached --- htdocs/compta/facture/class/api_invoices.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 4f8dfbd04e6..26a609da09b 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -637,8 +637,6 @@ class Invoices extends DolibarrApi } else { throw new RestException(500, $this->invoice->error); } - - return false; } /** From d8fecc1522a4c094162ef6b4d745c9048c48a9aa Mon Sep 17 00:00:00 2001 From: Quentin VIAL--GOUTEYRON Date: Tue, 3 Dec 2024 08:39:34 +0100 Subject: [PATCH 4/5] FIX : in projet/element.php total_time is always back to 0 --- htdocs/projet/element.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index ed14a6791bf..52b82e5756d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1193,6 +1193,7 @@ foreach ($listofreferent as $key => $value) { } $num = count($elementarray); + $total_time = 0; for ($i = 0; $i < $num; $i++) { $tmp = explode('_', $elementarray[$i]); $idofelement = $tmp[0]; @@ -1310,7 +1311,7 @@ foreach ($listofreferent as $key => $value) { print "\n"; // Date or TimeSpent - $date = ''; $total_time_by_line = null; $total_time = 0; + $date = ''; $total_time_by_line = null; if ($tablename == 'expensereport_det') { $date = $element->date; // No draft status on lines } elseif ($tablename == 'stock_mouvement') { From f5c715c6a79a787cef811d92163f66310a38a047 Mon Sep 17 00:00:00 2001 From: tnegre Date: Tue, 3 Dec 2024 15:05:39 +0100 Subject: [PATCH 5/5] Ticket : don't autofill search field for ticket type on multiselect --- htdocs/core/class/html.formticket.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index f30da8bc8b0..8920b259489 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -716,7 +716,7 @@ class FormTicket $ticketstat->loadCacheTypesTickets(); print '