2
0
forked from Wavyzz/dolibarr

Fix dispatch tab on reception (no way to change batch number once set)

This commit is contained in:
Laurent Destailleur
2023-09-12 19:47:45 +02:00
parent bf3c0e9d4a
commit e31cdbe297
5 changed files with 21 additions and 11 deletions

View File

@@ -106,11 +106,20 @@ if (empty($conf->reception->enabled)) {
$permissiontocontrol = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate)));
}
// $id is id of a purchase order.
$result = restrictedArea($user, 'fournisseur', $object, 'reception');
// $id is id of a reception
if (isModEnabled("reception") || $origin == 'reception' || empty($origin)) {
$result = restrictedArea($user, 'reception', $object->id);
} else {
// We do not use the reception module, so we test permission on the supplier orders
if ($origin == 'supplierorder' || $origin == 'order_supplier') {
$result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande');
} elseif (!$user->hasRight($origin, 'lire') && !$user->hasRight($origin, 'read')) {
accessforbidden();
}
}
if (!isModEnabled('stock')) {
accessforbidden();
accessforbidden('Module stock disabled');
}
$usercancreate = $user->hasRight('reception', 'creer');