Prechádzať zdrojové kódy

#153 Warning issued by the SOAP web services

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@614 a333f486-631f-4898-b8df-5754b55c2be0
romainq 15 rokov pred
rodič
commit
3ab6e4ca77

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

+ 5 - 3
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 "<h2>Test #$i - {$aWebService['verb']} </h2>\n";
 			$oRes = call_user_func_array(array($oWebServices, $aWebService['verb']), $aWebService['args']);
 			echo "<pre>\n";
 			print_r($oRes);

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

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