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

@ -47,7 +47,7 @@ function shipping_prepare_head($object)
$head[$h][2] = 'shipping';
$h++;
if ($object->statut == Expedition::STATUS_DRAFT) {
if ($object->statut == Expedition::STATUS_DRAFT) {
$head[$h][0] = DOL_URL_ROOT."/expedition/dispatch.php?id=".$object->id;
$head[$h][1] = $langs->trans("ShipmentDistribution");
$head[$h][2] = 'dispatch';

View File

@ -96,7 +96,7 @@ if ($id > 0 || !empty($ref)) {
$result = restrictedArea($user, 'expedition', $object, '');
if (!isModEnabled('stock')) {
accessforbidden();
accessforbidden('Module stock disabled');
}
$usercancreate = $user->hasRight('expedition', 'creer');
@ -167,9 +167,10 @@ if ($action == 'updatelines' && $usercancreate) {
$sql .= " FROM ".MAIN_DB_PREFIX."product_batch as pb";
$sql .= " JOIN ".MAIN_DB_PREFIX."product_stock as ps";
$sql .= " ON ps.rowid = pb.fk_product_stock";
$sql .= " WHERE pb.batch ='".$db->escape($lot)."'";
$sql .= " WHERE pb.batch = '".$db->escape($lot)."'";
$sql .= " AND ps.fk_product =".((int) GETPOST($prod, 'int')) ;
$sql .= " AND ps.fk_entrepot =".((int) GETPOST($ent, 'int')) ;
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
@ -758,8 +759,8 @@ if ($object->id > 0 || !empty($object->ref)) {
print '</td>';
print '<td>';
print '<input disabled="" type="text" class="inputlotnumber quatrevingtquinzepercent" id="lot_number'.$suffix.'" name="lot_number'.$suffix.'" value="'.$objd->batch.'">';
//print '<input type="hidden" class="inputlotnumber quatrevingtquinzepercent" id="lot_number'.$suffix.'" name="lot_number'.$suffix.'" value="'.$objd->batch.'">';
print '<input type="text" class="inputlotnumber quatrevingtquinzepercent" id="lot_number'.$suffix.'" name="lot_number'.$suffix.'" value="'.$objd->batch.'">';
//print '<input type="hidden" id="lot_number'.$suffix.'" name="lot_number'.$suffix.'" value="'.$objd->batch.'">';
print '</td>';
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print '<td class="nowraponall">';

View File

@ -144,12 +144,12 @@ if ($user->socid) {
}
if (isModEnabled("reception") || $origin == 'reception' || empty($origin)) {
$result = restrictedArea($user, 'reception', $id);
$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 (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) {
} elseif (!$user->hasRight($origin, 'lire') && !$user->hasRight($origin, 'read')) {
accessforbidden();
}
}

View File

@ -72,7 +72,7 @@ if ($origin == 'reception') {
} else {
if ($origin == 'supplierorder' || $origin == 'order_supplier') {
$result = restrictedArea($user, 'fournisseur', $object, 'commande_fournisseur', 'commande');
} elseif (!$user->hasRight($origin, "lire") && !$user->hasRight($origin, "read")) {
} elseif (!$user->hasRight($origin, 'lire') && !$user->hasRight($origin, 'read')) {
accessforbidden();
}
}

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');