Browse Source

Adapt the webservice to either 1.x or 2.x datamodels

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2389 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 12 years ago
parent
commit
f979ed8417
2 changed files with 5 additions and 3 deletions
  1. 2 1
      webservices/webservices.basic.php
  2. 3 2
      webservices/webservices.class.inc.php

+ 2 - 1
webservices/webservices.basic.php

@@ -107,11 +107,12 @@ class BasicServices extends WebServicesBase
 		}
 		UserRights::Login($sLogin);
 
+		
 		if (!class_exists('Incident'))
 		{
 			$oRes = new WebServiceResult();
 			$oRes->LogError("The class Incident does not exist. Did you install the Incident Management (ITIL) module ?");
-			return $oRes;
+			return $oRes->ToSoapStructure();
 		}
 		
 		$aCallerDesc = self::SoapStructToExternalKeySearch($oCallerDesc);

+ 3 - 2
webservices/webservices.class.inc.php

@@ -134,10 +134,11 @@ class WebServiceResult
 	 */
 	public function AddResultObject($sLabel, $oObject)
 	{
+		$oAppContext = new ApplicationContext();
 		$this->m_aResult[$sLabel] = array(
 			'id' => $oObject->GetKey(),
 			'name' => $oObject->GetRawName(),
-			'url' => $oObject->GetHyperlink(),
+			'url' => $oAppContext->MakeObjectUrl(get_class($oObject), $oObject->GetKey(), null, false), // Raw URL without HTML tags
 		);
 	}
 
@@ -297,7 +298,7 @@ abstract class WebServicesBase
 		if (is_object($oAttDef))
 		{
 			$iMaxSize = $oAttDef->GetMaxSize();
-			if ($iMaxSize)
+			if ($iMaxSize && (strlen($sValue) > $iMaxSize))
 			{
 				$sValue = substr($sValue, 0, $iMaxSize);
 			}