Merge pull request #1239 from csalvador/replenishment-fix
Replenishment fix
This commit is contained in:
commit
e47165fa38
@ -1200,7 +1200,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
}
|
||||
if ($result == 0 || $result == -1)
|
||||
{
|
||||
$this->error="No price found for this quantity. Quantity may be too low ?";
|
||||
$langs->load("errors");
|
||||
$this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier");
|
||||
$this->db->rollback();
|
||||
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_DEBUG);
|
||||
return -1;
|
||||
|
||||
@ -137,7 +137,9 @@ if ($action == 'order' && isset($_POST['valid'])) {
|
||||
$id = $order->create($user);
|
||||
if ($id < 0) {
|
||||
$fail++;
|
||||
setEventMessage($langs->trans('OrderFail'), 'errors');
|
||||
$msg = $langs->trans('OrderFail') . " : ";
|
||||
$msg .= $order->error;
|
||||
setEventMessage($msg, 'errors');
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -163,8 +165,6 @@ $sql .= ', p.tms as datem, p.duration, p.tobuy, p.seuil_stock_alerte,';
|
||||
$sql .= ' SUM(COALESCE(s.reel, 0)) as stock_physique';
|
||||
$sql .= ', p.desiredstock';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
|
||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_fournisseur_price as pf';
|
||||
$sql .= ' ON p.rowid = pf.fk_product';
|
||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s';
|
||||
$sql .= ' ON p.rowid = s.fk_product';
|
||||
$sql.= ' WHERE p.entity IN (' . getEntity("product", 1) . ')';
|
||||
@ -205,7 +205,7 @@ if (!empty($canvas)) {
|
||||
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.price';
|
||||
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
|
||||
$sql .= ', p.duration, p.tobuy, p.seuil_stock_alerte';
|
||||
$sql .= ', p.desiredstock';
|
||||
$sql .= ', p.desiredstock, s.fk_product';
|
||||
$sql .= ' HAVING p.desiredstock > SUM(COALESCE(s.reel, 0))';
|
||||
$sql .= ' AND p.desiredstock > 0';
|
||||
if ($salert == 'on') {
|
||||
@ -577,4 +577,4 @@ print ' <script type="text/javascript">
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user