diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php
index 45a9222e594..030e6ed3e35 100644
--- a/htdocs/core/lib/sendings.lib.php
+++ b/htdocs/core/lib/sendings.lib.php
@@ -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';
diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php
index 8417699cb19..c4974b00990 100644
--- a/htdocs/expedition/dispatch.php
+++ b/htdocs/expedition/dispatch.php
@@ -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 '';
print '
';
- print '';
- //print '';
+ print '';
+ //print '';
print ' | ';
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print '';
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index cb3c2628286..b9a52cc8f60 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -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();
}
}
diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php
index e33885d0d51..333bc0b723f 100644
--- a/htdocs/reception/contact.php
+++ b/htdocs/reception/contact.php
@@ -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();
}
}
diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php
index 112a6d51cd0..6faca7674ea 100644
--- a/htdocs/reception/dispatch.php
+++ b/htdocs/reception/dispatch.php
@@ -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');
|