Merge remote-tracking branch 'origin/support/3.0' into develop

This commit is contained in:
Eric Espie
2022-03-03 10:23:38 +01:00
54 changed files with 631 additions and 901 deletions

View File

@@ -632,7 +632,7 @@ HTML
.'&attcode='.$oAttDef->GetCode()
.$sHostContainerInEditionUrlParam,
true,
'Class:'.$sClass.'/Attribute:'.$sAttCode,
$oAttDef->GetLabel(),
AjaxTab::ENUM_TAB_PLACEHOLDER_DASHBOARD
);
// Add graphs dependencies

View File

@@ -2108,11 +2108,21 @@ class utils
}
/**
* Returns the relative (to MODULESROOT) path of the root directory of the module containing the file where the call to
* this function is made
* or an empty string if no such module is found (or not called within a module file)
* @param number $iCallDepth The depth of the module in the callstack. Zero when called directly from within the module
* @return string
* **Warning** : returned result can be invalid as we're using backtrace to find the module dir name
*
* @param int $iCallDepth The depth of the module in the callstack. Zero when called directly from within the module
*
* @return string the relative (to MODULESROOT) path of the root directory of the module containing the file where the call to
* this function is made
* or an empty string if no such module is found (or not called within a module file)
*
* @uses \debug_backtrace()
*
* @since 3.0.0 Before writing model.*.php file, compiler will now always delete it.
* If you have symlinks enabled, base dir will be original module dir, but since this behavior change this won't be true anymore for model.*.php
* In consequence the backtrace analysis won't be possible for this file
* See N°4854
* @link https://www.itophub.io/wiki/page?id=3_0_0%3Arelease%3A3_0_whats_new#compiler_always_generate_new_model_php compiler behavior change documentation
*/
public static function GetCurrentModuleDir($iCallDepth)
{
@@ -2137,9 +2147,14 @@ class utils
}
/**
* **Warning** : as this method uses {@see GetCurrentModuleDir} it produces hazardous results.
* You should better uses directly {@see GetAbsoluteUrlModulesRoot} and add the module dir name yourself ! See N°4573
*
* @return string the base URL for all files in the current module from which this method is called
* or an empty string if no such module is found (or not called within a module file)
* @throws \Exception
*
* @uses GetCurrentModuleDir
*/
public static function GetCurrentModuleUrl()
{

View File

@@ -2934,6 +2934,54 @@ abstract class DBObject implements iDisplay
utils::EnrichRaisedException($oTrigger, $e);
}
}
// - TriggerOnObjectMention
// 1 - Check if any caselog updated
$aChanges = $this->m_aOrigValues;
$aUpdatedLogAttCodes = array();
foreach($aChanges as $sAttCode => $value)
{
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
if($oAttDef instanceof AttributeCaseLog && $value->GetModifiedEntry() !== '')
{
$aUpdatedLogAttCodes[] = $sAttCode;
}
}
// 2 - Find mentioned objects
$aMentionedObjects = array();
foreach ($aUpdatedLogAttCodes as $sAttCode) {
/** @var \ormCaseLog $oUpdatedCaseLog */
$oUpdatedCaseLog = $this->Get($sAttCode);
$aMentionedObjects = array_merge_recursive($aMentionedObjects, utils::GetMentionedObjectsFromText($oUpdatedCaseLog->GetModifiedEntry()));
}
// 3 - Trigger for those objects
// TODO: This should be refactored and moved into the caselogs loop, otherwise, we won't be able to know which case log triggered the action.
foreach ($aMentionedObjects as $sMentionedClass => $aMentionedIds) {
foreach ($aMentionedIds as $sMentionedId) {
/** @var \DBObject $oMentionedObject */
$oMentionedObject = MetaModel::GetObject($sMentionedClass, $sMentionedId);
$aTriggerArgs = $this->ToArgs('this') + array('mentioned->object()' => $oMentionedObject);
$aParams = array('class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObjectMention AS t WHERE t.target_class IN (:class_list)"), array(), $aParams);
while ($oTrigger = $oSet->Fetch())
{
/** @var \TriggerOnObjectMention $oTrigger */
try {
// Ensure to handle only mentioned object in the trigger's scope
if ($oTrigger->IsMentionedObjectInScope($oMentionedObject) === false) {
continue;
}
$oTrigger->DoActivate($aTriggerArgs);
}
catch (Exception $e) {
utils::EnrichRaisedException($oTrigger, $e);
}
}
}
}
return $this->m_iKey;
}

View File

