From 8d72cd02692a7e9af9020d3bdf29e94b489cd208 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 5 Nov 2025 22:22:07 +0100 Subject: [PATCH 1/5] FIX wrong number of categories by entity (#36111) * FIX wrong number of categories by entity * FIX missing category class parameters * FIX remove debug --- htdocs/categories/class/categorie.class.php | 3 +++ htdocs/categories/index.php | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index ce693d5bebf..c122a1c7ffc 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -380,6 +380,9 @@ class Categorie extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + if (is_object($hookmanager)) { $hookmanager->initHooks(array('category')); $parameters = array(); diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 86694d7937e..ee1a9e6d325 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -89,7 +89,10 @@ foreach ($categstatic->MAP_ID as $key => $idtype) { $arrayofcateg = dol_sort_array($arrayofcateg, 'labelwithoutaccent', 'asc', 1, 0, 1); // Get number of tags per category type -$sql = "SELECT type as idtype, COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."categorie GROUP BY type"; +$sql = "SELECT type as idtype, COUNT(rowid) as nb"; +$sql .= " FROM ".MAIN_DB_PREFIX."categorie"; +$sql .= " WHERE entity IN (".getEntity('category').")"; +$sql .= " GROUP BY type"; $resql = $db->query($sql); if ($resql) { while ($obj = $db->fetch_object($resql)) { From 2b0c11860161e6a4e222d07286b071b43818c1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 5 Nov 2025 22:22:32 +0100 Subject: [PATCH 2/5] fix phpdoc for tva in fournisseur.commande.class.php (#36109) --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 50f13ac254e..3113261d147 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3070,7 +3070,7 @@ class CommandeFournisseur extends CommonOrder * @param int|float $pu Unit price * @param int|float $qty Quantity * @param int|float $remise_percent Percent discount on line - * @param int|float $txtva VAT rate + * @param int|float|string $txtva VAT Rate (Can be '1.23' or '1.23 (ABC)') * @param int|float $txlocaltax1 Localtax1 tax * @param int|float $txlocaltax2 Localtax2 tax * @param string $price_base_type Type of price base From d221d5eb6dec6818d7132753ff824a92b76dd02c Mon Sep 17 00:00:00 2001 From: atm-adrien <67913809+atm-adrien@users.noreply.github.com> Date: Wed, 5 Nov 2025 22:26:30 +0100 Subject: [PATCH 3/5] FIX : Wrong cast on TVA rate when updating supplier order lines (#36106) * FIX : Wrong cast on TVA rate when updating supplier order lines * FIX : indent --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index f6e41fd9535..d385dedebb0 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -811,7 +811,7 @@ if (empty($reshook)) { $ht, (float) price2num(GETPOST('qty'), 'MS'), (float) price2num(GETPOST('remise_percent'), '', 2), - (float) $vat_rate, + $vat_rate, $localtax1_rate, $localtax2_rate, $price_base_type, From afd44449c13f0b4d76373f152481c051fcc6fb44 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 5 Nov 2025 22:32:02 +0100 Subject: [PATCH 4/5] FIX: MAIN_AUTOFILL_DATE in supplier invoice display 01/01/1970 (#36087) * FIX: MAIN_AUTOFILL_DATE in supplier invoice display 01/01/1970 * fix: php8 warning * fix: review --------- Co-authored-by: Laurent Destailleur --- htdocs/fourn/facture/card.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 20d31592502..9a6dc94a51f 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2740,10 +2740,11 @@ if ($action == 'create') { // Label print ''.$langs->trans('Label').''; + // Date invoice print ''.$langs->trans('DateInvoice').''; print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate((int) $dateinvoice, '', 0, 0, 0, "add", 1, 1); + print $form->selectDate($dateinvoice ? (int) $dateinvoice : '', '', 0, 0, 0, "add", 1, 1); print ''; // Payment term @@ -2909,7 +2910,11 @@ if ($action == 'create') { // We check if Origin document (id and type is known) has already at least one invoice attached to it $objectsrc->fetchObjectLinked($originid, $origin, null, 'invoice_supplier'); - $invoice_supplier = $objectsrc->linkedObjects['invoice_supplier']; + if (isset($objectsrc->linkedObjects['invoice_supplier'])) { + $invoice_supplier = $objectsrc->linkedObjects['invoice_supplier']; + } else { + $invoice_supplier = []; + } '@phan-var-force null|FactureFournisseur[] $invoice_supplier'; // count function need a array as argument (Note: the array must implement Countable too) From 0fd19787e25e8f17617205688a64ce58d69decc9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 5 Nov 2025 22:47:51 +0100 Subject: [PATCH 5/5] FIX #36113 (#36116) --- htdocs/compta/facture/class/facturestats.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 12b18df5ddb..e6a99bf9027 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -276,13 +276,14 @@ class FactureStats 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; + $sql .= " INNER JOIN ".$this->from_line." ON f.rowid = tl.fk_facture"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid"; if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; $sql .= " WHERE ".$this->where; - $sql .= " AND f.rowid = tl.fk_facture AND tl.fk_product = product.rowid"; $sql .= " AND f.datef 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');