diff --git a/ChangeLog b/ChangeLog index 86f25196179..46126bc4951 100644 --- a/ChangeLog +++ b/ChangeLog @@ -108,6 +108,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/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index e9abfb38bc4..5bed0a26d33 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -113,9 +113,9 @@ class modMyModule extends DolibarrModules $this->const = array(); // Array to add new pages in new tabs - // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 - // 'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2 - // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname + // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 + // 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname // where objecttype can be // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) // 'contact' to add a tab in contact view diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 959decc581c..a8bb07e6ec6 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -67,7 +67,7 @@ class Canvas $newaction = $action; if ($newaction == 'add') $newaction='create'; if ($newaction == 'update') $newaction='edit'; - if (empty($newaction) || $newaction == 'delete' || $newaction == 'create_user') $newaction='view'; + if (empty($newaction) || $newaction == 'delete' || $newaction == 'create_user' || $newaction == 'presend' || $newaction == 'send') $newaction='view'; return $newaction; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 379d9849b8f..062510f1aa8 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -748,10 +748,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 */ @@ -766,19 +768,25 @@ 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(); @@ -816,6 +824,12 @@ class Expedition extends CommonObject } $linebatch->dluo_qty=$value['q']; $tab[]=$linebatch; + + if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) + { + // TODO + } + } } $line->entrepot_id = $linebatch->entrepot_id; diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index f278adb298f..22a65167e6f 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -1156,4 +1156,5 @@ ALTER TABLE llx_resource MODIFY COLUMN entity integer DEFAULT 1 NOT NULL; ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type(rowid); -- this update change the old formated url on llx_bank_url -UPDATE llx_bank_url set url = replace( url, 'fiche.php', 'card.php'); +UPDATE llx_bank_url set url = REPLACE( url, 'fiche.php', 'card.php'); + diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 8f62a755518..89e54ef4443 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -193,9 +193,9 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) // Test database version is not forbidden for migration $dbversion_disallowed=array( array('type'=>'mysql','version'=>array(5,5,40)), - array('type'=>'mysqli','version'=>array(5,5,40)), - array('type'=>'mysql','version'=>array(5,5,41)), - array('type'=>'mysqli','version'=>array(5,5,41)) + array('type'=>'mysqli','version'=>array(5,5,40)) + //,array('type'=>'mysql','version'=>array(5,5,41)), + //array('type'=>'mysqli','version'=>array(5,5,41)) ); $listofforbiddenversion=''; foreach ($dbversion_disallowed as $dbversion_totest) diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index c81b1af5374..45263681965 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -18,4 +18,4 @@ printQty=Qty: %d AddDispatchBatchLine=Add a line for Shelf Life dispatching BatchDefaultNumber=Undefined WhenProductBatchModuleOnOptionAreForced=When module Batch/Serial is on, increase/decrease stock mode is forced to last choice and can't be edited. Other options can be defined as you want. -ProductDoesNotUseBatchSerial=This product does not use batch/serial number \ No newline at end of file +ProductDoesNotUseBatchSerial=This product does not use batch/serial number diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 794c9019c86..b1ff55f71c1 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -23,7 +23,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 9c7a6f7acbd..10fcf353fd4 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -130,3 +130,4 @@ IsInPackage=Contained into package ShowWarehouse=Show warehouse MovementCorrectStock=Stock content correction for product %s MovementTransferStock=Stock transfer of product %s into another warehouse +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. diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index d21a08007a4..d13c9884e89 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -43,8 +43,8 @@ if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield="p.titre"; -if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="p.date_fin"; +if (! $sortorder) $sortorder="DESC"; if ($page < 0) { $page = 0; }