add hidden option SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN
This commit is contained in:
parent
d0c95d87af
commit
d21f5eca83
@ -2084,7 +2084,12 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
// $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on)
|
// $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on)
|
||||||
$mouv->origin = &$this;
|
$mouv->origin = &$this;
|
||||||
$mouv->setOrigin($this->element, $this->id);
|
$mouv->setOrigin($this->element, $this->id);
|
||||||
|
// Method change if qty < 0
|
||||||
|
if (!empty($conf->global->SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN) && $qty < 0) {
|
||||||
|
$result = $mouv->livraison($user, $product, $entrepot, $qty*(-1), $price, $comment, $now, $eatby, $sellby, $batch);
|
||||||
|
} else {
|
||||||
$result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch);
|
$result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch);
|
||||||
|
}
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->error = $mouv->error;
|
$this->error = $mouv->error;
|
||||||
$this->errors = $mouv->errors;
|
$this->errors = $mouv->errors;
|
||||||
|
|||||||
@ -802,7 +802,7 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
$nbfreeproduct++;
|
$nbfreeproduct++;
|
||||||
} else {
|
} else {
|
||||||
$remaintodispatch = price2num($objp->qty - ((float) $products_dispatched[$objp->rowid]), 5); // Calculation of dispatched
|
$remaintodispatch = price2num($objp->qty - ((float) $products_dispatched[$objp->rowid]), 5); // Calculation of dispatched
|
||||||
if ($remaintodispatch < 0) {
|
if ($remaintodispatch < 0 && empty($conf->global->SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN)) {
|
||||||
$remaintodispatch = 0;
|
$remaintodispatch = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user