From 240371b59d5d41bd484d7a1cfe13bbf8216e4aab Mon Sep 17 00:00:00 2001
From: "cam.lafit" <cam.lafit@azerttyu.net>
Date: Thu, 18 May 2017 10:40:10 +0200
Subject: [PATCH] UPDATE : add warehouse information on order creation

* If stock management is enabled we must done information about warehouse source
If any warehouse is provided, client must send 0.
---
 htdocs/webservices/server_order.php | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php
index f477ccfed9c..b0f794dd55f 100644
--- a/htdocs/webservices/server_order.php
+++ b/htdocs/webservices/server_order.php
@@ -325,7 +325,7 @@ $server->register(
 
 $server->register(
 		'validOrder',
-		array('authentication'=>'tns:authentication','id'=>'xsd:string'),	// Entry values
+		array('authentication'=>'tns:authentication','id'=>'xsd:string','id_warehouse'=>'xsd:string'),  // Entry values
 		array('result'=>'tns:result'),	// Exit values
 		$ns,
 		$ns.'#validOrder',
@@ -795,7 +795,7 @@ function createOrder($authentication,$order)
  * @param	int			$id					Id of order to validate
  * @return	array							Array result
  */
-function validOrder($authentication,$id='')
+function validOrder($authentication,$id='',$id_warehouse=0)
 {
 	global $db,$conf,$langs;
 
@@ -821,7 +821,8 @@ function validOrder($authentication,$id='')
 			$db->begin();
 			if ($result > 0)
 			{
-				$result=$order->valid($fuser);
+
+				$result=$order->valid($fuser,$id_warehouse);
 
 				if ($result	>= 0)
 				{
-- 
GitLab