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

SVN:trunk[2389]
This commit is contained in:
Denis Flaven
2012-10-26 14:11:30 +00:00
parent 5af0f5f320
commit 40cc93e5f5
2 changed files with 5 additions and 3 deletions

View File

@@ -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);

View File

@@ -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);
}