Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13,790 changes: 0 additions & 13,790 deletions core/attributedef.class.inc.php

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions core/oql/oqlquery.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ public function Check(ModelReflection $oModelReflection, $sSourceQuery, $aParent
{
throw new OqlNormalizeException('Unknown class in join condition (right expression)', $sSourceQuery, $oRightField->GetParentDetails(), array_keys($aAliases));
}
$aExtKeys = $oModelReflection->ListAttributes($aAliases[$sFromClass], 'AttributeExternalKey');
$aObjKeys = $oModelReflection->ListAttributes($aAliases[$sFromClass], 'AttributeObjectKey');
$aExtKeys = $oModelReflection->ListAttributes($aAliases[$sFromClass], \Combodo\iTop\Core\AttributeDefinition\AttributeExternalKey::class);
$aObjKeys = $oModelReflection->ListAttributes($aAliases[$sFromClass], \Combodo\iTop\Core\AttributeDefinition\AttributeObjectKey::class);
$aAllKeys = array_merge($aExtKeys, $aObjKeys);
if (!array_key_exists($sExtKeyAttCode, $aAllKeys))
{
Expand Down Expand Up @@ -557,7 +557,7 @@ public function Check(ModelReflection $oModelReflection, $sSourceQuery, $aParent
}
$aAttList = $oModelReflection->ListAttributes($aAliases[$sFromClass]);
$sAttType = $aAttList[$sExtKeyAttCode];
if(($iOperatorCode != TREE_OPERATOR_EQUALS) && !is_subclass_of($sAttType, 'AttributeHierarchicalKey') && ($sAttType != 'AttributeHierarchicalKey'))
if(($iOperatorCode != TREE_OPERATOR_EQUALS) && !is_subclass_of($sAttType, \Combodo\iTop\Core\AttributeDefinition\AttributeHierarchicalKey::class) && ($sAttType != \Combodo\iTop\Core\AttributeDefinition\AttributeHierarchicalKey::class))
{
throw new OqlNormalizeException("The specified tree operator $sOperator is not applicable to the key", $sSourceQuery, $oLeftField->GetNameDetails());
}
Expand Down
122 changes: 60 additions & 62 deletions lib/composer/autoload_classmap.php

Large diffs are not rendered by default.

122 changes: 60 additions & 62 deletions lib/composer/autoload_static.php

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions sources/Core/AttributeDefinition/AttributeApplicationLanguage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/

namespace Combodo\iTop\Core\AttributeDefinition;

use Dict;
use ValueSetEnum;

/**
* An attibute that matches one of the language codes availables in the dictionnary
*
* @package iTopORM
*/
class AttributeApplicationLanguage extends AttributeString
{
const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING;

public static function ListExpectedParams()
{
return parent::ListExpectedParams();
}

public function __construct($sCode, $aParams)
{
$this->m_sCode = $sCode;
$aAvailableLanguages = Dict::GetLanguages();
$aLanguageCodes = array();
foreach ($aAvailableLanguages as $sLangCode => $aInfo) {
$aLanguageCodes[$sLangCode] = $aInfo['description'].' ('.$aInfo['localized_description'].')';
}

// N°6462 This should be sorted directly in \Dict during the compilation but we can't for 2 reasons:
// - Additional languages can be added on the fly even though it is not recommended
// - Formatting is done at run time (just above)
natcasesort($aLanguageCodes);

$aParams["allowed_values"] = new ValueSetEnum($aLanguageCodes);
parent::__construct($sCode, $aParams);
}

public function RequiresIndex()
{
return true;
}

public function GetBasicFilterLooseOperator()
{
return '=';
}
}
44 changes: 44 additions & 0 deletions sources/Core/AttributeDefinition/AttributeArchiveDate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/

namespace Combodo\iTop\Core\AttributeDefinition;

use Dict;
use Exception;

class AttributeArchiveDate extends AttributeDate
{
/**
* Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329)
*
* @see https://www.php.net/manual/fr/language.oop5.decon.php states that child constructor can be ommited
* @see https://bugs.php.net/bug.php?id=79010 bug solved in PHP 7.4.9
*
* @param string $sCode
* @param array $aParams
*
* @throws Exception
* @noinspection SenselessProxyMethodInspection
*/
public function __construct($sCode, $aParams)
{
parent::__construct($sCode, $aParams);
}

public function GetLabel($sDefault = null)
{
$sDefault = Dict::S('Core:AttributeArchiveDate/Label', $sDefault);

return parent::GetLabel($sDefault);
}

public function GetDescription($sDefault = null)
{
$sDefault = Dict::S('Core:AttributeArchiveDate/Label+', $sDefault);

return parent::GetDescription($sDefault);
}
}
57 changes: 57 additions & 0 deletions sources/Core/AttributeDefinition/AttributeArchiveFlag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/

namespace Combodo\iTop\Core\AttributeDefinition;

use Dict;

class AttributeArchiveFlag extends AttributeBoolean
{
public function __construct($sCode)
{
parent::__construct($sCode, array(
"allowed_values" => null,
"sql" => $sCode,
"default_value" => false,
"is_null_allowed" => false,
"depends_on" => array(),
));
}

public function RequiresIndex()
{
return true;
}

public function CopyOnAllTables()
{
return true;
}

public function IsWritable()
{
return false;
}

public function IsMagic()
{
return true;
}

public function GetLabel($sDefault = null)
{
$sDefault = Dict::S('Core:AttributeArchiveFlag/Label', $sDefault);

return parent::GetLabel($sDefault);
}

public function GetDescription($sDefault = null)
{
$sDefault = Dict::S('Core:AttributeArchiveFlag/Label+', $sDefault);

return parent::GetDescription($sDefault);
}
}
Loading