diff --git a/pages/testlist.inc.php b/pages/testlist.inc.php index d8392be34..b1b47dd1c 100644 --- a/pages/testlist.inc.php +++ b/pages/testlist.inc.php @@ -1288,24 +1288,24 @@ $aWebServices = array( 'desc of ticket', /* sDescription */ 'initial situation blah blah blah', /* sInitialSituation */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'HW Management'))), /* aServiceDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ array( new SOAPLinkCreationSpec( 'InfrastructureCI', - array(new SOAPSearchCondition('id', 108)), + array(new SOAPSearchCondition('name', 'dbserver1.demo.com')), array(new SOAPAttributeValue('impacting', 'very critical')) ), new SOAPLinkCreationSpec( 'NetworkDevice', - array(new SOAPSearchCondition('name', 'Router03')), + array(new SOAPSearchCondition('name', 'switch01')), array(new SOAPAttributeValue('impact', 'who cares')) ), new SOAPLinkCreationSpec( - 'Device', + 'Server', array(new SOAPSearchCondition('name', 'thisone')), array(new SOAPAttributeValue('impact', 'our lives')) ), @@ -1324,15 +1324,15 @@ $aWebServices = array( 'PC burning', /* sDescription */ 'The power supply suddenly started to warm up', /* sInitialSituation */ new SOAPExternalKeySearch(), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'HW Management'))), /* aServiceDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ array( new SOAPLinkCreationSpec( 'InfrastructureCI', - array(new SOAPSearchCondition('id', 1)), + array(new SOAPSearchCondition('name', 'dbserver1.demo.com')), array() ), /* aImpact */ ), @@ -1343,18 +1343,18 @@ $aWebServices = array( array( 'verb' => 'CreateIncidentTicket', 'expected result' => false, - 'explain result' => 'wrong condition on CI to attach', + 'explain result' => 'wrong class on CI to attach', 'args' => array( 'admin', /* sLogin */ 'admin', /* sPassword */ 'PC burning', /* sDescription */ 'The power supply suddenly started to warm up', /* sInitialSituation */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'HW Management'))), /* aServiceDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ array( new SOAPLinkCreationSpec( 'logInfra', @@ -1366,6 +1366,32 @@ $aWebServices = array( '1', /* sUrgency */ ), ), + array( + 'verb' => 'CreateIncidentTicket', + 'expected result' => false, + 'explain result' => 'wrong search condition on CI to attach', + 'args' => array( + 'admin', /* sLogin */ + 'admin', /* sPassword */ + 'PC burning', /* sDescription */ + 'The power supply suddenly started to warm up', /* sInitialSituation */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'HW Management'))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + 'sub product of the service', /* sProduct */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ + array( + new SOAPLinkCreationSpec( + 'InfrastructureCI', + array(new SOAPSearchCondition('dummyfiltercode', 2)), + array(new SOAPAttributeValue('impact', 'very critical')) + ), + ), /* aImpact */ + '1', /* sImpact */ + '1', /* sUrgency */ + ), + ), array( 'verb' => 'CreateIncidentTicket', 'expected result' => true, @@ -1376,11 +1402,11 @@ $aWebServices = array( 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'HW Management'))), /* aServiceDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ array( ), /* aImpact */ '1', /* sImpact */ @@ -1397,13 +1423,12 @@ $aWebServices = array( 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'HW Management'))), /* aServiceDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ - array( - ), /* aImpact */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ + null, /* aImpact */ '1', /* sImpact */ '1', /* sUrgency */ ), @@ -1418,11 +1443,11 @@ $aWebServices = array( 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1000))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'HW Management'))), /* aServiceDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ array( ), /* aImpact */ '1', /* sImpact */ @@ -1432,22 +1457,22 @@ $aWebServices = array( array( 'verb' => 'CreateIncidentTicket', 'expected result' => false, - 'explain result' => 'wrong values for type and severity', + 'explain result' => 'wrong values for impact and urgency', 'args' => array( 'admin', /* sLogin */ 'admin', /* sPassword */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'HW Management'))), /* aServiceDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ array( ), /* aImpact */ - '1', /* sImpact */ - '1', /* sUrgency */ + '6', /* sImpact */ + '7', /* sUrgency */ ), ), array( @@ -1460,11 +1485,11 @@ $aWebServices = array( 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'HW Management'))), /* aServiceDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ array( ), /* aImpact */ '1', /* sImpact */ @@ -1481,11 +1506,11 @@ $aWebServices = array( 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'HW Management'))), /* aServiceDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ array( ), /* aImpact */ '1', /* sImpact */ @@ -1529,7 +1554,8 @@ class TestSoap extends TestSoapWebService global $aWebServices; foreach ($aWebServices as $iPos => $aWebService) { - echo "

SOAP call #$iPos ".$aWebService['explain result']."

\n"; + echo "

SOAP call #$iPos - {$aWebService['verb']}

\n"; + echo "

{$aWebService['explain result']}

\n"; try { @@ -1582,9 +1608,10 @@ class TestWebServicesDirect extends TestBizModel $oWebServices = new WebServices(); global $aWebServices; - foreach ($aWebServices as $i => $aWebService) + foreach ($aWebServices as $iPos => $aWebService) { - echo "

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

\n"; + echo "

SOAP call #$iPos - {$aWebService['verb']}

\n"; + echo "

{$aWebService['explain result']}

\n"; $oRes = call_user_func_array(array($oWebServices, $aWebService['verb']), $aWebService['args']); echo "
\n";
 			print_r($oRes);
diff --git a/webservices/webservices.class.inc.php b/webservices/webservices.class.inc.php
index 7f69d7991..aa853dc5d 100644
--- a/webservices/webservices.class.inc.php
+++ b/webservices/webservices.class.inc.php
@@ -487,7 +487,7 @@ class WebServices
 			if ($bRes)
 			{
 				$iId = $oTargetObj->DBInsertTrackedNoReload($oChange);
-				$oRes->LogInfo("Created object ".get_class($$oTargetObj)."::$iId");
+				$oRes->LogInfo("Created object ".get_class($oTargetObj)."::$iId");
 				$oRes->AddResultObject($sResultLabel, $oTargetObj);
 			}
 			else
@@ -558,7 +558,9 @@ class WebServices
 		$aServiceDesc = self::SoapStructToExternalKeySearch($oServiceDesc);
 		$aServiceSubcategoryDesc = self::SoapStructToExternalKeySearch($oServiceSubcategoryDesc);
 		$aWorkgroupDesc = self::SoapStructToExternalKeySearch($oWorkgroupDesc);
+
 		$aImpactedCIs = array();
+		if (is_null($aSOAPImpactedCIs)) $aSOAPImpactedCIs = array();
 		foreach($aSOAPImpactedCIs as $oImpactedCIs)
 		{
 			$aImpactedCIs[] = self::SoapStructToLinkCreationSpec($oImpactedCIs);