diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 25ef7c2899a..7c601d9a61c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -448,6 +448,30 @@ if (empty($reshook)) { } } + // Quick edit for extrafields + if ($action == 'update_extras') { + $object->oldcopy = dol_clone($object); + + // Fill array 'array_options' with data from update form + $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); + if ($ret < 0) { + $error++; + } + + if (!$error) { + // Actions on extra fields + $result = $object->insertExtraFields('PRODUCT_MODIFY'); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + + if ($error) { + $action = 'edit_extras'; + } + } + // Add a product or service if ($action == 'add' && $usercancreate) { $error = 0;