diff --git a/ChangeLog b/ChangeLog index 8bdae25eac7..0eac6781fc3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -85,6 +85,8 @@ For users: - New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export. - New : Option on extrafields to have them always editable regardless of the document status. - New : New module PrintIPP to print without opening document is available as stable. +- New : Introduce hidden option STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS to solve at no risk + a missing control on missing warehouse. - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1470, #1472, #1473] User trigger problem - Fix: [ bug #1489, #1491 ] Intervention trigger problem diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index abdf1b648a5..1e0f2f50139 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -52,7 +52,7 @@ function commande_prepare_head($object) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)) { $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; - if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipment"); + if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipments"); if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/'; if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings"); $head[$h][1] = $text; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e6cc0e86d09..0113a582dfb 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -732,10 +732,12 @@ class Expedition extends CommonObject } /** - * Add a expedition line + * Add a expedition line. + * If STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS is set, you can add a shipment line, with no stock source defined + * If STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT is not set, you can add a shipment line, even if not enough into stock * * @param int $entrepot_id Id of warehouse - * @param int $id Id of source line + * @param int $id Id of source line (order line) * @param int $qty Quantity * @return int <0 if KO, >0 if OK */ @@ -750,18 +752,26 @@ class Expedition extends CommonObject $line->origin_line_id = $id; $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; + $orderline = new OrderLine($this->db); + $orderline->fetch($id); + $fk_product = $orderline->fk_product; - if (!empty($orderline->fk_product)) + if (! empty($orderline->fk_product)) + { + if (! ($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) + { + $this->error=$langs->trans("ErrorWarehouseRequiredIntoShipmentLine"); + return -1; + } + + if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) // FIXME Check is done for stock of product, it must be done for stock of product into warehouse if $entrepot_id defined { $product=new Product($this->db); $result=$product->fetch($fk_product); $product_type=$product->type; - if($product_type == 0 && $product->stock_reel < $qty) { + if ($product_type == 0 && $product->stock_reel < $qty) + { $this->error=$langs->trans('ErrorStockIsNotEnough'); $this->db->rollback(); return -3; diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index 0102f688b1b..ded965131de 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -11,7 +11,7 @@ batch_number=Batch/Serial number l_eatby=Eat-by date l_sellby=Sell-by date DetailBatchNumber=Batch/Serial details -DetailBatchFormat=Batch/Serial: %s - E:%s - S: %s (Qty : %d) +DetailBatchFormat=Batch/Serial: %s - Eat by: %s - Sell by: %s (Qty : %d) printBatch=Batch: %s printEatby=Eat-by: %s printSellby=Sell-by: %s diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index f1489508ec6..faf41d116b9 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -22,7 +22,7 @@ QtyOrdered=Qty ordered QtyShipped=Qty shipped QtyToShip=Qty to ship QtyReceived=Qty received -KeepToShip=Keep to ship +KeepToShip=Remain to ship OtherSendingsForSameOrder=Other shipments for this order DateSending=Date sending order DateSendingShort=Date sending order diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index d77c65a9a13..0e3e7dd6c27 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -122,4 +122,4 @@ RuleForStockAvailability=Rules on stock requirements StockMustBeEnoughForInvoice=Stock level must be enough to add product/service into invoice StockMustBeEnoughForOrder=Stock level must be enough to add product/service into order StockMustBeEnoughForShipment= Stock level must be enough to add product/service into shipment - +WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn=Source warehouse must be defined here when batch module is on. It will be used to list wich lot/serial is available for product that required lot/serial data for movement. If you want to send products from different warehouses, just make the shipment into several steps.