Disallow line delete if already dispatched
This commit is contained in:
parent
d842d0394d
commit
f45ec82904
@ -2139,6 +2139,16 @@ class CommandeFournisseur extends CommonOrder
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check if not yet received
|
||||
$dispatchedLines = $this->getDispachedLines();
|
||||
foreach ($dispatchedLines as $dispatchLine) {
|
||||
if ($dispatchLine['orderlineid'] == $idline) {
|
||||
$this->error = "LineAlreadyDispatched";
|
||||
$this->errors[] = $this->error;
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
if ($line->delete($notrigger) > 0) {
|
||||
$this->update_price(1);
|
||||
return 1;
|
||||
@ -2327,7 +2337,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
// List of already dispatched lines
|
||||
$sql = "SELECT p.ref, p.label,";
|
||||
$sql .= " e.rowid as warehouse_id, e.ref as entrepot,";
|
||||
$sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status";
|
||||
$sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.fk_commandefourndet";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid";
|
||||
@ -2351,6 +2361,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
'productid' => $objp->fk_product,
|
||||
'warehouseid' => $objp->warehouse_id,
|
||||
'qty' => $objp->qty,
|
||||
'orderlineid' => $objp->fk_commandefourndet
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -204,3 +204,5 @@ StatusSupplierOrderApproved=Approved
|
||||
StatusSupplierOrderRefused=Refused
|
||||
StatusSupplierOrderReceivedPartially=Partially received
|
||||
StatusSupplierOrderReceivedAll=All products received
|
||||
NeedAtLeastOneInvoice = There has to be at least one Invoice
|
||||
LineAlreadyDispatched = The order line is already received.
|
||||
Loading…
Reference in New Issue
Block a user