Browse Source

Merge remote-tracking branch 'origin/3.7' into develop

Conflicts:
	htdocs/expedition/class/expedition.class.php
	htdocs/install/mysql/migration/3.6.0-3.7.0.sql
	htdocs/langs/en_US/stocks.lang
Laurent Destailleur 10 years ago
parent
commit
23562a01ab

+ 2 - 0
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

+ 3 - 3
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

+ 1 - 1
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;
 	}
 

+ 22 - 8
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;
+
+		if (! empty($orderline->fk_product))
 		{
-			$orderline = new OrderLine($this->db);
-			$orderline->fetch($id);
-			$fk_product = $orderline->fk_product;
+			if (! ($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS))
+			{
+				$this->error=$langs->trans("ErrorWarehouseRequiredIntoShipmentLine");
+				return -1;
+			}
 
-			if (!empty($orderline->fk_product))
+			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;

+ 2 - 1
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');
+

+ 3 - 3
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)

+ 1 - 1
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
+ProductDoesNotUseBatchSerial=This product does not use batch/serial number

+ 1 - 1
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

+ 1 - 0
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.

+ 2 - 2
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;
 }