From 3e91d779209f43e087062cc62116ad917805775f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Aug 2020 18:35:40 +0200 Subject: [PATCH] FIX Update extrafields on warehouse --- htdocs/product/stock/card.php | 2 -- htdocs/product/stock/movement_list.php | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index bb961611b3d..0ea5c31021e 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -68,8 +68,6 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object if ($id > 0 || !empty($ref)) { $ret = $object->fetch($id, $ref); - // if ($ret > 0) - // $ret = $object->fetch_thirdparty(); if ($ret <= 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 01ecf881924..c844bae01e2 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -135,6 +135,8 @@ $usercanread = $user->rights->stock->mouvement->lire; $usercancreate = $user->rights->stock->mouvement->creer; $usercandelete = $user->rights->stock->mouvement->creer; +$error = 0; + /* * Actions @@ -178,6 +180,25 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } +if ($action == 'update_extras') { + $tmpwarehouse = new Entrepot($db); + $tmpwarehouse->fetch($id); + + $tmpwarehouse->oldcopy = dol_clone($tmpwarehouse); + + // Fill array 'array_options' with data from update form + $ret = $extrafields->setOptionalsFromPost(null, $tmpwarehouse, GETPOST('attribute', 'none')); + if ($ret < 0) $error++; + if (!$error) { + $result = $tmpwarehouse->insertExtraFields(); + if ($result < 0) { + setEventMessages($tmpwarehouse->error, $tmpwarehouse->errors, 'errors'); + $error++; + } + } + if ($error) $action = 'edit_extras'; +} + // Correct stock if ($action == "correct_stock") {