FIX Update extrafields on warehouse

This commit is contained in:
Laurent Destailleur 2020-08-18 18:35:40 +02:00
parent afe8f76a4a
commit 3e91d77920
2 changed files with 21 additions and 2 deletions

View File

@ -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 = '';

View File

@ -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")
{