This commit is contained in:
Laurent Destailleur 2019-09-30 19:00:19 +02:00
parent fe735d4e67
commit d9e9364ddf

View File

@ -87,9 +87,14 @@ $usercanread = (($user->rights->stock->lire));
$usercancreate = (($user->rights->stock->creer)); $usercancreate = (($user->rights->stock->creer));
$usercandelete = (($user->rights->stock->supprimer)); $usercandelete = (($user->rights->stock->supprimer));
// Ajout entrepot $parameters=array('id'=>$id, 'ref'=>$ref);
if ($action == 'add' && $user->rights->stock->creer) $reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{ {
// Ajout entrepot
if ($action == 'add' && $user->rights->stock->creer)
{
$object->ref = GETPOST("ref"); $object->ref = GETPOST("ref");
$object->fk_parent = GETPOST("fk_parent"); $object->fk_parent = GETPOST("fk_parent");
$object->libelle = GETPOST("libelle"); $object->libelle = GETPOST("libelle");
@ -135,11 +140,11 @@ if ($action == 'add' && $user->rights->stock->creer)
setEventMessages($langs->trans("ErrorWarehouseRefRequired"), null, 'errors'); setEventMessages($langs->trans("ErrorWarehouseRefRequired"), null, 'errors');
$action="create"; // Force retour sur page creation $action="create"; // Force retour sur page creation
} }
} }
// Delete warehouse // Delete warehouse
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->supprimer) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->supprimer)
{ {
$object->fetch(GETPOST('id', 'int')); $object->fetch(GETPOST('id', 'int'));
$result=$object->delete($user); $result=$object->delete($user);
if ($result > 0) if ($result > 0)
@ -153,11 +158,11 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->su
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action=''; $action='';
} }
} }
// Modification entrepot // Modification entrepot
if ($action == 'update' && $cancel <> $langs->trans("Cancel")) if ($action == 'update' && $cancel <> $langs->trans("Cancel"))
{ {
if ($object->fetch($id)) if ($object->fetch($id))
{ {
$object->libelle = GETPOST("libelle"); $object->libelle = GETPOST("libelle");
@ -193,8 +198,8 @@ if ($action == 'update' && $cancel <> $langs->trans("Cancel"))
$action = 'edit'; $action = 'edit';
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
elseif ($action == 'update_extras') { elseif ($action == 'update_extras') {
$object->oldcopy = dol_clone($object); $object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from update form // Fill array 'array_options' with data from update form
@ -209,20 +214,21 @@ elseif ($action == 'update_extras') {
} }
} }
if ($error) $action = 'edit_extras'; if ($error) $action = 'edit_extras';
} }
if ($cancel == $langs->trans("Cancel")) if ($cancel == $langs->trans("Cancel"))
{ {
$action = ''; $action = '';
}
// Actions to build doc
$upload_dir = $conf->stock->dir_output;
$permissioncreate = $user->rights->stock->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
} }
// Actions to build doc
$upload_dir = $conf->stock->dir_output;
$permissioncreate = $user->rights->stock->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
/* /*
* View * View
*/ */