From 40f86ca101716232d7e6c14db631d530dbe8ac71 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 6 Feb 2025 18:13:25 +0100 Subject: [PATCH] FIX extrafields lost during creation from rec invoice --- htdocs/compta/facture/card.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c8c5822bb19..cc0460ffead 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3476,7 +3476,12 @@ if ($action == 'create') { // Overwrite some values if creation of invoice is from a predefined invoice if (empty($origin) && empty($originid) && GETPOSTINT('fac_rec') > 0) { - $invoice_predefined->fetch(GETPOSTINT('fac_rec')); + //$invoice_predefined->fetch(GETPOSTINT('fac_rec')); + foreach ($invoice_predefined->array_options as $key => $option) { + if (!isset($object->array_options[$key])) { + $object->array_options[$key] = $invoice_predefined->array_options[$key]; + } + } $dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later if (empty($projectid)) {