FIX deletion of supplier order when draft
This commit is contained in:
parent
75eb256589
commit
22a3b5ea78
@ -85,13 +85,6 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($con
|
|||||||
|
|
||||||
$datelivraison = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), GETPOST('liv_sec', 'int'), GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
|
$datelivraison = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), GETPOST('liv_sec', 'int'), GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
|
||||||
if ($user->socid) {
|
|
||||||
$socid = $user->socid;
|
|
||||||
}
|
|
||||||
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
|
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('ordersuppliercard', 'globalcard'));
|
$hookmanager->initHooks(array('ordersuppliercard', 'globalcard'));
|
||||||
|
|
||||||
@ -101,6 +94,10 @@ $extrafields = new ExtraFields($db);
|
|||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
|
if ($user->socid) {
|
||||||
|
$socid = $user->socid;
|
||||||
|
}
|
||||||
|
|
||||||
// Load object
|
// Load object
|
||||||
if ($id > 0 || !empty($ref)) {
|
if ($id > 0 || !empty($ref)) {
|
||||||
$ret = $object->fetch($id, $ref);
|
$ret = $object->fetch($id, $ref);
|
||||||
@ -124,6 +121,10 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$isdraft = (isset($object->statut) && ($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
|
||||||
|
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande', 'fk_soc', 'rowid', $isdraft);
|
||||||
|
|
||||||
// Common permissions
|
// Common permissions
|
||||||
$usercanread = ($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire);
|
$usercanread = ($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire);
|
||||||
$usercancreate = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer);
|
$usercancreate = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer);
|
||||||
|
|||||||
@ -132,7 +132,7 @@ $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object-
|
|||||||
// Security check (enable the most restrictive one)
|
// Security check (enable the most restrictive one)
|
||||||
//if ($user->socid > 0) accessforbidden();
|
//if ($user->socid > 0) accessforbidden();
|
||||||
//if ($user->socid > 0) $socid = $user->socid;
|
//if ($user->socid > 0) $socid = $user->socid;
|
||||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||||
//if (empty($conf->mymodule->enabled)) accessforbidden();
|
//if (empty($conf->mymodule->enabled)) accessforbidden();
|
||||||
//if (!$permissiontoread) accessforbidden();
|
//if (!$permissiontoread) accessforbidden();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user