From 5e887e885083a19101f62d858f4b0934869186b7 Mon Sep 17 00:00:00 2001 From: ThomasNgr-OpenDSI Date: Tue, 22 Apr 2025 11:48:22 +0200 Subject: [PATCH 1/8] Fix : on update of an order line, the TTC price would be used as HT price (#33940) * Fix : on update of an order line, the TTC price would be used as HT price * Update commande.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index dce7ec132b0..b88bd207f43 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3281,7 +3281,7 @@ class Commande extends CommonOrder $this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; $this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; $this->line->remise_percent = $remise_percent; - $this->line->subprice = $subprice; + $this->line->subprice = (float) $pu_ht; $this->line->info_bits = $info_bits; $this->line->special_code = $special_code; $this->line->total_ht = $total_ht; From c3b35d4da5773e6947ec738f723353dfa64b71d6 Mon Sep 17 00:00:00 2001 From: William Mead Date: Tue, 29 Apr 2025 06:40:04 +0200 Subject: [PATCH 2/8] Fixed PHPDoc. Added contributor details. (#33988) --- .../class/api_interventions.class.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 79f8991dc09..59407ce46bd 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -1,6 +1,7 @@ +/* Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Laurent Destailleur + * Copyright (C) 2025 William Mead * * 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 @@ -69,13 +70,14 @@ class Interventions extends DolibarrApi } /** - * Get properties of a Expense Report object - * Return an array with Expense Report information + * Get properties of an intervention object * - * @param int $id ID of Expense Report - * @return Object Object with cleaned properties + * Return an array with intervention information * - * @throws RestException + * @param int $id ID of intervention + * @return Object Intervention object with cleaned properties + * + * @throws RestException */ public function get($id) { @@ -300,9 +302,9 @@ class Interventions extends DolibarrApi } /** - * Delete order + * Delete intervention * - * @param int $id Order ID + * @param int $id Intervention ID * @return array */ public function delete($id) From 3929ef0bfa529b9703041689b770773594155f40 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Sun, 4 May 2025 10:50:33 +0200 Subject: [PATCH 3/8] FIX: accountancy: warning when account not found in plan (#34030) --- htdocs/accountancy/class/bookkeeping.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 855a61f76ca..db98ac28177 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -2147,7 +2147,7 @@ class BookKeeping extends CommonObject dol_syslog(get_class($this)."::select_account", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $obj = ''; + $obj = (object) array('label' => ''); if ($this->db->num_rows($resql)) { $obj = $this->db->fetch_object($resql); } From 8e0d3911e6e49d8807cb6675d9544b90dd533cf0 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Sun, 4 May 2025 11:19:59 +0200 Subject: [PATCH 4/8] FIX: pgsql: case sensitivity in select queries (#34028) --- htdocs/core/boxes/box_activity.php | 16 ++++++++-------- htdocs/core/boxes/box_validated_projects.php | 2 +- htdocs/product/index.php | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 144ca4e8f23..eb381294cf6 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -111,7 +111,7 @@ class box_activity extends ModeleBoxes $data = array(); - $sql = "SELECT p.fk_statut, SUM(p.total_ttc) as Mnttot, COUNT(*) as nb"; + $sql = "SELECT p.fk_statut, SUM(p.total_ttc) as mnttot, COUNT(*) as nb"; $sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -171,7 +171,7 @@ class box_activity extends ModeleBoxes $this->info_box_contents[$line][3] = array( 'td' => 'class="nowraponall right amount"', - 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), + 'text' => price($data[$j]->mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( 'td' => 'class="right" width="18"', @@ -200,7 +200,7 @@ class box_activity extends ModeleBoxes $data = array(); - $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb"; + $sql = "SELECT c.fk_statut, sum(c.total_ttc) as mnttot, count(*) as nb"; $sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -257,7 +257,7 @@ class box_activity extends ModeleBoxes $this->info_box_contents[$line][3] = array( 'td' => 'class="nowraponall right amount"', - 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), + 'text' => price($data[$j]->mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( 'td' => 'class="right" width="18"', @@ -285,7 +285,7 @@ class box_activity extends ModeleBoxes // part 1 $data = array(); - $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; + $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as mnttot, COUNT(*) as nb"; $sql .= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -342,7 +342,7 @@ class box_activity extends ModeleBoxes $this->info_box_contents[$line][3] = array( 'td' => 'class="nowraponall right amount"', - 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency) + 'text' => price($data[$j]->mnttot, 1, $langs, 0, 0, -1, $conf->currency) ); // We add only for the current year @@ -366,7 +366,7 @@ class box_activity extends ModeleBoxes // part 2 $data = array(); - $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; + $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as mnttot, COUNT(*) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql .= " WHERE f.entity IN (".getEntity('invoice').')'; $sql .= " AND f.fk_soc = s.rowid"; @@ -415,7 +415,7 @@ class box_activity extends ModeleBoxes $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( 'td' => 'class="nowraponall right amount"', - 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), + 'text' => price($data[$j]->mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( 'td' => 'class="right" width="18"', diff --git a/htdocs/core/boxes/box_validated_projects.php b/htdocs/core/boxes/box_validated_projects.php index 87944907352..ca038ed9915 100644 --- a/htdocs/core/boxes/box_validated_projects.php +++ b/htdocs/core/boxes/box_validated_projects.php @@ -180,7 +180,7 @@ class box_validated_projects extends ModeleBoxes $this->info_box_contents[$i][] = array( 'td' => 'class="center"', - 'text' => $objp->startDate, + 'text' => $objp->startdate, ); $this->info_box_contents[$i][] = array( diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 46f993f6373..18faf605e1f 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -453,7 +453,7 @@ function activitytrim($product_type) $yearofbegindate = date('Y', dol_time_plus_duree(time(), -3, "y")); // breakdown by quarter - $sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as Mnttot"; + $sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as mnttot"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " , ".MAIN_DB_PREFIX."paiement as p,".MAIN_DB_PREFIX."paiement_facture as pf"; $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; @@ -515,19 +515,19 @@ function activitytrim($product_type) } if ($objp->mois == "01" || $objp->mois == "02" || $objp->mois == "03") { - $trim1 += $objp->Mnttot; + $trim1 += $objp->mnttot; } if ($objp->mois == "04" || $objp->mois == "05" || $objp->mois == "06") { - $trim2 += $objp->Mnttot; + $trim2 += $objp->mnttot; } if ($objp->mois == "07" || $objp->mois == "08" || $objp->mois == "09") { - $trim3 += $objp->Mnttot; + $trim3 += $objp->mnttot; } if ($objp->mois == "10" || $objp->mois == "11" || $objp->mois == "12") { - $trim4 += $objp->Mnttot; + $trim4 += $objp->mnttot; } $i++; From 02588036c2ccef5621dfaa7ad5d8bb93f6ac01c1 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Sun, 4 May 2025 11:20:26 +0200 Subject: [PATCH 5/8] FIX: oauth: php 8 warnings (#34027) * FIX: oauth: fix php 8 warnings (backport of https://github.com/daviddesberg/PHPoAuthLib/commit/9edfb1d113964c3ad23f32a9eb781c42189d7136) * FIX: oauth: fix php 8 warnings (backport of https://github.com/daviddesberg/PHPoAuthLib/commit/9edfb1d113964c3ad23f32a9eb781c42189d7136), part 2 --- .../OAuth/Common/Http/Client/AbstractClient.php | 17 ++++++++--------- .../OAuth/Common/Http/Client/CurlClient.php | 2 +- .../OAuth/Common/Http/Client/StreamClient.php | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/htdocs/includes/OAuth/Common/Http/Client/AbstractClient.php b/htdocs/includes/OAuth/Common/Http/Client/AbstractClient.php index 94000b18ce6..bbfc6de3759 100644 --- a/htdocs/includes/OAuth/Common/Http/Client/AbstractClient.php +++ b/htdocs/includes/OAuth/Common/Http/Client/AbstractClient.php @@ -59,15 +59,14 @@ abstract class AbstractClient implements ClientInterface /** * @param array $headers */ - public function normalizeHeaders(&$headers) + public function normalizeHeaders($headers): array { - // Normalize headers - array_walk( - $headers, - function (&$val, &$key) { - $key = ucfirst(strtolower($key)); - $val = ucfirst(strtolower($key)) . ': ' . $val; - } - ); + $normalizeHeaders = []; + foreach ($headers as $key => $val) { + $val = ucfirst(strtolower($key)) . ': ' . $val; + $normalizeHeaders[$key] = $val; + } + + return $normalizeHeaders; } } diff --git a/htdocs/includes/OAuth/Common/Http/Client/CurlClient.php b/htdocs/includes/OAuth/Common/Http/Client/CurlClient.php index eae1be3ed05..39650396fc1 100644 --- a/htdocs/includes/OAuth/Common/Http/Client/CurlClient.php +++ b/htdocs/includes/OAuth/Common/Http/Client/CurlClient.php @@ -70,7 +70,7 @@ class CurlClient extends AbstractClient // Normalize method name $method = strtoupper($method); - $this->normalizeHeaders($extraHeaders); + $extraHeaders = $this->normalizeHeaders($extraHeaders); if ($method === 'GET' && !empty($requestBody)) { throw new \InvalidArgumentException('No body expected for "GET" request.'); diff --git a/htdocs/includes/OAuth/Common/Http/Client/StreamClient.php b/htdocs/includes/OAuth/Common/Http/Client/StreamClient.php index 9849afd4a32..204835dd380 100644 --- a/htdocs/includes/OAuth/Common/Http/Client/StreamClient.php +++ b/htdocs/includes/OAuth/Common/Http/Client/StreamClient.php @@ -33,7 +33,7 @@ class StreamClient extends AbstractClient // Normalize method name $method = strtoupper($method); - $this->normalizeHeaders($extraHeaders); + $extraHeaders = $this->normalizeHeaders($extraHeaders); if ($method === 'GET' && !empty($requestBody)) { throw new \InvalidArgumentException('No body expected for "GET" request.'); From 5bf5d23495cd65417162c5ef30c7017fb427a04f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 May 2025 11:22:54 +0200 Subject: [PATCH 6/8] Update AbstractClient.php --- htdocs/includes/OAuth/Common/Http/Client/AbstractClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/OAuth/Common/Http/Client/AbstractClient.php b/htdocs/includes/OAuth/Common/Http/Client/AbstractClient.php index bbfc6de3759..3fac83ed7da 100644 --- a/htdocs/includes/OAuth/Common/Http/Client/AbstractClient.php +++ b/htdocs/includes/OAuth/Common/Http/Client/AbstractClient.php @@ -59,7 +59,7 @@ abstract class AbstractClient implements ClientInterface /** * @param array $headers */ - public function normalizeHeaders($headers): array + public function normalizeHeaders($headers) { $normalizeHeaders = []; foreach ($headers as $key => $val) { From 0ef0d339b5a41fcbb08857eab7e24e053ed31f9b Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Sun, 4 May 2025 11:26:34 +0200 Subject: [PATCH 7/8] FIX: pgsql: error when creating sequences in migration scripts (#34021) * FIX: pgsql: error in migration from 15 to 16 * FIX: pgsql: error in migration from 7 to 8 --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 6 +++--- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) 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 95fa45588a6..85de82ca750 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 @@ -41,12 +41,12 @@ -- VMYSQL4.3 ALTER TABLE llx_c_payment_term ADD PRIMARY KEY(rowid); -- VMYSQL4.3 ALTER TABLE llx_c_payment_term CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; --- VPGSQL8.2 CREATE SEQUENCE __DATABASE__.llx_c_civility_rowid_seq OWNED BY llx_c_civility.rowid; +-- VPGSQL8.2 CREATE SEQUENCE llx_c_civility_rowid_seq OWNED BY llx_c_civility.rowid; -- VPGSQL8.2 ALTER TABLE llx_c_civility ADD PRIMARY KEY (rowid); -- VPGSQL8.2 ALTER TABLE llx_c_civility ALTER COLUMN rowid SET DEFAULT nextval('llx_c_civility_rowid_seq'); -- VPGSQL8.2 SELECT setval('llx_c_civility_rowid_seq', MAX(rowid)) FROM llx_c_civility; --- VPGSQL8.2 CREATE SEQUENCE __DATABASE__.llx_c_payment_term_rowid_seq OWNED BY llx_c_payment_term.rowid; +-- VPGSQL8.2 CREATE SEQUENCE llx_c_payment_term_rowid_seq OWNED BY llx_c_payment_term.rowid; -- VPGSQL8.2 ALTER TABLE llx_c_payment_term ADD PRIMARY KEY (rowid); -- VPGSQL8.2 ALTER TABLE llx_c_payment_term ALTER COLUMN rowid SET DEFAULT nextval('llx_c_payment_term_rowid_seq'); -- VPGSQL8.2 SELECT setval('llx_c_payment_term_rowid_seq', MAX(rowid)) FROM llx_c_payment_term; @@ -146,7 +146,7 @@ ALTER TABLE llx_societe_contacts DROP FOREIGN KEY fk_societe_contacts_fk_c_type_ -- VMYSQL4.3 ALTER TABLE llx_c_type_contact ADD PRIMARY KEY(rowid); -- VMYSQL4.3 ALTER TABLE llx_c_type_contact CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; --- VPGSQL8.2 CREATE SEQUENCE __DATABASE__.llx_c_type_contact_rowid_seq OWNED BY llx_c_type_contact.rowid; +-- VPGSQL8.2 CREATE SEQUENCE llx_c_type_contact_rowid_seq OWNED BY llx_c_type_contact.rowid; -- VPGSQL8.2 ALTER TABLE llx_c_type_contact ADD PRIMARY KEY (rowid); -- VPGSQL8.2 ALTER TABLE llx_c_type_contact ALTER COLUMN rowid SET DEFAULT nextval('llx_c_type_contact_rowid_seq'); -- VPGSQL8.2 SELECT setval('llx_c_type_contact_rowid_seq', MAX(rowid)) FROM llx_c_type_contact; diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index afea0fe18ab..b4dd2d6e0d2 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -180,7 +180,7 @@ ALTER TABLE llx_c_paiement DROP INDEX uk_c_paiement; ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement_code(entity, code); -- VMYSQL4.3 ALTER TABLE llx_c_paiement CHANGE COLUMN id id INTEGER AUTO_INCREMENT PRIMARY KEY; --- VPGSQL8.2 CREATE SEQUENCE __DATABASE__.llx_c_paiement_id_seq OWNED BY llx_c_paiement.id; +-- VPGSQL8.2 CREATE SEQUENCE llx_c_paiement_id_seq OWNED BY llx_c_paiement.id; -- VPGSQL8.2 ALTER TABLE llx_c_paiement ADD PRIMARY KEY (id); -- VPGSQL8.2 ALTER TABLE llx_c_paiement ALTER COLUMN id SET DEFAULT nextval('llx_c_paiement_id_seq'); -- VPGSQL8.2 SELECT setval('llx_c_paiement_id_seq', MAX(id)) FROM llx_c_paiement; @@ -190,7 +190,7 @@ ALTER TABLE llx_c_payment_term DROP INDEX uk_c_payment_term; ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term_code(entity, code); -- VMYSQL4.3 ALTER TABLE llx_c_payment_term CHANGE COLUMN rowid rowid INTEGER AUTO_INCREMENT PRIMARY KEY; --- VPGSQL8.2 CREATE SEQUENCE __DATABASE__.llx_c_payment_term_rowid_seq OWNED BY llx_c_payment_term.rowid; +-- VPGSQL8.2 CREATE SEQUENCE llx_c_payment_term_rowid_seq OWNED BY llx_c_payment_term.rowid; -- VPGSQL8.2 ALTER TABLE llx_c_payment_term ADD PRIMARY KEY (rowid); -- VPGSQL8.2 ALTER TABLE llx_c_payment_term ALTER COLUMN rowid SET DEFAULT nextval('llx_c_payment_term_rowid_seq'); -- VPGSQL8.2 SELECT setval('llx_c_payment_term_rowid_seq', MAX(rowid)) FROM llx_c_payment_term; From 9b74628e29689fcddc012f0275baad8b55e26ddb Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Sun, 4 May 2025 11:27:19 +0200 Subject: [PATCH 8/8] FIX: accountancy balance: keep subtotals when sorting (#34001) --- htdocs/accountancy/bookkeeping/balance.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 580e1797d88..2d0642c9642 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -197,6 +197,9 @@ if (empty($reshook)) { $filter['t.reconciled_option'] = $search_not_reconciled; $param .= '&search_not_reconciled='.urlencode($search_not_reconciled); } + if (!empty($show_subgroup)) { + $param .= '&show_subgroup='.urlencode($show_subgroup); + } // param with type of list $url_param = substr($param, 1); // remove first "&"