@@ -31,13 +31,13 @@ class iTopOwnershipToken extends DBObject
{
$aParams = array
(
'category' => 'application',
'key_type' => 'autoincrement',
'name_attcode' => array('obj_class', 'obj_key'),
'state_attcode' => '',
'reconc_keys' => array(''),
'db_table' => 'priv_ownership_token',
'db_key_field' => 'id',
'category' => '',
'key_type' => 'autoincrement',
'name_attcode' => array('obj_class', 'obj_key'),
'state_attcode' => '',
'reconc_keys' => array(''),
'db_table' => 'priv_ownership_token',
'db_key_field' => 'id',
'db_finalclass_field' => '',
);
MetaModel::Init_Params($aParams);

View File

@@ -64,6 +64,8 @@ $ibo-input-select--autocomplete-item-image--border: 1px solid $ibo-color-grey-60
color: inherit;
border-color: $ibo-color-white-100;
padding-left: $ibo-input-select--padding-x;
@extend %ibo-font-ral-nor-150;
}
> [data-value] {

View File

@@ -12,4 +12,5 @@
@import "datamodel-viewer";
@import "csv-import";
@import "global-search";
@import "run-query";
@import "welcome-popup";

View File

@@ -0,0 +1,10 @@
/*
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
$ibo-run-query--highlight--background-color: $ibo-color-primary-300 !default;
.ibo-run-query--highlight{
background-color: $ibo-run-query--highlight--background-color;
}

View File

@@ -29,6 +29,8 @@ use utils;
*/
class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExtension, iLoginUIExtension
{
const LOGIN_MODE = 'cas';
/**
* Return the list of supported login modes for this plugin
*
@@ -36,7 +38,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
*/
public function ListSupportedLoginModes()
{
return array('cas');
return array(static::LOGIN_MODE);
}
protected function OnStart(&$iErrorCode)
@@ -47,12 +49,12 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
protected function OnReadCredentials(&$iErrorCode)
{
if (Session::Get('login_mode') == 'cas')
if (empty(Session::Get('login_mode')) || Session::Get('login_mode') == static::LOGIN_MODE)
{
static::InitCASClient();
if (phpCAS::isAuthenticated())
{
Session::Set('login_mode', 'cas');
Session::Set('login_mode', static::LOGIN_MODE);
Session::Set('auth_user', phpCAS::getUser());
Session::Unset('login_will_redirect');
}
@@ -68,7 +70,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
$iErrorCode = LoginWebPage::EXIT_CODE_MISSINGLOGIN;
return LoginWebPage::LOGIN_FSM_ERROR;
}
Session::Set('login_mode', 'cas');
Session::Set('login_mode', static::LOGIN_MODE);
phpCAS::forceAuthentication(); // Redirect to CAS and exit
}
}
@@ -77,7 +79,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
protected function OnCheckCredentials(&$iErrorCode)
{
if (Session::Get('login_mode') == 'cas')
if (Session::Get('login_mode') == static::LOGIN_MODE)
{
if (!Session::IsSet('auth_user'))
{
@@ -94,7 +96,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
protected function OnCredentialsOK(&$iErrorCode)
{
if (Session::Get('login_mode') == 'cas')
if (Session::Get('login_mode') == static::LOGIN_MODE)
{
$sAuthUser = Session::Get('auth_user');
if (!LoginWebPage::CheckUser($sAuthUser))
@@ -109,7 +111,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
protected function OnError(&$iErrorCode)
{
if (Session::Get('login_mode') == 'cas')
if (Session::Get('login_mode') == static::LOGIN_MODE)
{
Session::Unset('phpCAS');
if ($iErrorCode != LoginWebPage::EXIT_CODE_MISSINGLOGIN)
@@ -124,7 +126,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
protected function OnConnected(&$iErrorCode)
{
if (Session::Get('login_mode') == 'cas')
if (Session::Get('login_mode') == static::LOGIN_MODE)
{
Session::Set('can_logoff', true);
return LoginWebPage::CheckLoggedUser($iErrorCode);
@@ -205,7 +207,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
$oLoginContext->SetLoaderPath(APPROOT.'env-'.utils::GetCurrentEnvironment().'/authent-cas/view');
$aData = array(
'sLoginMode' => 'cas',
'sLoginMode' => static::LOGIN_MODE,
'sLabel' => Dict::S('CAS:Login:SignIn'),
'sTooltip' => Dict::S('CAS:Login:SignInTooltip'),
);

View File

@@ -247,3 +247,5 @@ $ibo-vendors-c3--legend--fill: $ibo-color-white-200;
$ibo-vendors-c3--legend--background-color: $ibo-color-white-100;
$ibo-vendors-c3--legend-item--fill: $ibo-color-grey-100;
$ibo-vendors-c3--axis--fill: $ibo-color-grey-200;
$ibo-run-query--highlight--background-color: $ibo-color-primary-700;

View File

@@ -21,7 +21,8 @@
<module>combodo-db-tools</module>
<module>itop-core-update</module>
<module>itop-hub-connector</module>
<module>combodo-backoffice-darkmoon-theme</module>
<module>combodo-backoffice-darkmoon-theme</module>
<module>itop-themes-compat</module>
</modules>
<mandatory>true</mandatory>
</choice>

View File

@@ -0,0 +1,2 @@
# Extension Light grey and Test red themes compatibility

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('CS CZ', 'Czech', 'Čeština', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('DA DA', 'Danish', 'Dansk', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design version="3.0">
<branding>
<themes>
<theme id="light-grey" _delta="define">
<variables>
</variables>
<imports>
<import id="css-variables">itop-themes-compat/assets/css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">itop-themes-compat/assets/css/compat.scss</stylesheet>
<stylesheet id="main">itop-themes-compat/assets/css/compat.scss</stylesheet>
<stylesheet id="fullmoon">../css/backoffice/main.scss</stylesheet>
</stylesheets>
</theme>
<theme id="test-red" _delta="must_exist">
<variables>
<variable id="backoffice-environment-banner-background-color" _delta="define">#C53030</variable>
<variable id="backoffice-environment-banner-text-color" _delta="define">#F7FAFC</variable>
<variable id="backoffice-environment-banner-text-content" _delta="define">"THIS IS A TEST INSTANCE"</variable>
</variables>
<imports>
<import id="css-variables" _delta="define">itop-themes-compat/assets/css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui" _delta="define">itop-themes-compat/assets/css/compat.scss</stylesheet>
<stylesheet id="main" _delta="define">itop-themes-compat/assets/css/compat.scss</stylesheet>
</stylesheets>
</theme>
</themes>
</branding>
</itop_design>

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('DE DE', 'German', 'Deutsch', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('EN US', 'English', 'English', array(
'theme:light-grey' => 'Light Grey (deprecated)',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('ES CR', 'Spanish', 'Español, Castellaño', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('FR FR', 'French', 'Français', array(
'theme:light-grey' => 'Light Grey (obsolète)',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('IT IT', 'Italian', 'Italiano', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('JA JP', 'Japanese', '日本語', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,17 @@
<?php
// PHP Data Model definition file
// WARNING - WARNING - WARNING
// DO NOT EDIT THIS FILE (unless you know what you are doing)
//
// If you provide a datamodel.xxxx.xml file with your module,
// this file WILL BE overwritten by the compilation of the
// module (during the setup) if the datamodel.xxxx.xml file
// contains the definition of new classes or menus.
//
// The recommended way to define new classes (for iTop 2.0 and later) is via the XML definition.
// This file remains in the module's template only for the cases where there is:
// - either no new class or menu defined in the XML file
// - or no XML file at all supplied by the module

View File

@@ -0,0 +1,52 @@
<?php
//
// iTop module definition file
//
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'itop-themes-compat/3.0.1',
array(
// Identification
//
'label' => 'Light grey and Test red themes compatibility',
'category' => 'business',
// Setup
//
'dependencies' => array(
'itop-structure/3.0.1',
),
'mandatory' => false,
'visible' => true,
// Components
//
'datamodel' => array(
'model.itop-themes-compat.php', // Contains the PHP code generated by the "compilation" of datamodel.itop-themes-compat.xml
),
'webservice' => array(
),
'data.struct' => array(
// add your 'structure' definition XML files here,
),
'data.sample' => array(
// add your sample data XML files here,
),
// Documentation
//
'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any
'doc.more_information' => '', // hyperlink to more information, if any
// Default settings
//
'settings' => array(
// Module specific settings go here, if any
),
)
);
?>

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('RU RU', 'Russian', 'Русский', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -0,0 +1,11 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('ZH CN', 'Chinese', '简体中文', array(
'theme:light-grey' => 'Light Grey (deprecated)~~',
));

View File

@@ -25,8 +25,10 @@ Selectize.define('custom_itop', function(aOptions) {
if (this.$control_input.val() === '' && !this.$activeItems.length) {
iIndex = this.caretPos-1;
if (iIndex >= 0 && iIndex < this.items.length) {
let sPreviousValue = this.options[this.items[iIndex]].search_label;
this.clear(true);
e.preventDefault();
this.setTextboxValue(sPreviousValue.slice(0, -1));
return;
}
}

View File

@@ -17,10 +17,16 @@
*/
// Helpers
function ShowAboutBox()
function ShowAboutBox(sTitle)
{
var loadingDialog = $('<div style="padding-top:40px; padding-left:40px;"><i class="fa fa-sync-alt fa-spin fa-x fa-fw"></i></div>');
loadingDialog.dialog( {title:sTitle,autoOpen: true, modal: true});
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', {operation: 'about_box'}, function(data){
$('body').append(data);
}).always(function() {
loadingDialog.empty();
loadingDialog.remove();
});
return false;
}

View File

@@ -1060,7 +1060,8 @@ EOF
$iCol = utils::ReadParam("iCol");
$sDashletIdOrig = utils::ReadParam("dashletid");
$sFinalDashletId = Dashboard::GetDashletUniqueId($bIsCustomized, $sDashboardDivId, $iRow, $iCol, $sDashletIdOrig);
$oPage = new DownloadPage('');
$oPage = new AjaxPage('');
$oPage->SetOutputDataOnly(true);
$oPage->add($sFinalDashletId);
break;

View File

@@ -66,7 +66,7 @@ function ShowExamples($oP, $sExpression)
$sDisable = '';
if ($sOql == $sExpression) {
// this one is currently being tested, highlight it
$sHighlight = "background-color:yellow;";
$sHighlight = "ibo-run-query--highlight";
$sDisable = 'disabled';
// and remember we are testing a query of the list
$bUsingExample = true;
@@ -79,8 +79,8 @@ function ShowExamples($oP, $sExpression)
$oFormButton->AddSubBlock(new Html($sContext));
//$aDisplayData[$sTopic][] = array(
$aDisplayData[Dict::S('UI:RunQuery:QueryExamples')][] = array(
'desc' => "<div style=\"$sHighlight\">".utils::EscapeHtml($sDescription)."</div>",
'oql' => "<div style=\"$sHighlight\">".utils::EscapeHtml($sOql)."</div>",
'desc' => "<div class=\"$sHighlight\">".utils::EscapeHtml($sDescription)."</div>",
'oql' => "<div class=\"$sHighlight\">".utils::EscapeHtml($sOql)."</div>",
'go' => BlockRenderer::RenderBlockTemplates($oFormButton),
);
}
@@ -313,7 +313,7 @@ EOF
$sBefore = substr($sExpression, 0, $e->GetColumn());
$sAfter = substr($sExpression, $e->GetColumn() + strlen($sWrongWord));
$sFixedExpression = $sBefore.$sSuggestedWord.$sAfter;
$sFixedExpressionHtml = $sBefore.'<span style="background-color:yellow">'.$sSuggestedWord.'</span>'.$sAfter;
$sFixedExpressionHtml = $sBefore.'<span class="ibo-run-query--highlight">'.$sSuggestedWord.'</span>'.$sAfter;
$sSyntaxErrorText .= "<p>Suggesting: $sFixedExpressionHtml</p>";
$oSyntaxErrorPanel->AddSubBlock(new Html($sSyntaxErrorText));

View File

@@ -3542,12 +3542,22 @@ EOF;
/**
* Write a file only if not exists
* Also add some informations in case of a write failleure
* @param $sFilename
* @param $sContent
* Also add some informations when write failure occurs
*
* @param string $sFilename
* @param string $sContent
* @param int $flags
*
* @return bool|int
* @throws \Exception
*
* @uses \unlink()
* @uses \file_put_contents()
*
* @since 3.0.0 The file is removed before writing (commit c5d265f6)
* For now this causes model.*.php files to always be located in env-* dir, even if symlinks are enabled
* See N°4854
* @link https://www.itophub.io/wiki/page?id=3_0_0%3Arelease%3A3_0_whats_new#compiler_always_generate_new_model_php compiler behavior change documentation
*/
protected function WriteFile($sFilename, $sContent, $flags = null)
{

View File

@@ -17,8 +17,6 @@
* You should have received a copy of the GNU Affero General Public License
*/
use Combodo\iTop\DesignDocument;
/**
* Utility to upgrade the format of a given XML datamodel to the latest version
@@ -117,8 +115,6 @@ class iTopDesignFormat
*/
protected $aLog;
protected $bStatus;
protected $bKeepObsoleteNodes;
protected $sKeepVersion;
/**
* Creation from a loaded DOMDocument
@@ -220,20 +216,6 @@ class iTopDesignFormat
return self::GetItopNodePath($oNode->parentNode).'/'.$sNodeDesc;
}
/**
* Compute a real xpath from iTop one
*
* @param \Combodo\iTop\DesignElement $oNode
*
* @return string
*/
public static function GetNodeXPath($oNode)
{
$sITopXPath = DesignDocument::GetItopNodePath($oNode);
return preg_replace(["@\[@", "@]@"], ["[@id=\"", "\"]"], $sITopXPath);
}
/**
* Test the conversion without altering the DOM
*
@@ -251,21 +233,19 @@ class iTopDesignFormat
}
/**
* Make adjustments to the DOM to migrate it to the specified version (default is latest)
* Make adjustements to the DOM to migrate it to the specified version (default is latest)
* For now only the conversion from version 1.0 to 1.1 is supported.
*
* @param string $sTargetVersion The desired version (or the latest possible version if not specified)
* @param \ModelFactory|null $oFactory Full data model (not yet used, aimed at allowing conversion that could not be performed without knowing the
* @param object $oFactory Full data model (not yet used, aimed at allowing conversion that could not be performed without knowing the
* whole data model)
* @param bool $bKeepObsoleteNodes
*
* @return bool True on success, False if errors have been encountered (still the DOM may be altered!)
*/
public function Convert($sTargetVersion = ITOP_DESIGN_LATEST_VERSION, $oFactory = null, $bKeepObsoleteNodes = true)
public function Convert($sTargetVersion = ITOP_DESIGN_LATEST_VERSION, $oFactory = null)
{
$this->aLog = array();
$this->bStatus = true;
$this->bKeepObsoleteNodes = $bKeepObsoleteNodes;
$oXPath = new DOMXPath($this->oDocument);
// Retrieve the version number
@@ -328,7 +308,6 @@ class iTopDesignFormat
$sIntermediate = self::$aVersions[$sFrom]['next'];
$sTransform = self::$aVersions[$sFrom]['go_to_next'];
$this->LogInfo("Upgrading from $sFrom to $sIntermediate ($sTransform)");
$this->sKeepVersion = $sFrom;
}
else
{
@@ -336,16 +315,12 @@ class iTopDesignFormat
$sIntermediate = self::$aVersions[$sFrom]['previous'];
$sTransform = self::$aVersions[$sFrom]['go_to_previous'];
$this->LogInfo("Downgrading from $sFrom to $sIntermediate ($sTransform)");
$this->sKeepVersion = null;
}
// Transform to the intermediate format
$aCallSpec = array($this, $sTransform);
try
{
call_user_func($aCallSpec, $oFactory);
if ($iFrom > $iTo && $this->bKeepObsoleteNodes) {
$this->RestorePreviousNodes($sIntermediate);
}
// Recurse
$this->DoConvert($sIntermediate, $sTo, $oFactory);
@@ -698,8 +673,6 @@ class iTopDesignFormat
*/
protected function From16To15($oFactory)
{
$oXPath = new DOMXPath($this->oDocument);
// Remove AttributeTagSet nodes
//
$sPath = "/itop_design/classes/class/fields/field[@xsi:type='AttributeTagSet']";
@@ -836,15 +809,7 @@ class iTopDesignFormat
$oNode->appendChild($oCodeNode);
}
// N°3516 Remove legacy backoffice theme
// Remove completely light-grey theme
$this->RemoveNodeFromXPath('/itop_design/branding/themes/theme[@id="light-grey"]');
// Update test-red theme
$this->RemoveNodeFromXPath('/itop_design/branding/themes/theme[@id="test-red"]/imports/import[@id="css-variables"]');
$this->RemoveNodeFromXPath('/itop_design/branding/themes/theme[@id="test-red"]/stylesheets/stylesheet[@id="jqueryui"]');
$this->RemoveNodeFromXPath('/itop_design/branding/themes/theme[@id="test-red"]/stylesheets/stylesheet[@id="main"]');
$oNodeList = $oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="backoffice-environment-banner-background-color"]');
foreach ($oNodeList as $oNode) {
$oNode->setAttribute('id', 'ibo-page-banner--background-color');
@@ -860,21 +825,6 @@ class iTopDesignFormat
$oNode->setAttribute('id', 'ibo-page-banner--text-content');
}
$this->RemoveNodeFromXPath('/itop_design/branding/themes/theme[@id="test-red"]/stylesheets/stylesheet[@id="environment-banner"]');
// Add new stylesheets
$oStyleSheetsNode = $oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/stylesheets')->item(0);
if ($oStyleSheetsNode) {
$oStyleSheetNode = $oStyleSheetsNode->ownerDocument->createElement("stylesheet");
$oStyleSheetNode->setAttribute('id', 'environment-banner');
$oStyleSheetNode->appendChild(new DOMText('../css/backoffice/themes/page-banner.scss'));
$oStyleSheetsNode->appendChild($oStyleSheetNode);
$oStyleSheetNode = $oStyleSheetsNode->ownerDocument->createElement("stylesheet");
$oStyleSheetNode->setAttribute('id', 'fullmoon');
$oStyleSheetNode->appendChild(new DOMText('../css/backoffice/main.scss'));
$oStyleSheetsNode->appendChild($oStyleSheetNode);
}
// Add new attribute to theme import nodes
$oNodeList = $oXPath->query('/itop_design/branding/themes/theme/imports/import');
foreach ($oNodeList as $oNode) {
@@ -954,24 +904,27 @@ class iTopDesignFormat
// N°3516 Bring back legacy themes
// Update test-red theme
$oNodeList = $oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="ibo-page-banner--background-color"]');
foreach ($oNodeList as $oNode) {
$oNode->setAttribute('id', 'backoffice-environment-banner-background-color');
if (!$oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="backoffice-environment-banner-background-color"]')->item(0)) {
$oNodeList = $oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="ibo-page-banner--background-color"]');
foreach ($oNodeList as $oNode) {
$oNode->setAttribute('id', 'backoffice-environment-banner-background-color');
}
}
$oNodeList = $oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="ibo-page-banner--text-color"]');
foreach ($oNodeList as $oNode) {
$oNode->setAttribute('id', 'backoffice-environment-banner-text-color');
if (!$oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="backoffice-environment-banner-text-color"]')->item(0)) {
$oNodeList = $oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="ibo-page-banner--text-color"]');
foreach ($oNodeList as $oNode) {
$oNode->setAttribute('id', 'backoffice-environment-banner-text-color');
}
}
$oNodeList = $oXPath->query( '/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="ibo-page-banner--text-content"]');
foreach ($oNodeList as $oNode) {
$oNode->setAttribute('id', 'backoffice-environment-banner-text-content');
if (!$oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="backoffice-environment-banner-text-content"]')->item(0)) {
$oNodeList = $oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="ibo-page-banner--text-content"]');
foreach ($oNodeList as $oNode) {
$oNode->setAttribute('id', 'backoffice-environment-banner-text-content');
}
}
$this->RemoveNodeFromXPath('/itop_design/branding/themes/theme[@id="test-red"]/stylesheets/stylesheet[@id="environment-banner"]');
$this->RemoveNodeFromXPath('/itop_design/branding/themes/theme[@id="test-red"]/stylesheets/stylesheet[@id="fullmoon"]');
// Add new attribute to theme import nodes
$oNodeList = $oXPath->query('/itop_design/branding/themes/theme/imports/import');
@@ -1012,88 +965,12 @@ class iTopDesignFormat
//nothing
}
/**
* @param string $sNodeMetaVersion
*
* @return void
* @throws \Exception
*/
private function RestorePreviousNodes($sNodeMetaVersion)
{
$oXPath = new DOMXPath($this->oDocument);
$sVersion = str_replace('.', '_', $sNodeMetaVersion);
$oTrashedNodes = $oXPath->query("/itop_design/meta/previous_versions/previous_version_$sVersion/trashed_nodes/trashed_node");
foreach ($oTrashedNodes as $oTrashedNode) {
if ($oTrashedNode->nodeType == XML_ELEMENT_NODE) {
$oXPathNode = $oXPath->query('parent_xpath', $oTrashedNode)->item(0);
$oNodeTreeNode = $oXPath->query('node_tree', $oTrashedNode)->item(0);
if (!is_null($oXPathNode) && !is_null($oNodeTreeNode)) {
$sXPath = $this->GetText($oXPathNode, '');
$oParentNode = $oXPath->query($sXPath)->item(0);
if ($oParentNode) {
$oNode = $oNodeTreeNode->firstChild;
while ($oNode) {
$oNextNode = $oNode->nextSibling;
if ($oNode->nodeType == XML_ELEMENT_NODE) {
// Check for collision
$sId = $oNode->getAttribute('id');
$sNodeXPath = ($sId != '') ? $oNode->nodeName.'[@id="'.$sId.'"]' : $oNode->nodeName;
$sNodeXPath = $sXPath.'/'.$sNodeXPath;
$oTarget = $oXPath->query($sNodeXPath)->item(0);
if ($oTarget) {
// Do not continue migration
throw new Exception("Trying to restore an existing node $sNodeXPath from version $sNodeMetaVersion");
}
// Restore the modification flags
$oModifiedNodeList = $oXPath->query('descendant-or-self::*[@_disabled_delta or @_disabled_rename_from]', $oNode);
foreach ($oModifiedNodeList as $oModifiedNode) {
foreach (['_delta', '_rename_from'] as $sModificationFlag) {
$sCurrentFlag = $oNode->getAttribute('_disabled'.$sModificationFlag);
if (!empty($sCurrentFlag)) {
$oModifiedNode->setAttribute($sModificationFlag, $sCurrentFlag);
$oModifiedNode->removeAttribute('_disabled'.$sModificationFlag);
}
}
}
// Move the node back in place
$oParentNode->appendChild($oNode);
}
$oNode = $oNextNode;
}
}
}
}
}
// Clean up the mess
$this->RemoveNodeFromXPath("/itop_design/meta/previous_versions/previous_version_$sVersion", false);
$this->RemoveEmptyNodeFromXPath("/itop_design/meta/previous_versions");
$this->RemoveEmptyNodeFromXPath("/itop_design/meta");
}
private function RemoveEmptyNodeFromXPath($sXPath, $bStoreThisNodeInMetaVersion = false)
{
$oXPath = new DOMXPath($this->oDocument);
$oNodeToRemove = $oXPath->query($sXPath)->item(0);
if (is_null($oNodeToRemove)) {
return;
}
$oNode = $oNodeToRemove->firstChild;
while ($oNode) {
if ($oNode->nodeType == XML_ELEMENT_NODE) {
return;
}
$oNode = $oNode->nextSibling;
}
$this->RemoveNodeFromXPath($sXPath, $bStoreThisNodeInMetaVersion);
}
/**
* @param string $sPath
* @param bool $bStoreThisNodeInMetaVersion
*
* @return void
*/
private function RemoveNodeFromXPath($sPath, $bStoreThisNodeInMetaVersion = true)
private function RemoveNodeFromXPath($sPath)
{
$oXPath = new DOMXPath($this->oDocument);
@@ -1101,56 +978,9 @@ class iTopDesignFormat
foreach ($oNodeList as $oNode)
{
$this->LogWarning('Node '.self::GetItopNodePath($oNode).' is irrelevant in this version, it will be removed.');
if ($bStoreThisNodeInMetaVersion && $this->bKeepObsoleteNodes && $this->sKeepVersion) {
// Move the node to <Meta> to keep it safe for backward migration
$oItopDesignNode = $this->GetOrCreateNode('/itop_design', 'itop_design', null);
$oMetaNode = $this->GetOrCreateNode('meta', 'meta', $oItopDesignNode);
$oPreviousVersionsNode = $this->GetOrCreateNode('previous_versions', 'previous_versions', $oMetaNode);
$sVersion = str_replace('.', '_', $this->sKeepVersion);
$oPreviousVersionNode = $this->GetOrCreateNode("previous_version_$sVersion", "previous_version_$sVersion", $oPreviousVersionsNode);
$oTrashedNodeList = $this->GetOrCreateNode('trashed_nodes', 'trashed_nodes', $oPreviousVersionNode);
$iNextId = str_replace('.', '', uniqid('', true));
$oTrashedNode = $this->GetOrCreateNode("trashed_node[@id='$iNextId']", 'trashed_node', $oTrashedNodeList);
$oTrashedNode->setAttribute('id', $iNextId);
$oTrashedNode->setAttribute('_delta', 'define');
$oXPathNode = $this->GetOrCreateNode('parent_xpath', 'parent_xpath', $oTrashedNode);
$oParentNode = $oNode->parentNode;
if ($oParentNode instanceof DOMElement) {
$sParentXPath = static::GetNodeXPath($oParentNode);
$oXPathNode->appendChild(new DOMText($sParentXPath));
}
$oNodeTreeNode = $this->GetOrCreateNode('node_tree', 'node_tree', $oTrashedNode);
// Store the modification flags
$oModifiedNodeList = $oXPath->query('descendant-or-self::*[@_delta or @_rename_from]', $oNode);
foreach ($oModifiedNodeList as $oModifiedNode) {
foreach (['_delta', '_rename_from'] as $sModificationFlag) {
$sCurrentFlag = $oNode->getAttribute($sModificationFlag);
if (!empty($sCurrentFlag)) {
$oModifiedNode->setAttribute('_disabled'.$sModificationFlag, $sCurrentFlag);
$oModifiedNode->removeAttribute($sModificationFlag);
}
}
}
$oNodeTreeNode->appendChild($oNode);
} else {
$this->DeleteNode($oNode);
}
}
}
private function GetOrCreateNode($sXPath, $sName, $oRootNode)
{
$oXPath = new DOMXPath($this->oDocument);
$oNode = $oXPath->query($sXPath, $oRootNode)->item(0);
if (is_null($oNode)) {
$oNode = $oRootNode->ownerDocument->createElement($sName);
$oRootNode->appendChild($oNode);
}
return $oNode;
}
/**
* Clean a collection node by removing the _delta="define" on it and moving it to the item nodes.
@@ -1338,31 +1168,4 @@ class iTopDesignFormat
return null;
}
/**
* Returns the TEXT of the current node (possibly from several child nodes)
* @param null $sDefault
* @return null|string
*/
protected function GetText($oNode, $sDefault = null)
{
$sText = null;
foreach($oNode->childNodes as $oChildNode)
{
if ($oChildNode instanceof \DOMText)
{
if (is_null($sText)) $sText = '';
$sText .= $oChildNode->wholeText;
}
}
if (is_null($sText))
{
return $sDefault;
}
else
{
return $sText;
}
}
}

View File

@@ -220,7 +220,7 @@ class PopoverMenuFactory
new JSPopupMenuItem(
'UI:AboutBox',
Dict::S('UI:AboutBox'),
'return ShowAboutBox();'
'return ShowAboutBox("'.Dict::S('UI:AboutBox').'");'
)
);

View File

@@ -25,10 +25,17 @@ class AjaxPage extends WebPage implements iTabbedPage
/** @var string */
private $sPromiseId;
/**
* @var bool if false will also output extra JS & CSS
* @since 3.0.1 3.1.0 N°4836 Introduce this new option to AjaxPage, as sometimes we only need to return a simple string
*/
protected $bOutputDataOnly = false;
/**
* constructor for the web page
*
* @param string $s_title Not used
* @param bool $bOutputExtraResources if true will output also JS & CSS resources
*/
function __construct($s_title)
{
@@ -50,6 +57,21 @@ class AjaxPage extends WebPage implements iTabbedPage
$oKpi->ComputeStats(get_class($this).' creation', 'AjaxPage');
}
/**
* @see static::$bOutputDataOnly
* @param bool $bFlag
*
* @return $this
*
* @since 3.0.1 3.1.0 N°4836 Method creation : sometimes we only want to output a simple string
*/
public function SetOutputDataOnly(bool $bFlag)
{
$this->bOutputDataOnly = $bFlag;
return $this;
}
/**
* @inheritDoc
* @throws \Exception
@@ -162,18 +184,19 @@ class AjaxPage extends WebPage implements iTabbedPage
header($s_header);
}
// Prepare internal parts (js files, css files, js snippets, css snippets, ...)
// - Generate necessary dict. files
if ($this->bAddJSDict) {
$this->output_dict_entries();
if (false === $this->bOutputDataOnly) {
// Prepare internal parts (js files, css files, js snippets, css snippets, ...)
// - Generate necessary dict. files
if ($this->bAddJSDict) {
$this->output_dict_entries();
}
ConsoleBlockRenderer::AddCssJsToPage($this, $this->oContentLayout);
$this->outputCollapsibleSectionInit();
}
ConsoleBlockRenderer::AddCssJsToPage($this, $this->oContentLayout);
// Render the blocks
$this->outputCollapsibleSectionInit();
$aData = [];
$aData['oLayout'] = $this->oContentLayout;
$aData['aDeferredBlocks'] = $this->GetDeferredBlocks($this->oContentLayout);

View File

@@ -873,7 +873,7 @@ EOF
$oPage->add('<td><a href="http://www.combodo.com" title="www.combodo.com" target="_blank" style="background: none;"><img src="../images/logo-combodo.png?t='.utils::GetCacheBusterTimestamp().'" style="float: right;"/></a></td>');
$oPage->add('<td style="padding-left: 20px;">');
$oPage->add($sVersionString.'<br/>');
$oPage->add(Dict::S('UI:About:DataModel').': '.$sDataModelVersion.'<br/>');
//$oPage->add(Dict::S('UI:About:DataModel').': '.$sDataModelVersion.'<br/>');
$oPage->add('MySQL: '.$sMySQLVersion.'<br/>');
$oPage->add('PHP: '.$sPHPVersion.'<br/>');
$oPage->add('</td>');

View File

@@ -14,24 +14,4 @@
<constants>
<constant id="RESPONSE_TICKET_SLT_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT slt FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id=root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN SLA AS sla ON l1.sla_id=sla.id JOIN lnkSLAToSLT AS l2 ON l2.sla_id=sla.id JOIN SLT AS slt ON l2.slt_id=slt.id WHERE slt.metric = :metric AND l1.service_id = :this->service_id AND child.id= :this->org_id AND slt.request_type = :request_type AND slt.priority = :this->priority]]></constant>
</constants>
<meta>
<previous_versions>
<previous_version_1_6>
<trashed_nodes>
<trashed_node id="XXX" _delta="define">
<parent_xpath>/itop_design/constants</parent_xpath>
<node_tree>
<constant id="PORTAL_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _disabled_delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.status != 'obsolete']]></constant>
</node_tree>
</trashed_node>
<trashed_node id="XXX" _delta="define">
<parent_xpath>/itop_design/constants</parent_xpath>
<node_tree>
<constant id="PORTAL_VALIDATE_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _disabled_delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.id = :id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.id = :id AND s.status != 'obsolete']]></constant>
</node_tree>
</trashed_node>
</trashed_nodes>
</previous_version_1_6>
</previous_versions>
</meta>
</itop_design>

View File

@@ -13,7 +13,5 @@
</branding>
<constants>
<constant id="RESPONSE_TICKET_SLT_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT slt FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id=root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN SLA AS sla ON l1.sla_id=sla.id JOIN lnkSLAToSLT AS l2 ON l2.sla_id=sla.id JOIN SLT AS slt ON l2.slt_id=slt.id WHERE slt.metric = :metric AND l1.service_id = :this->service_id AND child.id= :this->org_id AND slt.request_type = :request_type AND slt.priority = :this->priority]]></constant>
<constant id="PORTAL_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.status != 'obsolete']]></constant>
<constant id="PORTAL_VALIDATE_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.id = :id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.id = :id AND s.status != 'obsolete']]></constant>
</constants>
</itop_design>

View File

@@ -14,24 +14,4 @@
<constants>
<constant id="RESPONSE_TICKET_SLT_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT slt FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id=root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN SLA AS sla ON l1.sla_id=sla.id JOIN lnkSLAToSLT AS l2 ON l2.sla_id=sla.id JOIN SLT AS slt ON l2.slt_id=slt.id WHERE slt.metric = :metric AND l1.service_id = :this->service_id AND child.id= :this->org_id AND slt.request_type = :request_type AND slt.priority = :this->priority]]></constant>
</constants>
<meta>
<previous_versions>
<previous_version_1_6>
<trashed_nodes>
<trashed_node id="1">
<parent_xpath>/itop_design/constants</parent_xpath>
<node_tree>
<constant id="PORTAL_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _disabled_delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.status != 'obsolete']]></constant>
</node_tree>
</trashed_node>
<trashed_node id="2">
<parent_xpath>/itop_design/constants</parent_xpath>
<node_tree>
<constant id="PORTAL_VALIDATE_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _disabled_delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.id = :id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.id = :id AND s.status != 'obsolete']]></constant>
</node_tree>
</trashed_node>
</trashed_nodes>
</previous_version_1_6>
</previous_versions>
</meta>
</itop_design>

View File

@@ -8,12 +8,23 @@
<variable id="var1">#C53030</variable>
</variables>
<imports>
<import id="css-variables" xsi:type="utilities">../css/css-variables.scss</import>
<import id="scss-variables" xsi:type="utilities">../css/scss-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/main.scss</stylesheet>
<stylesheet id="custom">../css/custom.scss</stylesheet>
<stylesheet id="environment-banner">../css/backoffice/themes/page-banner.scss</stylesheet>
<stylesheet id="fullmoon">../css/backoffice/main.scss</stylesheet>
</stylesheets>
</theme>
<theme id="light-grey">
<variables/>
<imports>
<import id="css-variables" xsi:type="utilities">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/light-grey.scss</stylesheet>
</stylesheets>
</theme>
</themes>
@@ -108,45 +119,4 @@
</fields>
</class>
</classes>
<meta>
<previous_versions>
<previous_version_1_7>
<trashed_nodes>
<trashed_node id="XXX" _delta="define">
<parent_xpath>/itop_design/branding/themes</parent_xpath>
<node_tree>
<theme id="light-grey">
<variables/>
<imports>
<import id="css-variables">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/light-grey.scss</stylesheet>
</stylesheets>
</theme>
</node_tree>
</trashed_node>
<trashed_node id="XXX" _delta="define">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/imports</parent_xpath>
<node_tree>
<import id="css-variables">../css/css-variables.scss</import>
</node_tree>
</trashed_node>
<trashed_node id="XXX" _delta="define">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
</node_tree>
</trashed_node>
<trashed_node id="XXX" _delta="define">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="main">../css/main.scss</stylesheet>
</node_tree>
</trashed_node>
</trashed_nodes>
</previous_version_1_7>
</previous_versions>
</meta>
</itop_design>

View File

@@ -9,22 +9,9 @@
</variables>
<imports>
<import id="scss-variables">../css/scss-variables.scss</import>
<import id="css-variables">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="custom">../css/custom.scss</stylesheet>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/main.scss</stylesheet>
</stylesheets>
</theme>
<theme id="light-grey">
<variables/>
<imports>
<import id="css-variables">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/light-grey.scss</stylesheet>
</stylesheets>
</theme>
</themes>
@@ -91,4 +78,45 @@
<branding>
<main_logo _delta="define">images/itop-logo.png</main_logo>
</branding>
<meta>
<previous_versions>
<previous_version_1_7>
<trashed_nodes>
<trashed_node id="XXX">
<parent_xpath>/itop_design/branding/themes</parent_xpath>
<node_tree>
<theme id="light-grey">
<variables/>
<imports>
<import id="css-variables">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/light-grey.scss</stylesheet>
</stylesheets>
</theme>
</node_tree>
</trashed_node>
<trashed_node id="XXX">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/imports</parent_xpath>
<node_tree>
<import id="css-variables">../css/css-variables.scss</import>
</node_tree>
</trashed_node>
<trashed_node id="XXX">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
</node_tree>
</trashed_node>
<trashed_node id="XXX">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="main">../css/main.scss</stylesheet>
</node_tree>
</trashed_node>
</trashed_nodes>
</previous_version_1_7>
</previous_versions>
</meta>
</itop_design>

View File

@@ -1,127 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0">
<branding>
<themes>
<theme id="test-red" _delta="define">
<variables>
<variable id="backoffice-environment-banner-background-color">#C53030</variable>
<variable id="var1">#C53030</variable>
</variables>
<imports>
<import id="scss-variables">../css/scss-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="custom">../css/custom.scss</stylesheet>
</stylesheets>
</theme>
<theme id="light-grey" _delta="define">
<totally_new_format>
bla bla bla
</totally_new_format>
</theme>
</themes>
</branding>
<classes>
<class id="ClassWithStateButNoLifecycle">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
</class>
<class id="ClassWithStateAndLifecycle">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
<lifecycle>
<attribute>foo</attribute>
</lifecycle>
</class>
<class id="ClassWithStateAndImage">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
</class>
<class id="ClassWithImageOnly">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
</class>
<class id="OtherClass">
<properties>
<icon revisionid="2" _delta="redefine">
<fileref ref="company_0faae3b9d86b7c382b2e4cdae570bc3c" revisionid="62"/>
</icon>
</properties>
<fields>
<field id="status" xsi:type="AttributeEnum">
<always_load_in_tables>true</always_load_in_tables>
<values>
<value id="new">new</value>
<value id="waiting_for_approval">waiting_for_approval</value>
</values>
</field>
<field id="operational_status" xsi:type="AttributeMetaEnum">
<values>
<value id="ongoing">ongoing</value>
<value id="resolved">resolved</value>
</values>
</field>
</fields>
</class>
</classes>
<menus>
<menu id="WelcomeMenuLink1" xsi:type="WebPageMenuNode" _delta="define">
<rank>100</rank>
<parent>WelcomeMenu</parent>
<url>$$http://fr.wikipedia.org/</url>
<in_new_window>true</in_new_window>
</menu>
<menu id="RequestManagement" xsi:type="MenuGroup" _delta="define">
<rank>30</rank>
<enable_stimulus/>
</menu>
</menus>
<branding>
<main_logo _delta="define">images/itop-logo.png</main_logo>
</branding>
<meta>
<previous_versions>
<previous_version_1_7>
<trashed_nodes>
<trashed_node id="XXX">
<parent_xpath>/itop_design/branding/themes</parent_xpath>
<node_tree>
<theme id="light-grey">
<variables/>
<imports>
<import id="css-variables">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/light-grey.scss</stylesheet>
</stylesheets>
</theme>
</node_tree>
</trashed_node>
<trashed_node id="XXX">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/imports</parent_xpath>
<node_tree>
<import id="css-variables">../css/css-variables.scss</import>
</node_tree>
</trashed_node>
<trashed_node id="XXX">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
</node_tree>
</trashed_node>
<trashed_node id="XXX">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="main">../css/main.scss</stylesheet>
</node_tree>
</trashed_node>
</trashed_nodes>
</previous_version_1_7>
</previous_versions>
</meta>
</itop_design>

View File

@@ -1,182 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0">
<branding>
<themes>
<theme id="test-red" _delta="define">
<variables>
<variable id="ibo-page-banner--background-color">#C53030</variable>
<variable id="var1">#C53030</variable>
</variables>
<imports>
<import id="scss-variables" xsi:type="utilities">../css/scss-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="custom">../css/custom.scss</stylesheet>
</stylesheets>
</theme>
<theme id="light-grey" _delta="define">
<totally_new_format>
bla bla bla
</totally_new_format>
</theme>
</themes>
</branding>
<classes>
<class id="ClassWithStateButNoLifecycle">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<state_attribute>foo</state_attribute>
</fields_semantic>
</properties>
</class>
<class id="ClassWithStateAndLifecycle">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<state_attribute>foo</state_attribute>
</fields_semantic>
</properties>
<lifecycle/>
</class>
<class id="ClassWithStateAndImage">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<state_attribute>foo</state_attribute>
<image_attribute>bar</image_attribute>
</fields_semantic>
</properties>
</class>
<class id="ClassWithImageOnly">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<image_attribute>bar</image_attribute>
</fields_semantic>
</properties>
</class>
<class id="OtherClass">
<properties>
<style>
<icon revisionid="2" _delta="redefine">
<fileref ref="company_0faae3b9d86b7c382b2e4cdae570bc3c" revisionid="62"/>
</icon>
<main_color>#4E79A5</main_color>
<complementary_color>white</complementary_color>
</style>
</properties>
<fields>
<field id="status" xsi:type="AttributeEnum">
<always_load_in_tables>true</always_load_in_tables>
<values>
<value id="new">
<code>new</code>
<style>
<main_color>#2C5382</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</style>
</value>
<value id="waiting_for_approval">
<code>waiting_for_approval</code>
</value>
</values>
<default_style>
<main_color>#2B6CB0</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</default_style>
</field>
<field id="operational_status" xsi:type="AttributeMetaEnum">
<values>
<value id="ongoing">
<code>ongoing</code>
<style>
<main_color>#2C5382</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</style>
</value>
<value id="resolved">
<code>resolved</code>
</value>
</values>
<default_style>
<main_color>#2B6CB0</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</default_style>
</field>
</fields>
</class>
</classes>
<menus>
<menu id="WelcomeMenuLink1" xsi:type="WebPageMenuNode" _delta="define">
<rank>100</rank>
<parent>WelcomeMenu</parent>
<url>$$http://fr.wikipedia.org/</url>
<in_new_window>true</in_new_window>
</menu>
<menu id="RequestManagement" xsi:type="MenuGroup" _delta="define">
<rank>30</rank>
<enable_stimulus/>
<style>
<decoration_classes>fas fa-comment-alt</decoration_classes>
</style>
</menu>
</menus>
<branding>
<main_logo _delta="define">images/itop-logo.png</main_logo>
<main_logo_compact _delta="define">images/itop-logo-square.png</main_logo_compact>
</branding>
<meta>
<previous_versions>
<previous_version_1_7>
<trashed_nodes>
<trashed_node id="1">
<parent_xpath>/itop_design/branding/themes</parent_xpath>
<node_tree>
<theme id="light-grey">
<variables/>
<imports>
<import id="css-variables">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/light-grey.scss</stylesheet>
</stylesheets>
</theme>
</node_tree>
</trashed_node>
<trashed_node id="2">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/imports</parent_xpath>
<node_tree>
<import id="css-variables">../css/css-variables.scss</import>
</node_tree>
</trashed_node>
<trashed_node id="3">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
</node_tree>
</trashed_node>
<trashed_node id="4">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="main">../css/main.scss</stylesheet>
</node_tree>
</trashed_node>
</trashed_nodes>
</previous_version_1_7>
</previous_versions>
</meta>
</itop_design>

View File

@@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
<branding>
<themes>
<theme id="test-red" _delta="define">
<variables>
<variable id="backoffice-environment-banner-background-color">#C53030</variable>
<variable id="var1">#C53030</variable>
</variables>
<imports>
<import id="scss-variables">../css/scss-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="custom">../css/custom.scss</stylesheet>
</stylesheets>
</theme>
</themes>
</branding>
<classes>
<class id="ClassWithStateButNoLifecycle">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
</class>
<class id="ClassWithStateAndLifecycle">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
<lifecycle>
<attribute>foo</attribute>
</lifecycle>
</class>
<class id="ClassWithStateAndImage">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
</class>
<class id="ClassWithImageOnly">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
</class>
<class id="OtherClass">
<properties>
<icon revisionid="2" _delta="redefine">
<fileref ref="company_0faae3b9d86b7c382b2e4cdae570bc3c" revisionid="62"/>
</icon>
</properties>
<fields>
<field id="status" xsi:type="AttributeEnum">
<always_load_in_tables>true</always_load_in_tables>
<values>
<value id="new">new</value>
<value id="waiting_for_approval">waiting_for_approval</value>
</values>
</field>
<field id="operational_status" xsi:type="AttributeMetaEnum">
<values>
<value id="ongoing">ongoing</value>
<value id="resolved">resolved</value>
</values>
</field>
</fields>
</class>
</classes>
<menus>
<menu id="WelcomeMenuLink1" xsi:type="WebPageMenuNode" _delta="define">
<rank>100</rank>
<parent>WelcomeMenu</parent>
<url>$$http://fr.wikipedia.org/</url>
<in_new_window>true</in_new_window>
</menu>
<menu id="RequestManagement" xsi:type="MenuGroup" _delta="define">
<rank>30</rank>
<enable_stimulus/>
</menu>
</menus>
<branding>
<main_logo _delta="define">images/itop-logo.png</main_logo>
</branding>
</itop_design>

View File

@@ -1,136 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0">
<branding>
<themes>
<theme id="test-red" _delta="define">
<variables>
<variable id="ibo-page-banner--background-color">#C53030</variable>
<variable id="var1">#C53030</variable>
</variables>
<imports>
<import id="scss-variables" xsi:type="utilities">../css/scss-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="custom">../css/custom.scss</stylesheet>
</stylesheets>
</theme>
</themes>
</branding>
<classes>
<class id="ClassWithStateButNoLifecycle">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<state_attribute>foo</state_attribute>
</fields_semantic>
</properties>
</class>
<class id="ClassWithStateAndLifecycle">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<state_attribute>foo</state_attribute>
</fields_semantic>
</properties>
<lifecycle/>
</class>
<class id="ClassWithStateAndImage">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<state_attribute>foo</state_attribute>
<image_attribute>bar</image_attribute>
</fields_semantic>
</properties>
</class>
<class id="ClassWithImageOnly">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<image_attribute>bar</image_attribute>
</fields_semantic>
</properties>
</class>
<class id="OtherClass">
<properties>
<style>
<icon revisionid="2" _delta="redefine">
<fileref ref="company_0faae3b9d86b7c382b2e4cdae570bc3c" revisionid="62"/>
</icon>
<main_color>#4E79A5</main_color>
<complementary_color>white</complementary_color>
</style>
</properties>
<fields>
<field id="status" xsi:type="AttributeEnum">
<always_load_in_tables>true</always_load_in_tables>
<values>
<value id="new">
<code>new</code>
<style>
<main_color>#2C5382</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</style>
</value>
<value id="waiting_for_approval">
<code>waiting_for_approval</code>
</value>
</values>
<default_style>
<main_color>#2B6CB0</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</default_style>
</field>
<field id="operational_status" xsi:type="AttributeMetaEnum">
<values>
<value id="ongoing">
<code>ongoing</code>
<style>
<main_color>#2C5382</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</style>
</value>
<value id="resolved">
<code>resolved</code>
</value>
</values>
<default_style>
<main_color>#2B6CB0</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</default_style>
</field>
</fields>
</class>
</classes>
<menus>
<menu id="WelcomeMenuLink1" xsi:type="WebPageMenuNode" _delta="define">
<rank>100</rank>
<parent>WelcomeMenu</parent>
<url>$$http://fr.wikipedia.org/</url>
<in_new_window>true</in_new_window>
</menu>
<menu id="RequestManagement" xsi:type="MenuGroup" _delta="define">
<rank>30</rank>
<enable_stimulus/>
<style>
<decoration_classes>fas fa-comment-alt</decoration_classes>
</style>
</menu>
</menus>
<branding>
<main_logo _delta="define">images/itop-logo.png</main_logo>
<main_logo_compact _delta="define">images/itop-logo-square.png</main_logo_compact>
</branding>
</itop_design>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -64,13 +64,12 @@ class TestForITopDesignFormatClass extends ItopTestCase
public function ConvertProvider()
{
return [
'Bug_4569' => ['1.7', 'Bug_4569'],
'1.7 to 1.6' => ['1.6', '1.7_to_1.6'],
'1.6 to 1.7 2' => ['1.7', '1.6_to_1.7_2'],
'1.7 to 1.6 2' => ['1.6', '1.7_to_1.6_2'],
'1.7 to 3.0' => ['3.0', '1.7_to_3.0'],
'3.0 to 1.7' => ['1.7', '3.0_to_1.7'],
'3.0 to 1.7 no previous' => ['1.7', '3.0_to_1.7_no_previous'],
'3.0 to 1.7 collision' => ['1.7', '3.0_to_1.7_collision', 1, 'Trying to restore an existing node /itop_design/branding/themes/theme[@id="light-grey"] from version 1.7'],
];
}
@@ -120,11 +119,9 @@ class TestForITopDesignFormatClass extends ItopTestCase
public function ConvertBackAndForthProvider()
{
return array(
'1.6 to 1.7' => array('1.7', '1.6_to_1.7_2'),
'1.6 to 3.0' => array('3.0', '1.6_to_1.7_2'),
'1.7 to 3.0' => array('3.0', '1.7'),
);
return [
'1.7 to 3.0' => ['3.0', '1.7'],
];
}
/**

View File

@@ -49,20 +49,14 @@ class StatusTest extends ItopTestCase
$aResponseDecoded = json_decode($aOutput[0], true);
//Check status
$this->assertArrayHasKey('status', $aResponseDecoded, 'JSON does not have a status\' field. '.$sAdditionalInfo);
$this->assertArrayHasKey('status', $aResponseDecoded, 'JSON does not have a \'status\' field. '.$sAdditionalInfo);
$this->assertEquals('RUNNING', $aResponseDecoded['status'], 'Status is not \'RUNNING\'. '.$sAdditionalInfo);
//Check code
$this->assertArrayHasKey('code', $aResponseDecoded, 'JSON does not have a code\' field. '.$sAdditionalInfo);
$this->assertArrayHasKey('code', $aResponseDecoded, 'JSON does not have a \'code\' field. '.$sAdditionalInfo);
$this->assertEquals(0, $aResponseDecoded['code'], 'Code is not 0. '.$sAdditionalInfo);
//Check message
$this->assertArrayHasKey('message', $aResponseDecoded, 'JSON does not have a message\' field. '.$sAdditionalInfo);
$this->assertArrayHasKey('message', $aResponseDecoded, 'JSON does not have a \'message\' field. '.$sAdditionalInfo);
$this->assertEmpty($aResponseDecoded['message'], 'Message is not empty. '.$sAdditionalInfo);
//Check product
$this->assertArrayHasKey('product', $aResponseDecoded, 'JSON does not have a product\' field. '.$sAdditionalInfo);
$this->assertEquals(ITOP_APPLICATION, $aResponseDecoded['product'], 'Bad product (should be: '.ITOP_APPLICATION.') '.$sAdditionalInfo);
//Check version
$this->assertArrayHasKey('version', $aResponseDecoded, 'JSON does not have a version\' field. '.$sAdditionalInfo);
$this->assertEquals(ITOP_VERSION, $aResponseDecoded['version'], 'Bad version (should be: '.ITOP_VERSION.') '.$sAdditionalInfo);
}
}

View File

@@ -9,12 +9,12 @@ use Combodo\iTop\Application\Status\Status;
try
{
new Status();
$aResult = ['status' => STATUS_RUNNING, 'code' => RestResult::OK, 'message' => '', 'product' => ITOP_APPLICATION, 'version' => ITOP_VERSION];
$aResult = ['status' => STATUS_RUNNING, 'code' => RestResult::OK, 'message' => ''];
}
catch (Exception $e)
{
$iCode = (defined('\RestResult::INTERNAL_ERROR')) ? RestResult::INTERNAL_ERROR : 100;
$aResult = ['status' => STATUS_ERROR, 'code' => $iCode, 'message' => $e->getMessage(), 'product' => ITOP_APPLICATION, 'version' => ITOP_VERSION];
$aResult = ['status' => STATUS_ERROR, 'code' => $iCode, 'message' => $e->getMessage()];
http_response_code(500);
}