mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
Merge branch 'support/3.2' into develop
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -62,8 +63,7 @@ class ObjectRepository
|
||||
}
|
||||
|
||||
return $aResult;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
@@ -103,8 +103,7 @@ class ObjectRepository
|
||||
|
||||
// return object array
|
||||
return ObjectRepository::DBSetToObjectArray($oDbObjectSet, $sObjectClass, $aFieldsToLoad);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
@@ -234,11 +233,10 @@ class ObjectRepository
|
||||
}
|
||||
|
||||
// Link
|
||||
$aData['link'] = utils::GetAbsoluteUrlAppRoot() . "pages/UI.php?operation=details&class=$sClass&id={$oDbObject->GetKey()}";
|
||||
$aData['link'] = utils::GetAbsoluteUrlAppRoot()."pages/UI.php?operation=details&class=$sClass&id={$oDbObject->GetKey()}";
|
||||
|
||||
return $aData;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
@@ -263,8 +261,7 @@ class ObjectRepository
|
||||
}
|
||||
|
||||
return $oThisObj;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -315,7 +312,6 @@ class ObjectRepository
|
||||
return ObjectRepository::ComputeOthersData($oObject, $sObjectClass, $aObjectData, $aComplementAttributeSpec, $sObjectImageAttCode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DeleteFromOql.
|
||||
*
|
||||
@@ -340,8 +336,7 @@ class ObjectRepository
|
||||
|
||||
// return operation success
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
@@ -350,5 +345,4 @@ class ObjectRepository
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -37,4 +38,4 @@ interface iDataPostProcessor
|
||||
*/
|
||||
public static function Execute(array $aData, array $aSettings): array;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,7 @@ class DataModelDependantCache
|
||||
|
||||
public static function GetInstance(): DataModelDependantCache
|
||||
{
|
||||
if (!isset(self::$oInstance))
|
||||
{
|
||||
if (!isset(self::$oInstance)) {
|
||||
self::$oInstance = new DataModelDependantCache();
|
||||
}
|
||||
return self::$oInstance;
|
||||
@@ -46,7 +45,7 @@ class DataModelDependantCache
|
||||
*/
|
||||
public function Store(string $sPool, string $sKey, mixed $value, array $aMoreInfo = []): void
|
||||
{
|
||||
if(is_null($value)) {
|
||||
if (is_null($value)) {
|
||||
// NULL cannot be stored as it collides with Fetch() returning NULL when the key does not exist
|
||||
throw new Exception('Cannot store NULL in the cache');
|
||||
}
|
||||
@@ -72,7 +71,9 @@ class DataModelDependantCache
|
||||
public function Fetch(string $sPool, string $sKey): mixed
|
||||
{
|
||||
$sCacheFileName = $this->MakeCacheFileName($sPool, $sKey);
|
||||
if (!is_file($sCacheFileName)) return null;
|
||||
if (!is_file($sCacheFileName)) {
|
||||
return null;
|
||||
}
|
||||
return include $sCacheFileName;
|
||||
}
|
||||
|
||||
@@ -98,7 +99,9 @@ class DataModelDependantCache
|
||||
public function GetEntryModificationTime(string $sPool, string $sKey): int|null
|
||||
{
|
||||
$sCacheFileName = $this->MakeCacheFileName($sPool, $sKey);
|
||||
if (!is_file($sCacheFileName)) return null;
|
||||
if (!is_file($sCacheFileName)) {
|
||||
return null;
|
||||
}
|
||||
return filemtime($sCacheFileName);
|
||||
}
|
||||
/**
|
||||
@@ -146,7 +149,6 @@ class DataModelDependantCache
|
||||
return $this->GetStorageRootDir()."/$sPool/";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* for test purpose
|
||||
*
|
||||
@@ -167,4 +169,4 @@ class DataModelDependantCache
|
||||
{
|
||||
$this->sStorageRootDir = $sStorageRootDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -81,4 +82,4 @@ class EventDataDescription
|
||||
{
|
||||
$this->sType = $sType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -140,4 +141,4 @@ class EventDescription
|
||||
{
|
||||
$this->mEventSources = $mEventSources;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Service\Events;
|
||||
|
||||
|
||||
/**
|
||||
* Data given to the Event Service callbacks
|
||||
* Class EventServiceData
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -10,5 +11,4 @@ use Exception;
|
||||
|
||||
class EventException extends Exception
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -44,4 +45,4 @@ class EventHelper
|
||||
// no match
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -89,7 +90,7 @@ final class EventService
|
||||
|
||||
$aEventCallbacks = self::$aEventListeners[$sEvent] ?? [];
|
||||
$sId = 'event_'.self::$iEventIdCounter++;
|
||||
$aEventCallbacks[] = array(
|
||||
$aEventCallbacks[] = [
|
||||
'id' => $sId,
|
||||
'event' => $sEvent,
|
||||
'callback' => $callback,
|
||||
@@ -99,7 +100,7 @@ final class EventService
|
||||
'context' => $context,
|
||||
'priority' => $fPriority,
|
||||
'module' => $sModuleId,
|
||||
);
|
||||
];
|
||||
usort($aEventCallbacks, function ($a, $b) {
|
||||
$fPriorityA = $a['priority'];
|
||||
$fPriorityB = $b['priority'];
|
||||
@@ -169,12 +170,10 @@ final class EventService
|
||||
$sSignature = ModuleService::GetInstance()->GetModuleMethodSignature($aEventCallback['callback'][0], $aEventCallback['callback'][1]);
|
||||
$oKPI->ComputeStats('FireEvent', "$sEvent callback: $sSignature");
|
||||
}
|
||||
}
|
||||
catch (EventException $e) {
|
||||
} catch (EventException $e) {
|
||||
EventServiceLog::Error("Event '$sLogEventName' for '$sName' id {$aEventCallback['id']} failed with blocking error: ".$e->getMessage());
|
||||
throw $e;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$sLastExceptionMessage = "Event '$sLogEventName' for '$sName' id {$aEventCallback['id']} failed with non-blocking error: ".$e->getMessage();
|
||||
EventServiceLog::Error($sLastExceptionMessage);
|
||||
$oLastException = $e;
|
||||
@@ -216,7 +215,7 @@ final class EventService
|
||||
return true;
|
||||
}
|
||||
if (is_string($registeredContext)) {
|
||||
$aContexts = array($registeredContext);
|
||||
$aContexts = [$registeredContext];
|
||||
} elseif (is_array($registeredContext)) {
|
||||
$aContexts = $registeredContext;
|
||||
} else {
|
||||
@@ -256,7 +255,7 @@ final class EventService
|
||||
$bRemoved = self::Browse(function ($sEvent, $idx, $aEventCallback) use ($sId) {
|
||||
if ($aEventCallback['id'] == $sId) {
|
||||
$sName = self::$aEventListeners[$sEvent][$idx]['name'];
|
||||
unset (self::$aEventListeners[$sEvent][$idx]);
|
||||
unset(self::$aEventListeners[$sEvent][$idx]);
|
||||
EventServiceLog::Trace("Unregistered callback '$sName' id $sId' on event '$sEvent'");
|
||||
|
||||
return false;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -11,5 +12,5 @@ use LogChannels;
|
||||
|
||||
class EventServiceLog extends IssueLog
|
||||
{
|
||||
const CHANNEL_DEFAULT = LogChannels::EVENT_SERVICE;
|
||||
}
|
||||
public const CHANNEL_DEFAULT = LogChannels::EVENT_SERVICE;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -22,4 +23,4 @@ interface iEventServiceSetup
|
||||
* @return void
|
||||
*/
|
||||
public function RegisterEventsAndListeners();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Combodo\iTop\Service\Import;
|
||||
@@ -43,7 +44,6 @@ use utils;
|
||||
*/
|
||||
class CSVImportPageProcessor
|
||||
{
|
||||
|
||||
/**
|
||||
* @param mixed $iBoxSkipLines
|
||||
* @param mixed $iNbSkippedLines
|
||||
@@ -79,11 +79,27 @@ class CSVImportPageProcessor
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function ProcessData(
|
||||
mixed $iBoxSkipLines, mixed $iNbSkippedLines, mixed $sDateTimeFormat, mixed $sCustomDateTimeFormat, mixed $sClassName, WebPage $oPage, $aSynchroUpdate, mixed $sCSVData, mixed $sSeparator,
|
||||
mixed $sTextQualifier, bool $bHeaderLine, array $aResult, mixed $aSearchFields, mixed $aFieldsMapping,
|
||||
bool $bSimulate, mixed $sCSVDataTruncated, int $iCurrentStep, mixed $sEncoding, mixed $bAdvanced, mixed $sSynchroScope
|
||||
): ?array
|
||||
{
|
||||
mixed $iBoxSkipLines,
|
||||
mixed $iNbSkippedLines,
|
||||
mixed $sDateTimeFormat,
|
||||
mixed $sCustomDateTimeFormat,
|
||||
mixed $sClassName,
|
||||
WebPage $oPage,
|
||||
$aSynchroUpdate,
|
||||
mixed $sCSVData,
|
||||
mixed $sSeparator,
|
||||
mixed $sTextQualifier,
|
||||
bool $bHeaderLine,
|
||||
array $aResult,
|
||||
mixed $aSearchFields,
|
||||
mixed $aFieldsMapping,
|
||||
bool $bSimulate,
|
||||
mixed $sCSVDataTruncated,
|
||||
int $iCurrentStep,
|
||||
mixed $sEncoding,
|
||||
mixed $bAdvanced,
|
||||
mixed $sSynchroScope
|
||||
): ?array {
|
||||
$iSkippedLines = 0;
|
||||
if ($iBoxSkipLines == 1) {
|
||||
$iSkippedLines = $iNbSkippedLines;
|
||||
@@ -106,12 +122,12 @@ class CSVImportPageProcessor
|
||||
$aData = $oCSVParser->ToArray($iSkippedLines);
|
||||
$iRealSkippedLines = $iSkippedLines;
|
||||
if ($bHeaderLine) {
|
||||
$aResult[] = $sTextQualifier . implode($sTextQualifier . $sSeparator . $sTextQualifier, array_shift($aData)) . $sTextQualifier; // Remove the first line and store it in case of error
|
||||
$aResult[] = $sTextQualifier.implode($sTextQualifier.$sSeparator.$sTextQualifier, array_shift($aData)).$sTextQualifier; // Remove the first line and store it in case of error
|
||||
$iRealSkippedLines++;
|
||||
}
|
||||
|
||||
// Format for the line numbers
|
||||
$sMaxLen = (strlen('' . count($aData)) < 3) ? 3 : strlen('' . count($aData)); // Pad line numbers to the appropriate number of chars, but at least 3
|
||||
$sMaxLen = (strlen(''.count($aData)) < 3) ? 3 : strlen(''.count($aData)); // Pad line numbers to the appropriate number of chars, but at least 3
|
||||
|
||||
// Compute the list of search/reconciliation criteria
|
||||
$aSearchKeys = [];
|
||||
@@ -162,7 +178,7 @@ class CSVImportPageProcessor
|
||||
$oMyChange = null;
|
||||
if (!$bSimulate) {
|
||||
// We're doing it for real, let's create a change
|
||||
$sUserString = CMDBChange::GetCurrentUserName() . ' (CSV)';
|
||||
$sUserString = CMDBChange::GetCurrentUserName().' (CSV)';
|
||||
CMDBObject::SetCurrentChangeFromParams($sUserString, CMDBChangeOrigin::CSV_INTERACTIVE);
|
||||
$oMyChange = CMDBObject::GetCurrentChange();
|
||||
}
|
||||
@@ -189,7 +205,7 @@ class CSVImportPageProcessor
|
||||
$aColumns ["object"] = ["label" => "Object"];
|
||||
foreach ($aFieldsMapping as $sAttCode) {
|
||||
if (!empty($sAttCode) && ($sAttCode != ':none:') && ($sAttCode != 'finalclass')) {
|
||||
$aColumns[$sClassName . '/' . $sAttCode] = ["label" => MetaModel::GetLabel($sClassName, $sAttCode)];
|
||||
$aColumns[$sClassName.'/'.$sAttCode] = ["label" => MetaModel::GetLabel($sClassName, $sAttCode)];
|
||||
}
|
||||
}
|
||||
$aColumns["message"] = ["label" => "Message"];
|
||||
@@ -214,7 +230,7 @@ class CSVImportPageProcessor
|
||||
$sFinalClass = $aResRow['finalclass'];
|
||||
$oObj = MetaModel::GetObject($sFinalClass, $aResRow['id']->GetPureValue());
|
||||
$sUrl = $oObj->GetHyperlink();
|
||||
$sStatus = '<img src="' . $sAppRootUrl . 'images/unchanged.png" title="' . Dict::S('UI:CSVReport-Icon-Unchanged') . '">';
|
||||
$sStatus = '<img src="'.$sAppRootUrl.'images/unchanged.png" title="'.Dict::S('UI:CSVReport-Icon-Unchanged').'">';
|
||||
$sCSSRowClass = 'ibo-csv-import--row-unchanged';
|
||||
break;
|
||||
|
||||
@@ -223,7 +239,7 @@ class CSVImportPageProcessor
|
||||
$sFinalClass = $aResRow['finalclass'];
|
||||
$oObj = MetaModel::GetObject($sFinalClass, $aResRow['id']->GetPureValue());
|
||||
$sUrl = $oObj->GetHyperlink();
|
||||
$sStatus = '<img src="' . $sAppRootUrl . 'images/modified.png" title="' . Dict::S('UI:CSVReport-Icon-Modified') . '">';
|
||||
$sStatus = '<img src="'.$sAppRootUrl.'images/modified.png" title="'.Dict::S('UI:CSVReport-Icon-Modified').'">';
|
||||
$sCSSRowClass = 'ibo-csv-import--row-modified';
|
||||
break;
|
||||
|
||||
@@ -232,7 +248,7 @@ class CSVImportPageProcessor
|
||||
$sFinalClass = $aResRow['finalclass'];
|
||||
$oObj = MetaModel::GetObject($sFinalClass, $aResRow['id']->GetPureValue());
|
||||
$sUrl = $oObj->GetHyperlink();
|
||||
$sStatus = '<img src="' . $sAppRootUrl . 'images/delete.png" title="' . Dict::S('UI:CSVReport-Icon-Missing') . '">';
|
||||
$sStatus = '<img src="'.$sAppRootUrl.'images/delete.png" title="'.Dict::S('UI:CSVReport-Icon-Missing').'">';
|
||||
$sCSSRowClass = 'ibo-csv-import--row-modified';
|
||||
if ($bSimulate) {
|
||||
$sMessage = Dict::S('UI:CSVReport-Object-MissingToUpdate');
|
||||
@@ -243,7 +259,7 @@ class CSVImportPageProcessor
|
||||
|
||||
case 'RowStatus_NewObj':
|
||||
$iCreated++;
|
||||
$sStatus = '<img src="' . $sAppRootUrl . 'images/added.png" title="' . Dict::S('UI:CSVReport-Icon-Created') . '">';
|
||||
$sStatus = '<img src="'.$sAppRootUrl.'images/added.png" title="'.Dict::S('UI:CSVReport-Icon-Created').'">';
|
||||
$sCSSRowClass = 'ibo-csv-import--row-added';
|
||||
if ($bSimulate) {
|
||||
$sMessage = Dict::S('UI:CSVReport-Object-ToCreate');
|
||||
@@ -258,12 +274,12 @@ class CSVImportPageProcessor
|
||||
case 'RowStatus_Issue':
|
||||
$iErrors++;
|
||||
$sMessage = self::GetDivAlert($oStatus->GetDescription());
|
||||
$sStatus = '<div class="ibo-csv-import--cell-error"><i class="fas fa-exclamation-triangle" title="' . Dict::S('UI:CSVReport-Icon-Error') . '" /></div>';//translate
|
||||
$sStatus = '<div class="ibo-csv-import--cell-error"><i class="fas fa-exclamation-triangle" title="'.Dict::S('UI:CSVReport-Icon-Error').'" /></div>';//translate
|
||||
$sCSSMessageClass = 'ibo-csv-import--cell-error';
|
||||
$sCSSRowClass = 'ibo-csv-import--row-error';
|
||||
if (array_key_exists($iLine, $aData)) {
|
||||
$aRow = $aData[$iLine];
|
||||
$aResult[] = $sTextQualifier . implode($sTextQualifier . $sSeparator . $sTextQualifier, $aRow) . $sTextQualifier; // Remove the first line and store it in case of error
|
||||
$aResult[] = $sTextQualifier.implode($sTextQualifier.$sSeparator.$sTextQualifier, $aRow).$sTextQualifier; // Remove the first line and store it in case of error
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -287,7 +303,7 @@ class CSVImportPageProcessor
|
||||
case 'CellStatus_Issue':
|
||||
case 'CellStatus_NullIssue':
|
||||
$sCellMessage .= self::GetDivAlert($oCellStatus->GetDescription());
|
||||
$aTableRow[$sClassName . '/' . $sAttCode] = '<div class="ibo-csv-import--cell-error">' . Dict::Format('UI:CSVReport-Object-Error', $sHtmlValue) . $sCellMessage . '</div>';
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] = '<div class="ibo-csv-import--cell-error">'.Dict::Format('UI:CSVReport-Object-Error', $sHtmlValue).$sCellMessage.'</div>';
|
||||
break;
|
||||
|
||||
case 'CellStatus_SearchIssue':
|
||||
@@ -295,7 +311,7 @@ class CSVImportPageProcessor
|
||||
$sDivAlert = self::GetDivAlert($oCellStatus->GetDescription());
|
||||
$sAllowedValuesLinkUrl = $oCellStatus->GetAllowedValuesLinkUrl();
|
||||
$sAllowedValuesLinkLabel = Dict::S('UI:CSVImport:ViewAllPossibleValues');
|
||||
$aTableRow[$sClassName . '/' . $sAttCode] =
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] =
|
||||
<<<HTML
|
||||
<div class="ibo-csv-import--cell-error">
|
||||
$sMessage
|
||||
@@ -310,7 +326,7 @@ HTML;
|
||||
$sDivAlert = self::GetDivAlert($oCellStatus->GetDescription());
|
||||
$sSearchLinkUrl = $oCellStatus->GetSearchLinkUrl();
|
||||
$sSearchLinkLabel = Dict::S('UI:CSVImport:ViewAllAmbiguousValues');
|
||||
$aTableRow[$sClassName . '/' . $sAttCode] =
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] =
|
||||
<<<HTML
|
||||
<div class="ibo-csv-import--cell-error">
|
||||
$sMessage
|
||||
@@ -321,11 +337,11 @@ HTML;
|
||||
break;
|
||||
|
||||
case 'CellStatus_Modify':
|
||||
$aTableRow[$sClassName . '/' . $sAttCode] = '<div class="ibo-csv-import--cell-modified"><b>' . $sHtmlValue . '</b></div>';
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] = '<div class="ibo-csv-import--cell-modified"><b>'.$sHtmlValue.'</b></div>';
|
||||
break;
|
||||
|
||||
default:
|
||||
$aTableRow[$sClassName . '/' . $sAttCode] = $sHtmlValue . $sCellMessage;
|
||||
$aTableRow[$sClassName.'/'.$sAttCode] = $sHtmlValue.$sCellMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -384,28 +400,28 @@ HTML;
|
||||
$oMulticolumn->AddCSSClass('ml-1');
|
||||
$oForm->AddSubBlock($oMulticolumn);
|
||||
|
||||
$oCheckBoxUnchanged = InputUIBlockFactory::MakeForInputWithLabel('<img src="' . $sAppRootUrl . 'images/unchanged.png"> ' . sprintf($aDisplayFilters['unchanged'], $iUnchanged), '', "1", "show_unchanged", "checkbox");
|
||||
$oCheckBoxUnchanged = InputUIBlockFactory::MakeForInputWithLabel('<img src="'.$sAppRootUrl.'images/unchanged.png"> '.sprintf($aDisplayFilters['unchanged'], $iUnchanged), '', "1", "show_unchanged", "checkbox");
|
||||
$oCheckBoxUnchanged->GetInput()->SetIsChecked(true);
|
||||
$oCheckBoxUnchanged->SetBeforeInput(false);
|
||||
$oCheckBoxUnchanged->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
$oMulticolumn->AddColumn(ColumnUIBlockFactory::MakeForBlock($oCheckBoxUnchanged));
|
||||
$oPage->add_ready_script("$('#show_unchanged').on('click', function(){ToggleRows('ibo-csv-import--row-unchanged')})");
|
||||
|
||||
$oCheckBoxUnchanged = InputUIBlockFactory::MakeForInputWithLabel('<img src="' . $sAppRootUrl . 'images/modified.png"> ' . sprintf($aDisplayFilters['modified'], $iModified), '', "1", "show_modified", "checkbox");
|
||||
$oCheckBoxUnchanged = InputUIBlockFactory::MakeForInputWithLabel('<img src="'.$sAppRootUrl.'images/modified.png"> '.sprintf($aDisplayFilters['modified'], $iModified), '', "1", "show_modified", "checkbox");
|
||||
$oCheckBoxUnchanged->GetInput()->SetIsChecked(true);
|
||||
$oCheckBoxUnchanged->SetBeforeInput(false);
|
||||
$oCheckBoxUnchanged->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
$oMulticolumn->AddColumn(ColumnUIBlockFactory::MakeForBlock($oCheckBoxUnchanged));
|
||||
$oPage->add_ready_script("$('#show_modified').on('click', function(){ToggleRows('ibo-csv-import--row-modified')})");
|
||||
|
||||
$oCheckBoxUnchanged = InputUIBlockFactory::MakeForInputWithLabel('<img src="' . $sAppRootUrl . 'images/added.png"> ' . sprintf($aDisplayFilters['added'], $iCreated), '', "1", "show_created", "checkbox");
|
||||
$oCheckBoxUnchanged = InputUIBlockFactory::MakeForInputWithLabel('<img src="'.$sAppRootUrl.'images/added.png"> '.sprintf($aDisplayFilters['added'], $iCreated), '', "1", "show_created", "checkbox");
|
||||
$oCheckBoxUnchanged->GetInput()->SetIsChecked(true);
|
||||
$oCheckBoxUnchanged->SetBeforeInput(false);
|
||||
$oCheckBoxUnchanged->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
$oMulticolumn->AddColumn(ColumnUIBlockFactory::MakeForBlock($oCheckBoxUnchanged));
|
||||
$oPage->add_ready_script("$('#show_created').on('click', function(){ToggleRows('ibo-csv-import--row-added')})");
|
||||
|
||||
$oCheckBoxUnchanged = InputUIBlockFactory::MakeForInputWithLabel('<span style="color:#A33; background-color: #FFF0F0;"><i class="fas fa-exclamation-triangle"></i> ' . sprintf($aDisplayFilters['errors'], $iErrors) . '</span>', '', "1", "show_errors", "checkbox");
|
||||
$oCheckBoxUnchanged = InputUIBlockFactory::MakeForInputWithLabel('<span style="color:#A33; background-color: #FFF0F0;"><i class="fas fa-exclamation-triangle"></i> '.sprintf($aDisplayFilters['errors'], $iErrors).'</span>', '', "1", "show_errors", "checkbox");
|
||||
$oCheckBoxUnchanged->GetInput()->SetIsChecked(true);
|
||||
$oCheckBoxUnchanged->SetBeforeInput(false);
|
||||
$oCheckBoxUnchanged->GetInput()->AddCSSClass('ibo-input-checkbox');
|
||||
@@ -420,7 +436,6 @@ HTML;
|
||||
$oTable->AddOption('bFullscreen', true);
|
||||
$oPanel->AddSubBlock($oTable);
|
||||
|
||||
|
||||
if ($bSimulate) {
|
||||
$oForm->AddSubBlock(ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Restart'))->SetOnClickJsCode("CSVRestart()"));
|
||||
}
|
||||
@@ -609,4 +624,4 @@ EOF
|
||||
{
|
||||
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden($name, (string)$value, $id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ class InterfaceDiscovery
|
||||
private ?array $aForcedClassMap = null; // For testing purposes
|
||||
private bool $bCheckInterfaceImplementation = true; // false only for testing purposes
|
||||
|
||||
const CACHE_NONE = 'CACHE_NONE';
|
||||
const CACHE_DYNAMIC = 'CACHE_DYNAMIC'; // rebuild cache when files changes
|
||||
const CACHE_STATIC = 'CACHE_STATIC'; // Built once at setup
|
||||
public const CACHE_NONE = 'CACHE_NONE';
|
||||
public const CACHE_DYNAMIC = 'CACHE_DYNAMIC'; // rebuild cache when files changes
|
||||
public const CACHE_STATIC = 'CACHE_STATIC'; // Built once at setup
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
@@ -91,7 +91,7 @@ class InterfaceDiscovery
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! class_exists($sPHPClass)){
|
||||
if (! class_exists($sPHPClass)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ class InterfaceDiscovery
|
||||
|
||||
// guess all the autoload class maps from the extensions
|
||||
$aAutoloadClassMaps = glob(APPROOT.'env-'.utils::GetCurrentEnvironment().'/*/vendor/composer/autoload_classmap.php');
|
||||
if($aAutoloadClassMaps === false) {
|
||||
if ($aAutoloadClassMaps === false) {
|
||||
$aAutoloadClassMaps = [];
|
||||
}
|
||||
$aAutoloadClassMaps[] = APPROOT.'lib/composer/autoload_classmap.php';
|
||||
@@ -141,8 +141,7 @@ class InterfaceDiscovery
|
||||
{
|
||||
try {
|
||||
$oRefClass = new ReflectionClass($sPHPClass);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -251,12 +250,12 @@ class InterfaceDiscovery
|
||||
$aClasses = $this->oCacheService->Fetch('InterfaceDiscovery', $sKey);
|
||||
|
||||
$aRealClasses = [];
|
||||
foreach ($aClasses as $sPHPClass){
|
||||
if (! class_exists($sPHPClass)){
|
||||
foreach ($aClasses as $sPHPClass) {
|
||||
if (! class_exists($sPHPClass)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$aRealClasses[]=$sPHPClass;
|
||||
$aRealClasses[] = $sPHPClass;
|
||||
}
|
||||
return $aRealClasses;
|
||||
}
|
||||
@@ -317,4 +316,4 @@ class InterfaceDiscovery
|
||||
|
||||
return self::CACHE_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -48,7 +49,7 @@ class LinkSetDataTransformer
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
static public function Decode(iDBObjectSetIterator $oDbObjectSet, string $sTargetClass, string $sTargetField = null): array
|
||||
public static function Decode(iDBObjectSetIterator $oDbObjectSet, string $sTargetClass, string $sTargetField = null): array
|
||||
{
|
||||
try {
|
||||
// Prepare result
|
||||
@@ -74,8 +75,7 @@ class LinkSetDataTransformer
|
||||
}
|
||||
|
||||
return $aResult;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
@@ -96,7 +96,7 @@ class LinkSetDataTransformer
|
||||
*
|
||||
* @return array{to_be_created: array, to_be_deleted: array, to_be_added: array, to_be_removed: array}
|
||||
*/
|
||||
static public function Encode(array $aElements, string $sLinkClass, string $sExtKeyToRemote = null): array
|
||||
public static function Encode(array $aElements, string $sLinkClass, string $sExtKeyToRemote = null): array
|
||||
{
|
||||
// Result arrays
|
||||
$aToBeCreate = [];
|
||||
@@ -125,7 +125,7 @@ class LinkSetDataTransformer
|
||||
}
|
||||
break;
|
||||
|
||||
// OPERATION REMOVE
|
||||
// OPERATION REMOVE
|
||||
case 'remove':
|
||||
if ($sExtKeyToRemote === null) {
|
||||
// Direct link detach
|
||||
@@ -156,7 +156,7 @@ class LinkSetDataTransformer
|
||||
* @param \ormLinkSet $oOrmLinkSet
|
||||
*
|
||||
*/
|
||||
static public function StringToOrmLinkSet(string $sValue, ormLinkSet $oOrmLinkSet)
|
||||
public static function StringToOrmLinkSet(string $sValue, ormLinkSet $oOrmLinkSet)
|
||||
{
|
||||
try {
|
||||
$aItems = explode(" ", $sValue);
|
||||
@@ -169,9 +169,8 @@ class LinkSetDataTransformer
|
||||
$oOrmLinkSet->AddItem($oItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
ExceptionLog::LogException($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -39,8 +40,7 @@ class LinkSetModel
|
||||
} else {
|
||||
return $oAttDef->GetLinkedClass();
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
@@ -90,4 +90,4 @@ class LinkSetModel
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -24,7 +25,6 @@ use utils;
|
||||
*/
|
||||
class LinkSetRepository
|
||||
{
|
||||
|
||||
/**
|
||||
* Get list of remote objects information based on a linkSet
|
||||
*
|
||||
@@ -36,7 +36,7 @@ class LinkSetRepository
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
static public function LinksDbSetToTargetObjectArray(iDBObjectSetIterator $oDbObjectSet, bool $bForce, array &$aInitialOptions, string $sTargetClass, string $sTargetField = null): ?array
|
||||
public static function LinksDbSetToTargetObjectArray(iDBObjectSetIterator $oDbObjectSet, bool $bForce, array &$aInitialOptions, string $sTargetClass, string $sTargetField = null): ?array
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -90,8 +90,7 @@ class LinkSetRepository
|
||||
}
|
||||
|
||||
return $aInitialOptions;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
@@ -99,4 +98,4 @@ class LinkSetRepository
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -71,7 +72,7 @@ class LinksBulkDataPostProcessor implements iDataPostProcessor
|
||||
|
||||
// Group by links attached to object selection
|
||||
$oFieldExp = new FieldExpression($sTargetField, 'lnk');
|
||||
$sQuery = $oDbObjectSearch->MakeGroupByQuery([$sTargetField], array('grouped_by_1' => $oFieldExp), true);
|
||||
$sQuery = $oDbObjectSearch->MakeGroupByQuery([$sTargetField], ['grouped_by_1' => $oFieldExp], true);
|
||||
$aGroupResult = CMDBSource::QueryToArray($sQuery, MYSQLI_ASSOC);
|
||||
|
||||
// Iterate throw result...
|
||||
@@ -109,8 +110,7 @@ class LinksBulkDataPostProcessor implements iDataPostProcessor
|
||||
|
||||
// Order items
|
||||
usort($aResult, [self::class, "CompareItems"]);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
|
||||
ExceptionLog::LogException($e);
|
||||
}
|
||||
@@ -128,7 +128,7 @@ class LinksBulkDataPostProcessor implements iDataPostProcessor
|
||||
*
|
||||
* @return array|int
|
||||
*/
|
||||
static private function CompareItems($aItemA, $aItemB): int
|
||||
private static function CompareItems($aItemA, $aItemB): int
|
||||
{
|
||||
if ($aItemA['occurrence'] === $aItemB['occurrence']) {
|
||||
return 0;
|
||||
@@ -136,4 +136,4 @@ class LinksBulkDataPostProcessor implements iDataPostProcessor
|
||||
|
||||
return ($aItemA['occurrence'] > $aItemB['occurrence']) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -29,188 +30,183 @@ class ModuleService
|
||||
return static::$oInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a "signature" of the method of an extension in the form of: "[module-name] class::method()"
|
||||
*
|
||||
* @param object|string $object Object or class
|
||||
* @param string $sMethod
|
||||
*
|
||||
* @return string
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function GetModuleMethodSignature($object, string $sMethod): string
|
||||
{
|
||||
$sSignature = '';
|
||||
$oReflectionMethod = new ReflectionMethod($object, $sMethod);
|
||||
$oReflectionClass = $oReflectionMethod->getDeclaringClass();
|
||||
$sExtension = $this->GetModuleNameFromObject($oReflectionClass->getName());
|
||||
if (strlen($sExtension) !== 0) {
|
||||
$sSignature .= '['.$sExtension.'] ';
|
||||
} else {
|
||||
$sSignature .= '[core] ';
|
||||
}
|
||||
$sSignature .= $oReflectionClass->getShortName().'::'.$sMethod.'()';
|
||||
/**
|
||||
* Get a "signature" of the method of an extension in the form of: "[module-name] class::method()"
|
||||
*
|
||||
* @param object|string $object Object or class
|
||||
* @param string $sMethod
|
||||
*
|
||||
* @return string
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function GetModuleMethodSignature($object, string $sMethod): string
|
||||
{
|
||||
$sSignature = '';
|
||||
$oReflectionMethod = new ReflectionMethod($object, $sMethod);
|
||||
$oReflectionClass = $oReflectionMethod->getDeclaringClass();
|
||||
$sExtension = $this->GetModuleNameFromObject($oReflectionClass->getName());
|
||||
if (strlen($sExtension) !== 0) {
|
||||
$sSignature .= '['.$sExtension.'] ';
|
||||
} else {
|
||||
$sSignature .= '[core] ';
|
||||
}
|
||||
$sSignature .= $oReflectionClass->getShortName().'::'.$sMethod.'()';
|
||||
|
||||
return $sSignature;
|
||||
}
|
||||
return $sSignature;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the module name from an object or class
|
||||
*
|
||||
* @param object|string $object
|
||||
*
|
||||
* @return string
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function GetModuleNameFromObject($object): string
|
||||
{
|
||||
$oReflectionClass = new ReflectionClass($object);
|
||||
$sPath = str_replace('\\', '/', $oReflectionClass->getFileName());
|
||||
$sPattern = str_replace('\\', '/', '@'.APPROOT.'env-'.utils::GetCurrentEnvironment()).'/(?<ext>.+)/@U';
|
||||
if (preg_match($sPattern, $sPath, $aMatches) !== false) {
|
||||
if (isset($aMatches['ext'])) {
|
||||
return $aMatches['ext'];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get the module name from an object or class
|
||||
*
|
||||
* @param object|string $object
|
||||
*
|
||||
* @return string
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function GetModuleNameFromObject($object): string
|
||||
{
|
||||
$oReflectionClass = new ReflectionClass($object);
|
||||
$sPath = str_replace('\\', '/', $oReflectionClass->getFileName());
|
||||
$sPattern = str_replace('\\', '/', '@'.APPROOT.'env-'.utils::GetCurrentEnvironment()).'/(?<ext>.+)/@U';
|
||||
if (preg_match($sPattern, $sPath, $aMatches) !== false) {
|
||||
if (isset($aMatches['ext'])) {
|
||||
return $aMatches['ext'];
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* **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()
|
||||
*/
|
||||
public function GetCurrentModuleDir(int $iCallDepth): string
|
||||
{
|
||||
$sCurrentModuleDir = '';
|
||||
$aCallStack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
$sCallerFile = realpath($aCallStack[$iCallDepth]['file']);
|
||||
/**
|
||||
* **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()
|
||||
*/
|
||||
public function GetCurrentModuleDir(int $iCallDepth): string
|
||||
{
|
||||
$sCurrentModuleDir = '';
|
||||
$aCallStack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
$sCallerFile = realpath($aCallStack[$iCallDepth]['file']);
|
||||
|
||||
foreach(GetModulesInfo() as $sModuleName => $aInfo)
|
||||
{
|
||||
if ($aInfo['root_dir'] !== '')
|
||||
{
|
||||
$sRootDir = realpath(APPROOT.$aInfo['root_dir']);
|
||||
foreach (GetModulesInfo() as $sModuleName => $aInfo) {
|
||||
if ($aInfo['root_dir'] !== '') {
|
||||
$sRootDir = realpath(APPROOT.$aInfo['root_dir']);
|
||||
|
||||
if(substr($sCallerFile, 0, strlen($sRootDir)) === $sRootDir)
|
||||
{
|
||||
$sCurrentModuleDir = basename($sRootDir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $sCurrentModuleDir;
|
||||
}
|
||||
if (substr($sCallerFile, 0, strlen($sRootDir)) === $sRootDir) {
|
||||
$sCurrentModuleDir = basename($sRootDir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $sCurrentModuleDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* **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 function GetCurrentModuleUrl(int $iCallDepth = 0): string
|
||||
{
|
||||
$sDir = $this->GetCurrentModuleDir(1 + $iCallDepth);
|
||||
if ( $sDir !== '')
|
||||
{
|
||||
return utils::GetAbsoluteUrlModulesRoot().'/'.$sDir;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
/**
|
||||
* **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 function GetCurrentModuleUrl(int $iCallDepth = 0): string
|
||||
{
|
||||
$sDir = $this->GetCurrentModuleDir(1 + $iCallDepth);
|
||||
if ($sDir !== '') {
|
||||
return utils::GetAbsoluteUrlModulesRoot().'/'.$sDir;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sProperty The name of the property to retrieve
|
||||
* @param mixed $defaultValue
|
||||
*
|
||||
* @return mixed the value of a given setting for the current module
|
||||
*/
|
||||
public function GetCurrentModuleSetting(string $sProperty, $defaultValue = null)
|
||||
{
|
||||
$sModuleName = $this->GetCurrentModuleName(1);
|
||||
return MetaModel::GetModuleSetting($sModuleName, $sProperty, $defaultValue);
|
||||
}
|
||||
/**
|
||||
* @param string $sProperty The name of the property to retrieve
|
||||
* @param mixed $defaultValue
|
||||
*
|
||||
* @return mixed the value of a given setting for the current module
|
||||
*/
|
||||
public function GetCurrentModuleSetting(string $sProperty, $defaultValue = null)
|
||||
{
|
||||
$sModuleName = $this->GetCurrentModuleName(1);
|
||||
return MetaModel::GetModuleSetting($sModuleName, $sProperty, $defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sModuleName
|
||||
*
|
||||
* @return string|NULL compiled version of a given module, as it was seen by the compiler
|
||||
*/
|
||||
public function GetCompiledModuleVersion(string $sModuleName): ?string
|
||||
{
|
||||
$aModulesInfo = GetModulesInfo();
|
||||
if (array_key_exists($sModuleName, $aModulesInfo))
|
||||
{
|
||||
return $aModulesInfo[$sModuleName]['version'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @param string $sModuleName
|
||||
*
|
||||
* @return string|NULL compiled version of a given module, as it was seen by the compiler
|
||||
*/
|
||||
public function GetCompiledModuleVersion(string $sModuleName): ?string
|
||||
{
|
||||
$aModulesInfo = GetModulesInfo();
|
||||
if (array_key_exists($sModuleName, $aModulesInfo)) {
|
||||
return $aModulesInfo[$sModuleName]['version'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name 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 int $iCallDepth The depth of the module in the callstack. Zero when called directly from within the module
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetCurrentModuleName(int $iCallDepth = 0): string
|
||||
{
|
||||
$sCurrentModuleName = '';
|
||||
$aCallStack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
$sCallerFile = realpath($aCallStack[$iCallDepth]['file']);
|
||||
/**
|
||||
* Returns the name 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 int $iCallDepth The depth of the module in the callstack. Zero when called directly from within the module
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetCurrentModuleName(int $iCallDepth = 0): string
|
||||
{
|
||||
$sCurrentModuleName = '';
|
||||
$aCallStack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
$sCallerFile = realpath($aCallStack[$iCallDepth]['file']);
|
||||
|
||||
return $this->GetModuleNameFromPath($sCallerFile);
|
||||
}
|
||||
return $this->GetModuleNameFromPath($sCallerFile);
|
||||
}
|
||||
|
||||
private function GetModuleNameFromPath($sPath)
|
||||
{
|
||||
foreach (GetModulesInfo() as $sModuleName => $aInfo) {
|
||||
if ($aInfo['root_dir'] !== '') {
|
||||
$sRootDir = realpath(APPROOT.$aInfo['root_dir']);
|
||||
if (substr($sPath, 0, strlen($sRootDir)) === $sRootDir) {
|
||||
private function GetModuleNameFromPath($sPath)
|
||||
{
|
||||
foreach (GetModulesInfo() as $sModuleName => $aInfo) {
|
||||
if ($aInfo['root_dir'] !== '') {
|
||||
$sRootDir = realpath(APPROOT.$aInfo['root_dir']);
|
||||
if (substr($sPath, 0, strlen($sRootDir)) === $sRootDir) {
|
||||
|
||||
return $sModuleName;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $sModuleName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the extension code from the call stack.
|
||||
* Scan the call stack until a module is found.
|
||||
*
|
||||
* @param int $iLevelsToIgnore
|
||||
*
|
||||
* @return string module name
|
||||
*/
|
||||
public function GetModuleNameFromCallStack(int $iLevelsToIgnore = 0): string
|
||||
{
|
||||
$aCallStack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
$aCallStack = array_slice($aCallStack, $iLevelsToIgnore);
|
||||
/**
|
||||
* Get the extension code from the call stack.
|
||||
* Scan the call stack until a module is found.
|
||||
*
|
||||
* @param int $iLevelsToIgnore
|
||||
*
|
||||
* @return string module name
|
||||
*/
|
||||
public function GetModuleNameFromCallStack(int $iLevelsToIgnore = 0): string
|
||||
{
|
||||
$aCallStack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
$aCallStack = array_slice($aCallStack, $iLevelsToIgnore);
|
||||
|
||||
foreach ($aCallStack as $aCallInfo) {
|
||||
$sFile = realpath(empty($aCallInfo['file']) ? '' : $aCallInfo['file']);
|
||||
foreach ($aCallStack as $aCallInfo) {
|
||||
$sFile = realpath(empty($aCallInfo['file']) ? '' : $aCallInfo['file']);
|
||||
|
||||
$sModuleName = $this->GetModuleNameFromPath($sFile);
|
||||
if (strlen($sModuleName) > 0) {
|
||||
return $sModuleName;
|
||||
}
|
||||
}
|
||||
$sModuleName = $this->GetModuleNameFromPath($sFile);
|
||||
if (strlen($sModuleName) > 0) {
|
||||
return $sModuleName;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Combodo\iTop\Service\Notification\Event;
|
||||
namespace Combodo\iTop\Service\Notification\Event;
|
||||
|
||||
use DBObjectSearch;
|
||||
use DBObjectSet;
|
||||
@@ -17,11 +17,10 @@ class EventNotificationNewsroomGC implements iBackgroundProcess
|
||||
$iDeletionTime = (int) MetaModel::GetConfig()->Get('notifications.itop.read_notification_retention');
|
||||
$oDBObjectSearch = DBObjectSearch::FromOQL("SELECT EventNotificationNewsroom WHERE read='yes' AND read_date < DATE_SUB(NOW(), INTERVAL :deletion_time DAY)", ['deletion_time' => $iDeletionTime]);
|
||||
$oEventNotificationNewsroomSet = new DBObjectSet($oDBObjectSearch);
|
||||
while($oEventNotificationNewsroom = $oEventNotificationNewsroomSet->Fetch()){
|
||||
while ($oEventNotificationNewsroom = $oEventNotificationNewsroomSet->Fetch()) {
|
||||
$oEventNotificationNewsroom->DBDelete();
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
ExceptionLog::LogException($e);
|
||||
return false;
|
||||
}
|
||||
@@ -30,6 +29,6 @@ class EventNotificationNewsroomGC implements iBackgroundProcess
|
||||
|
||||
public function GetPeriodicity()
|
||||
{
|
||||
return 24*3600; // Every day
|
||||
return 24 * 3600; // Every day
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace Combodo\iTop\Service\Notification\Event;
|
||||
|
||||
namespace Combodo\iTop\Service\Notification\Event;
|
||||
|
||||
use Action;
|
||||
use Combodo\iTop\Application\Branding;
|
||||
@@ -17,7 +17,8 @@ use utils;
|
||||
* @since 3.2.0
|
||||
* @api
|
||||
*/
|
||||
class EventNotificationNewsroomService {
|
||||
class EventNotificationNewsroomService
|
||||
{
|
||||
/**
|
||||
* @param \Action $oAction
|
||||
* @param int $iContactId
|
||||
@@ -36,7 +37,7 @@ class EventNotificationNewsroomService {
|
||||
*/
|
||||
public static function MakeEventFromAction(Action $oAction, int $iContactId, int $iTriggerId, string $sMessage, string $sTitle, string $sUrl, int $iObjectId, ?string $sObjectClass, string|null $sDate = null): EventNotificationNewsroom
|
||||
{
|
||||
|
||||
|
||||
$oEvent = new EventNotificationNewsroom();
|
||||
$oEvent->Set('title', $sTitle);
|
||||
$oEvent->Set('message', $sMessage);
|
||||
@@ -67,7 +68,7 @@ class EventNotificationNewsroomService {
|
||||
} else {
|
||||
$oEvent->SetCurrentDate('date');
|
||||
}
|
||||
|
||||
|
||||
return $oEvent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ class NotificationsRepository
|
||||
{
|
||||
$oSearch = DBObjectSearch::FromOQL("SELECT lnkActionNotificationToContact AS lnk WHERE lnk.contact_id = :contact_id");
|
||||
$oSearch->SetInternalParams([
|
||||
"contact_id" => $iContactId
|
||||
"contact_id" => $iContactId,
|
||||
]);
|
||||
|
||||
return new DBObjectSet($oSearch);
|
||||
@@ -232,7 +232,8 @@ class NotificationsRepository
|
||||
public function SearchSubscriptionsByTriggerContactAndSubscription(int $iTriggerId, int $iContactId, string $sSubscription): DBObjectSet
|
||||
{
|
||||
$oSearch = DBObjectSearch::FromOQL("SELECT lnkActionNotificationToContact AS lnk WHERE lnk.contact_id = :contact_id AND lnk.trigger_id = :trigger_id AND lnk.subscribed = :subscription");
|
||||
$oSearch->SetInternalParams([
|
||||
$oSearch->SetInternalParams(
|
||||
[
|
||||
"trigger_id" => $iTriggerId,
|
||||
"contact_id" => $iContactId,
|
||||
"subscription" => $sSubscription]
|
||||
@@ -241,7 +242,6 @@ class NotificationsRepository
|
||||
return new DBObjectSet($oSearch);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Search for subscriptions based on trigger, contact, subscription type, and final class.
|
||||
*
|
||||
@@ -259,7 +259,7 @@ class NotificationsRepository
|
||||
"trigger_id" => $iTriggerId,
|
||||
"contact_id" => $iContactId,
|
||||
"subscription" => $sSubscription,
|
||||
"finalclass" => $sFinalclass
|
||||
"finalclass" => $sFinalclass,
|
||||
]);
|
||||
|
||||
return new DBObjectSet($oSearch);
|
||||
@@ -270,4 +270,4 @@ class NotificationsRepository
|
||||
$oSearch = DBObjectSearch::FromOQL("SELECT Contact AS c JOIN lnkActionNotificationToContact AS lnk ON lnk.contact_id = c.id WHERE lnk.trigger_id = :trigger_id AND lnk.action_id = :action_id AND lnk.subscribed = '0'");
|
||||
return $oSearch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace Combodo\iTop\Service\Notification;
|
||||
|
||||
namespace Combodo\iTop\Service\Notification;
|
||||
|
||||
use ActionNotification;
|
||||
use Combodo\iTop\Core\Trigger\Enum\SubscriptionPolicy;
|
||||
@@ -15,7 +15,8 @@ use Trigger;
|
||||
* @package Combodo\iTop\Service\Notification
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class NotificationsService {
|
||||
class NotificationsService
|
||||
{
|
||||
protected static ?NotificationsService $oSingleton = null;
|
||||
|
||||
/**
|
||||
@@ -40,7 +41,8 @@ class NotificationsService {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function __construct() {
|
||||
protected function __construct()
|
||||
{
|
||||
// Don't do anything, we don't want to be initialized
|
||||
}
|
||||
|
||||
@@ -74,8 +76,7 @@ class NotificationsService {
|
||||
$oSubscribedActionsNotifications->Set('trigger_id', $oTrigger->GetKey());
|
||||
$oSubscribedActionsNotifications->Set('subscribed', true);
|
||||
$oSubscribedActionsNotifications->DBInsertNoReload();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
while ($oSubscribedActionsNotifications = $oSubscribedActionsNotificationsSet->Fetch()) {
|
||||
// Update the subscription
|
||||
$oSubscribedActionsNotifications->Set('subscribed', true);
|
||||
@@ -114,4 +115,4 @@ class NotificationsService {
|
||||
return $oSubscribedActionsNotifications->Get('subscribed');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -18,5 +19,4 @@ namespace Combodo\iTop\Service\Router\Exception;
|
||||
*/
|
||||
class RouteNotFoundException extends RouterException
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -20,5 +21,4 @@ use Exception;
|
||||
*/
|
||||
class RouterException extends Exception
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -93,11 +94,11 @@ class Router
|
||||
$sUrl = $bAbsoluteUrl ? utils::GetAbsoluteUrlAppRoot() : '';
|
||||
|
||||
// Add route URL
|
||||
$sUrl .= 'pages/UI.php?route=' . $sRoute;
|
||||
$sUrl .= 'pages/UI.php?route='.$sRoute;
|
||||
|
||||
// Add parameters and url encode them
|
||||
if (count($aParams) > 0) {
|
||||
$sUrl .= '&' . http_build_query($aParams);
|
||||
$sUrl .= '&'.http_build_query($aParams);
|
||||
}
|
||||
|
||||
return $sUrl;
|
||||
@@ -197,10 +198,10 @@ class Router
|
||||
// eg. "do_something"
|
||||
$sRouteOperation = utils::ToSnakeCase(substr($oReflectionMethod->name, $iPos + strlen($sPrefix)));
|
||||
|
||||
$aRoutes[$sRouteNamespace . '.' . $sRouteOperation] = [
|
||||
$aRoutes[$sRouteNamespace.'.'.$sRouteOperation] = [
|
||||
'namespace' => $sRouteNamespace,
|
||||
'operation' => $sRouteOperation,
|
||||
'controller' => $sControllerFQCN . '::' . $sMethodName,
|
||||
'controller' => $sControllerFQCN.'::'.$sMethodName,
|
||||
'description' => $oReflectionMethod->getDocComment(),
|
||||
];
|
||||
}
|
||||
@@ -313,4 +314,4 @@ class Router
|
||||
{
|
||||
return utils::GetCachePath().'router/available-routes.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -16,11 +17,11 @@ use UserRights;
|
||||
* Class SummaryCardService
|
||||
*
|
||||
* Service containing methods to call SummaryCards functionalities
|
||||
*
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
class SummaryCardService {
|
||||
|
||||
class SummaryCardService
|
||||
{
|
||||
/**
|
||||
* @param $sObjClass
|
||||
* @param $sObjKey
|
||||
@@ -32,7 +33,7 @@ class SummaryCardService {
|
||||
{
|
||||
$oRouter = Router::GetInstance();
|
||||
$sRoute = $oRouter->GenerateUrl("object.summary", ["obj_class" => $sObjClass, "obj_key" => $sObjKey]);
|
||||
return
|
||||
return
|
||||
<<<HTML
|
||||
data-tooltip-content="$sRoute"
|
||||
data-tooltip-interaction-enabled="true"
|
||||
@@ -45,12 +46,12 @@ data-tooltip-max-width="600px"
|
||||
data-tooltip-theme="object-summary"
|
||||
data-tooltip-append-to="body"
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the user is allowed to see this class and if the class is allowed to display its summary
|
||||
*
|
||||
*
|
||||
* @param string $sClass
|
||||
*
|
||||
* @return bool
|
||||
@@ -71,20 +72,20 @@ HTML;
|
||||
if (appUserPreferences::GetPref('show_summary_cards', true) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// - This class has a summary zlist
|
||||
$aDetailsList = MetaModel::GetZListItems($sClass, 'summary');
|
||||
if(count($aDetailsList) > 0) {
|
||||
if (count($aDetailsList) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// - Then maybe this class has complementary attributes
|
||||
$aComplementAttributeSpec = MetaModel::GetNameSpec($sClass, FriendlyNameType::COMPLEMENTARY);
|
||||
$aAdditionalField = $aComplementAttributeSpec[1];
|
||||
if (count($aAdditionalField) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -19,7 +20,6 @@ use MetaModel;
|
||||
*/
|
||||
class TemporaryObjectConfig
|
||||
{
|
||||
|
||||
private int $iGarbageInterval;
|
||||
private int $iConfigTemporaryLifetime;
|
||||
private bool $bConfigTemporaryForce;
|
||||
@@ -117,4 +117,4 @@ class TemporaryObjectConfig
|
||||
$this->iWatchdogInterval = $iWatchdogInterval;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -44,4 +45,4 @@ class TemporaryObjectGC implements iBackgroundProcess
|
||||
// Garbage temporary objects
|
||||
$this->oTemporaryObjectManager->GarbageExpiredTemporaryObjects();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -18,14 +19,14 @@ namespace Combodo\iTop\Service\TemporaryObjects;
|
||||
class TemporaryObjectHelper
|
||||
{
|
||||
// Global configuration
|
||||
const CONFIG_FORCE = 'temporary_object.force_creation';
|
||||
const CONFIG_TEMP_LIFETIME = 'temporary_object.lifetime';
|
||||
const CONFIG_WATCHDOG_INTERVAL = 'temporary_object.watchdog_interval';
|
||||
const CONFIG_GARBAGE_INTERVAL = 'temporary_object.garbage_interval';
|
||||
public const CONFIG_FORCE = 'temporary_object.force_creation';
|
||||
public const CONFIG_TEMP_LIFETIME = 'temporary_object.lifetime';
|
||||
public const CONFIG_WATCHDOG_INTERVAL = 'temporary_object.watchdog_interval';
|
||||
public const CONFIG_GARBAGE_INTERVAL = 'temporary_object.garbage_interval';
|
||||
|
||||
// Temporary descriptor operation
|
||||
const OPERATION_CREATE = 'create';
|
||||
const OPERATION_DELETE = 'delete';
|
||||
public const OPERATION_CREATE = 'create';
|
||||
public const OPERATION_DELETE = 'delete';
|
||||
|
||||
/**
|
||||
* GetWatchDogJS.
|
||||
@@ -34,7 +35,7 @@ class TemporaryObjectHelper
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
static public function GetWatchDogJS(string $sTempId): string
|
||||
public static function GetWatchDogJS(string $sTempId): string
|
||||
{
|
||||
$iWatchdogInterval = TemporaryObjectConfig::GetInstance()->GetWatchdogInterval();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -28,7 +29,7 @@ use utils;
|
||||
class TemporaryObjectManager
|
||||
{
|
||||
/** @var TemporaryObjectManager|null Singleton */
|
||||
static private ?TemporaryObjectManager $oSingletonInstance = null;
|
||||
private static ?TemporaryObjectManager $oSingletonInstance = null;
|
||||
|
||||
/** @var TemporaryObjectRepository $oTemporaryObjectRepository */
|
||||
private TemporaryObjectRepository $oTemporaryObjectRepository;
|
||||
@@ -106,8 +107,7 @@ class TemporaryObjectManager
|
||||
|
||||
// return operation success
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
return false;
|
||||
@@ -138,8 +138,7 @@ class TemporaryObjectManager
|
||||
}
|
||||
|
||||
return $bResult;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
return false;
|
||||
@@ -147,7 +146,6 @@ class TemporaryObjectManager
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extends the temporary object descriptor lifetime
|
||||
*
|
||||
@@ -181,8 +179,7 @@ class TemporaryObjectManager
|
||||
|
||||
// return operation success
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
return false;
|
||||
@@ -275,8 +272,7 @@ class TemporaryObjectManager
|
||||
IssueLog::Debug("Temporary Object [$sItemClass:$sItemId] $sOperation confirmed", LogChannels::TEMPORARY_OBJECTS, utils::GetStackTraceAsArray());
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
return false;
|
||||
@@ -315,8 +311,7 @@ class TemporaryObjectManager
|
||||
$oTemporaryObjectDescriptor->DBDelete();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
return false;
|
||||
@@ -353,8 +348,7 @@ class TemporaryObjectManager
|
||||
// Get host class attribute definition
|
||||
try {
|
||||
$oAttDef = MetaModel::GetAttributeDef($sHostClass, $sHostAttCode);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
return;
|
||||
@@ -392,8 +386,7 @@ class TemporaryObjectManager
|
||||
$this->CancelTemporaryObjects($oDBObjectSet->ToArray());
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
return false;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -26,7 +27,7 @@ use TemporaryObjectDescriptor;
|
||||
class TemporaryObjectRepository
|
||||
{
|
||||
/** @var TemporaryObjectRepository|null Singleton */
|
||||
static private ?TemporaryObjectRepository $oSingletonInstance = null;
|
||||
private static ?TemporaryObjectRepository $oSingletonInstance = null;
|
||||
|
||||
/**
|
||||
* GetInstance.
|
||||
@@ -82,8 +83,7 @@ class TemporaryObjectRepository
|
||||
$oTemporaryObjectDescriptor->DBInsert();
|
||||
|
||||
return $oTemporaryObjectDescriptor;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
@@ -174,8 +174,7 @@ class TemporaryObjectRepository
|
||||
|
||||
// return operation success
|
||||
return $oDbObjectSet->count();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -22,9 +23,8 @@ use Combodo\iTop\Service\Events\iEventServiceSetup;
|
||||
*/
|
||||
class TemporaryObjectsEvents implements iEventServiceSetup
|
||||
{
|
||||
|
||||
// Startup events
|
||||
const TEMPORARY_OBJECT_EVENT_CONFIRM_CREATE = 'TEMPORARY_OBJECT_EVENT_CONFIRM_CREATE';
|
||||
public const TEMPORARY_OBJECT_EVENT_CONFIRM_CREATE = 'TEMPORARY_OBJECT_EVENT_CONFIRM_CREATE';
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
@@ -50,7 +50,8 @@ class TemporaryObjectsEvents implements iEventServiceSetup
|
||||
'string',
|
||||
),
|
||||
],
|
||||
'application'));
|
||||
'application'
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user