Task 672 : add stock limitation on shipment + translation
This commit is contained in:
parent
b6a2fa61c8
commit
1911f6fcdc
@ -1104,7 +1104,7 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
$product_type=$type;
|
$product_type=$type;
|
||||||
if ($fk_product)
|
if (!empty($fk_product))
|
||||||
{
|
{
|
||||||
$product=new Product($this->db);
|
$product=new Product($this->db);
|
||||||
$result=$product->fetch($fk_product);
|
$result=$product->fetch($fk_product);
|
||||||
|
|||||||
@ -2067,7 +2067,7 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
|
|
||||||
$product_type=$type;
|
$product_type=$type;
|
||||||
if ($fk_product)
|
if (!empty($fk_product))
|
||||||
{
|
{
|
||||||
$product=new Product($this->db);
|
$product=new Product($this->db);
|
||||||
$result=$product->fetch($fk_product);
|
$result=$product->fetch($fk_product);
|
||||||
|
|||||||
@ -710,12 +710,33 @@ class Expedition extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function addline($entrepot_id, $id, $qty)
|
function addline($entrepot_id, $id, $qty)
|
||||||
{
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
$num = count($this->lines);
|
$num = count($this->lines);
|
||||||
$line = new ExpeditionLigne($this->db);
|
$line = new ExpeditionLigne($this->db);
|
||||||
|
|
||||||
$line->entrepot_id = $entrepot_id;
|
$line->entrepot_id = $entrepot_id;
|
||||||
$line->origin_line_id = $id;
|
$line->origin_line_id = $id;
|
||||||
$line->qty = $qty;
|
$line->qty = $qty;
|
||||||
|
|
||||||
|
if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) {
|
||||||
|
$orderline = new OrderLine($this->db);
|
||||||
|
$orderline->fetch($id);
|
||||||
|
$fk_product = $orderline->fk_product;
|
||||||
|
|
||||||
|
if (!empty($orderline->fk_product))
|
||||||
|
{
|
||||||
|
$product=new Product($this->db);
|
||||||
|
$result=$product->fetch($fk_product);
|
||||||
|
$product_type=$product->type;
|
||||||
|
|
||||||
|
if($product_type == 0 && $product->stock_reel < $qty) {
|
||||||
|
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||||
|
$this->db->rollback();
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->lines[$num] = $line;
|
$this->lines[$num] = $line;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,4 +22,5 @@ ToAndDate=To___________________________________ on ____/_____/__________
|
|||||||
GoodStatusDeclaration=Have received the goods above in good condition,
|
GoodStatusDeclaration=Have received the goods above in good condition,
|
||||||
Deliverer=Deliverer :
|
Deliverer=Deliverer :
|
||||||
Sender=Sender
|
Sender=Sender
|
||||||
Recipient=Recipient
|
Recipient=Recipient
|
||||||
|
ErrorStockIsNotEnough=There's not enough stock
|
||||||
Loading…
Reference in New Issue
Block a user