From 74927428aa3ad5cd67c5fe5474c8275cc4da03dc Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Mon, 19 Jul 2010 11:20:50 +0000 Subject: [PATCH] #153 Warning issued by the SOAP web services SVN:trunk[614] --- core/test.class.inc.php | 2 +- pages/testlist.inc.php | 8 +++++--- webservices/itopsoaptypes.class.inc.php | 8 +++++++- webservices/webservices.class.inc.php | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/core/test.class.inc.php b/core/test.class.inc.php index 8aceb3c17..dd45d16e5 100644 --- a/core/test.class.inc.php +++ b/core/test.class.inc.php @@ -385,7 +385,7 @@ abstract class TestBizModel extends TestHandler protected function DoPrepare() { - MetaModel::Startup($this->GetConfigFile(), true); // Load model only + MetaModel::Startup($this->GetConfigFile()); // #@# Temporary disabled by Romain // MetaModel::CheckDefinitions(); diff --git a/pages/testlist.inc.php b/pages/testlist.inc.php index d326fc4a9..d8392be34 100644 --- a/pages/testlist.inc.php +++ b/pages/testlist.inc.php @@ -1323,7 +1323,7 @@ $aWebServices = array( 'admin', /* sPassword */ 'PC burning', /* sDescription */ 'The power supply suddenly started to warm up', /* sInitialSituation */ - null, /* aCallerDesc */ + new SOAPExternalKeySearch(), /* aCallerDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ @@ -1402,7 +1402,8 @@ $aWebServices = array( new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ - null, /* aImpact */ + array( + ), /* aImpact */ '1', /* sImpact */ '1', /* sUrgency */ ), @@ -1581,8 +1582,9 @@ class TestWebServicesDirect extends TestBizModel $oWebServices = new WebServices(); global $aWebServices; - foreach ($aWebServices as $aWebService) + foreach ($aWebServices as $i => $aWebService) { + echo "

Test #$i - {$aWebService['verb']}

\n"; $oRes = call_user_func_array(array($oWebServices, $aWebService['verb']), $aWebService['args']); echo "
\n";
 			print_r($oRes);
diff --git a/webservices/itopsoaptypes.class.inc.php b/webservices/itopsoaptypes.class.inc.php
index c024e0133..c55a8283f 100644
--- a/webservices/itopsoaptypes.class.inc.php
+++ b/webservices/itopsoaptypes.class.inc.php
@@ -44,10 +44,16 @@ class SOAPExternalKeySearch
 {
 	public $conditions; // array of SOAPSearchCondition
 
-	public function __construct($aConditions)
+	public function __construct($aConditions = null)
 	{
 		$this->conditions = $aConditions;
 	}
+
+	public function IsVoid()
+	{
+		if (is_null($this->conditions)) return true;
+		if (count($this->conditions) == 0) return true;
+	}
 }
 
 
diff --git a/webservices/webservices.class.inc.php b/webservices/webservices.class.inc.php
index 47307fbd3..7f69d7991 100644
--- a/webservices/webservices.class.inc.php
+++ b/webservices/webservices.class.inc.php
@@ -500,7 +500,7 @@ class WebServices
 
 	static protected function SoapStructToExternalKeySearch(SoapExternalKeySearch $oExternalKeySearch)
 	{
-		if (is_null($oExternalKeySearch)) return null;
+		if ($oExternalKeySearch->IsVoid()) return null;
 
 		$aRes = array();
 		foreach($oExternalKeySearch->conditions as $oSearchCondition)