From b5f77b4035da950557ae287d0bee9d734ab610a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Jun 2022 17:36:42 +0200 Subject: [PATCH] FIX #21237 --- htdocs/expedition/card.php | 4 ++- .../fournisseur.commande.dispatch.class.php | 2 +- htdocs/reception/card.php | 26 ++++++++----------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index dec016c9a1d..b07dfa778a4 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1571,7 +1571,8 @@ if ($action == 'create') { } } - // Line extrafield + // Display lines for extrafields of the Shipment line + // $line is a 'Order line' if (!empty($extrafields)) { //var_dump($line); $colspan = 5; @@ -1580,6 +1581,7 @@ if ($action == 'create') { $srcLine = new OrderLine($db); $srcLine->id = $line->id; $srcLine->fetch_optionals(); // fetch extrafields also available in orderline + $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options); print $expLine->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1); diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 5bfafff57b5..27c991e5896 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -75,7 +75,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine public $fk_product; /** - * @var int ID + * @var int ID. Should be named fk_origin_line ? */ public $fk_commandefourndet; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 1422e7ed566..7e910188b34 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -101,11 +101,13 @@ $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); $object = new Reception($db); +$objectorder = new CommandeFournisseur($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element_line); +$extrafields->fetch_name_optionals_label($objectorder->table_element_line); // Load object. Make an object->fetch include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once @@ -1237,32 +1239,26 @@ if ($action == 'create') { print "\n"; - $extralabelslines = $extrafields->attributes[$line->table_element]; - - // Display lines extrafields - // $line is a line of reception (so CommandeFournisseurDispatch) - if (is_array($extralabelslines) && count($extralabelslines) > 0) { + // Display lines for extrafields of the Reception line + // $line is a 'CommandeFournisseurLigne', $dispatchLines contains values of Reception lines so properties of CommandeFournisseurDispatch + if (!empty($extrafields)) { + //var_dump($line); $colspan = 5; if ($conf->productbatch->enabled) { $colspan += 3; } + $recLine = new CommandeFournisseurDispatch($db); $srcLine = new CommandeFournisseurLigne($db); - $line = new CommandeFournisseurDispatch($db); - - $extrafields->fetch_name_optionals_label($srcLine->table_element); - $extrafields->fetch_name_optionals_label($line->table_element); - $srcLine->id = $line->id; $srcLine->fetch_optionals(); // fetch extrafields also available in orderline - $line->fetch_optionals(); - if (empty($line->array_options) && !empty($dispatchLines[$indiceAsked]['array_options'])) { - $line->array_options = $dispatchLines[$indiceAsked]['array_options']; + if (empty($recLine->array_options) && !empty($dispatchLines[$indiceAsked]['array_options'])) { + $recLine->array_options = $dispatchLines[$indiceAsked]['array_options']; } - $line->array_options = array_merge($line->array_options, $srcLine->array_options); + $recLine->array_options = array_merge($recLine->array_options, $srcLine->array_options); - print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1); + print $recLine->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1); } $indiceAsked++;