mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Merge remote-tracking branch 'origin/support/2.5'
# Conflicts: # application/applicationextension.inc.php # webservices/rest.php
This commit is contained in:
@@ -257,13 +257,14 @@ class CoreServices implements iRestServiceProvider
|
||||
*/
|
||||
public function ListOperations($sVersion)
|
||||
{
|
||||
// 1.4 - iTop 2.5.2, 2.6.1, 2.7.0, Verb 'core/get': added pagination parameters limit and page
|
||||
// 1.3 - iTop 2.2.0, Verb 'get_related': added the options 'redundancy' and 'direction' to take into account the redundancy in the impact analysis
|
||||
// 1.2 - was documented in the wiki but never released ! Same as 1.3
|
||||
// 1.1 - In the reply, objects have a 'key' entry so that it is no more necessary to split class::key programmaticaly
|
||||
// 1.0 - Initial implementation in iTop 2.0.1
|
||||
//
|
||||
$aOps = array();
|
||||
if (in_array($sVersion, array('1.0', '1.1', '1.2', '1.3')))
|
||||
if (in_array($sVersion, array('1.0', '1.1', '1.2', '1.3', '1.4')))
|
||||
{
|
||||
$aOps[] = array(
|
||||
'verb' => 'core/create',
|
||||
@@ -299,9 +300,16 @@ class CoreServices implements iRestServiceProvider
|
||||
|
||||
/**
|
||||
* Enumerate services delivered by this class
|
||||
*
|
||||
* @param string $sVersion The version (e.g. 1.0) supported by the services
|
||||
* @param string $sVerb
|
||||
* @param $aParams
|
||||
*
|
||||
* @return RestResult The standardized result structure (at least a message)
|
||||
* @throws Exception in case of internal failure.
|
||||
* @throws \CoreException
|
||||
* @throws \CoreUnexpectedValue
|
||||
* @throws \SimpleGraphException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function ExecOperation($sVersion, $sVerb, $aParams)
|
||||
{
|
||||
|
||||
@@ -1163,10 +1163,30 @@ class ObjectFormManager extends FormManager
|
||||
}
|
||||
elseif ($oAttDef->GetEditClass() === 'CustomFields')
|
||||
{
|
||||
if (!empty($value['template_data']) && !empty($value['user_data']))
|
||||
// We don't update attribute as ormCustomField comparaison is not working as excepted.
|
||||
// When several templates available, "template_id" is not sent by the portal has it is a read-only select input
|
||||
// therefore, the TemplateFieldsHandler::CompareValues() doesn't work.
|
||||
// This use case works in the console as it always send all fields, even hidden and read-only.
|
||||
|
||||
// Different templates
|
||||
if( isset($value['template_id'])
|
||||
&& ($value['template_id'] != $value['current_template_id']) )
|
||||
{
|
||||
$this->oObject->Set($sAttCode, $value);
|
||||
}
|
||||
// Same template, different fields
|
||||
elseif(isset($value['template_id'], $value['template_data'])
|
||||
&& ($value['template_id'] == $value['current_template_id'])
|
||||
&& ($value['template_data'] != $value['current_template_data']) )
|
||||
{
|
||||
$this->oObject->Set($sAttCode, $value);
|
||||
}
|
||||
// Update of current values
|
||||
elseif(isset($value['user_data']))
|
||||
{
|
||||
$this->oObject->Set($sAttCode, $value);
|
||||
}
|
||||
// Else don't update! Otherwise we might loose current value
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@ class RestResultListOperations extends RestResult
|
||||
$this->operations[] = array(
|
||||
'verb' => $sVerb,
|
||||
'description' => $sDescription,
|
||||
'extension' => $sServiceProviderClass
|
||||
'extension' => $sServiceProviderClass,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ if (!function_exists('json_last_error_msg')) {
|
||||
JSON_ERROR_STATE_MISMATCH => 'State mismatch (invalid or malformed JSON)',
|
||||
JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded',
|
||||
JSON_ERROR_SYNTAX => 'Syntax error',
|
||||
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded'
|
||||
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded',
|
||||
);
|
||||
|
||||
$error = json_last_error();
|
||||
@@ -186,6 +186,7 @@ try
|
||||
}
|
||||
|
||||
$aOpToRestService = array(); // verb => $oRestServiceProvider
|
||||
/** @var iRestServiceProvider $oRestSP */
|
||||
foreach ($aProviders as $oRestSP)
|
||||
{
|
||||
$aOperations = $oRestSP->ListOperations($sVersion);
|
||||
|
||||
@@ -36,8 +36,8 @@ class BasicServices extends WebServicesBase
|
||||
|
||||
/**
|
||||
* Get the server version (TODO: get it dynamically, where ?)
|
||||
*
|
||||
* @return WebServiceResult
|
||||
*
|
||||
* @return string WebServiceResult
|
||||
*/
|
||||
static public function GetVersion()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user