From f1ab8a1268100f3ebe244b5af5124e7f727997b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 18 Sep 2023 10:14:09 +0200 Subject: [PATCH] fix origin id of order_supplier when creating one invoice_supplier for many --- htdocs/fourn/commande/list.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 3080a184abb..5560f251e6f 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -362,6 +362,7 @@ if (empty($reshook)) { $validate_invoices = GETPOST('validate_invoices', 'int'); $TFact = array(); + /** @var FactureFournisseur[] $TFactThird */ $TFactThird = array(); $nb_bills_created = 0; @@ -380,7 +381,7 @@ if (empty($reshook)) { $objecttmp = new FactureFournisseur($db); if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) { - $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. + $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created supplier invoice. } else { $objecttmp->socid = $cmd->socid; $objecttmp->type = $objecttmp::TYPE_STANDARD; @@ -505,7 +506,8 @@ if (empty($reshook)) { false, $lines[$i]->array_options, $lines[$i]->fk_unit, - $objecttmp->origin_id, + // we use the id of each order, not the id of the first one stored in $objecttmp->origin_id + $lines[$i]->fk_commande, $lines[$i]->pa_ht, $lines[$i]->ref_supplier, $lines[$i]->special_code,