From e3c93d2b1dbd4179c6ff493eeb20ba1a638d1dfa Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 9 May 2026 23:13:22 +0200 Subject: [PATCH 1/4] FIX #38131 (#38140) * FIX #38131 * FIX pre-commit error --- htdocs/compta/facture/card-rec.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 9a3332bb265..30f9c2ef71d 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -760,6 +760,16 @@ if (empty($reshook)) { $result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, 0, $pu_ttc, $type, -1, $special_code, $label, (int) $fk_unit, 0, $date_start_fill, $date_end_fill, (int) $fournprice, $buyingprice, $fk_parent_line); if ($result > 0) { + // TODO add "insert" function into FactureLigneRec or add "invoicerecline.class.php" (same of "factureligne.class.php") + $objectline = new FactureLigneRec($db); + if ($objectline->fetch($result)) { + $objectline->array_options = $array_options; + $result = $objectline->insertExtraFields(); + if ($result < 0) { + setEventMessages($langs->trans('Error').$result, null, 'errors'); + } + } + // Define output language and generate document /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { From b2b4fc0ca971c6ff60cd1fa34e4df600fcc1e65e Mon Sep 17 00:00:00 2001 From: daGrumpf <64209003+daGrumpf-bxp@users.noreply.github.com> Date: Sun, 10 May 2026 13:58:59 +0200 Subject: [PATCH 2/4] FIX: propagate fk_warehouse from BOM/MO to production lines in createProduction() and processBOM() (#38147) * FIX: propagate fk_warehouse from BOM line in processBOM() When creating MO lines from a BOM, the fk_warehouse defined on each BOM line was not copied to the corresponding MO line. This caused produceandconsumeall() to fail with a stock movement error when a warehouse is set on BOM lines but not on the MO itself. * FIX: propagate fk_warehouse from BOM line in processBOM() When creating MO lines from a BOM, the fk_warehouse defined on each BOM line was not copied to the corresponding MO line. This caused produceandconsumeall() to fail with a stock movement error when a warehouse is set on BOM lines but not on the MO itself. * Update mo.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/mrp/class/mo.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 666d29a2081..b8d3ed27820 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -742,9 +742,10 @@ class Mo extends CommonObject $moline = new MoLine($this->db); // Line to produce - $moline->fk_mo = $this->id; + $moline->fk_mo = (int) $this->id; $moline->qty = (float) $this->qty; $moline->fk_product = (int) $this->fk_product; + $moline->fk_warehouse = (int) $this->fk_warehouse; $moline->position = 1; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -834,6 +835,7 @@ class Mo extends CommonObject $this->errors[] = $this->error; } else { $moline->fk_product = $line->fk_product; + $moline->fk_warehouse = !empty($line->fk_warehouse) ? $line->fk_warehouse : (!empty($bom->fk_warehouse) ? $bom->fk_warehouse : $this->fk_warehouse); $moline->role = $role; $moline->position = $line->position; $moline->qty_frozen = $line->qty_frozen; From 078dee3c8133a5dc71415be3481d27dcecb9bf3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 May 2026 17:00:27 +0200 Subject: [PATCH 3/4] Fix use of canvas template --- htdocs/core/class/canvas.class.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index e6e4c2de4ce..b0597730e43 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -121,8 +121,6 @@ class Canvas */ public function getCanvas($module, $card, $canvas) { - global $conf, $langs; - // Set properties with value specific to dolibarr core: this->targetmodule, this->card, this->canvas $this->targetmodule = $module; $this->canvas = $canvas; @@ -190,7 +188,12 @@ class Canvas return 0; } - if (file_exists($this->template_dir.(!empty($this->card) ? $this->card.'_' : '').$this->_cleanaction($action).'.tpl.php')) { + $newaction = $action; + if ($action && !in_array($action, array('create', 'view', 'edit', 'list'))) { + $newaction = 'view'; + } + + if (file_exists($this->template_dir.(!empty($this->card) ? $this->card.'_' : '').$this->_cleanaction($newaction).'.tpl.php')) { return 1; } else { return 0; @@ -208,11 +211,16 @@ class Canvas public function display_canvas($action) { // phpcs:enable - global $db, $conf, $langs, $user, $canvas; - global $form, $formfile; + global $db, $conf, $langs, $user, $canvas; // used into include + global $form, $formfile; // used into include + + $newaction = $action; + if ($action && !in_array($action, array('create', 'view', 'edit', 'list'))) { + $newaction = 'view'; + } //var_dump($this->card.'-'.$action); - include $this->template_dir.(!empty($this->card) ? $this->card.'_' : '').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template + include $this->template_dir.(!empty($this->card) ? $this->card.'_' : '').$this->_cleanaction($newaction).'.tpl.php'; // Include native PHP template } From 9a5921329621d71706e0d9c839eb59aa1694395c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 May 2026 18:42:15 +0200 Subject: [PATCH 4/4] FIX selected default value ko on select_produits_fournisseurs_list() --- htdocs/core/class/html.form.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d67b140a653..711a257d565 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4333,9 +4333,12 @@ class Form } $optstart = '