From 900bd6956a235571addcbc84ef37a0a533cd28d7 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Mon, 20 Apr 2026 17:42:35 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B09525=20-=20TagSet=20Errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/ormtagset.class.inc.php | 14 +++++++------- .../2.x/itop-faq-light/module.itop-faq-light.php | 1 + sources/Core/AttributeDefinition/AttributeSet.php | 2 +- .../Core/AttributeDefinition/AttributeTagSet.php | 14 ++++++++------ 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/core/ormtagset.class.inc.php b/core/ormtagset.class.inc.php index 1af6549052..ee5a25da9f 100644 --- a/core/ormtagset.class.inc.php +++ b/core/ormtagset.class.inc.php @@ -43,24 +43,24 @@ final class ormTagSet extends ormSet /** * - * @param array $aTagCodes + * @param array|null $aItems * * @throws \CoreException * @throws \CoreUnexpectedValue when a code is invalid */ - public function SetValues($aTagCodes) + public function SetValues($aItems) { - if (is_null($aTagCodes)) { - $aTagCodes = []; + if (is_null($aItems)) { + $aItems = []; } - if (!is_array($aTagCodes)) { - throw new CoreUnexpectedValue("Wrong value {$aTagCodes} for {$this->sClass}:{$this->sAttCode}"); + if (!is_array($aItems)) { + throw new CoreUnexpectedValue("Wrong value {$aItems} for {$this->sClass}:{$this->sAttCode}"); } $oTags = []; $iCount = 0; $bError = false; - foreach ($aTagCodes as $sTagCode) { + foreach ($aItems as $sTagCode) { $iCount++; if (($this->iLimit != 0) && ($iCount > $this->iLimit)) { $bError = true; diff --git a/datamodels/2.x/itop-faq-light/module.itop-faq-light.php b/datamodels/2.x/itop-faq-light/module.itop-faq-light.php index a342b2e4e1..92173cb608 100755 --- a/datamodels/2.x/itop-faq-light/module.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/module.itop-faq-light.php @@ -21,6 +21,7 @@ SetupWebPage::AddModule( // Components // 'datamodel' => [ + 'model.itop-faq-light.php', ], 'data.struct' => [ //'data.struct.itop-knownerror-mgmt.xml', diff --git a/sources/Core/AttributeDefinition/AttributeSet.php b/sources/Core/AttributeDefinition/AttributeSet.php index f70e82d731..decc13659c 100644 --- a/sources/Core/AttributeDefinition/AttributeSet.php +++ b/sources/Core/AttributeDefinition/AttributeSet.php @@ -213,7 +213,7 @@ abstract class AttributeSet extends AttributeDBFieldVoid * force an allowed value (type conversion and possibly forces a value as mySQL would do upon writing! * * @param $proposedValue - * @param DBObject $oHostObj + * @param DBObject|null $oHostObj * * @param bool $bIgnoreErrors * diff --git a/sources/Core/AttributeDefinition/AttributeTagSet.php b/sources/Core/AttributeDefinition/AttributeTagSet.php index 1e4ed3c5f6..5bc46727d2 100644 --- a/sources/Core/AttributeDefinition/AttributeTagSet.php +++ b/sources/Core/AttributeDefinition/AttributeTagSet.php @@ -7,6 +7,8 @@ namespace Combodo\iTop\Core\AttributeDefinition; +use ApplicationContext; +use cmdbAbstractObject; use CoreException; use CoreUnexpectedValue; use CoreWarning; @@ -534,21 +536,21 @@ HTML; } /** - * @param $value + * @param $sValue * @param DBObject $oHostObject * @param bool $bLocalize * * @return string * */ - public function GetAsXML($value, $oHostObject = null, $bLocalize = true) + public function GetAsXML($sValue, $oHostObject = null, $bLocalize = true) { - if (is_object($value) && ($value instanceof ormTagSet)) { + if (is_object($sValue) && ($sValue instanceof ormTagSet)) { $sRes = "\n"; if ($bLocalize) { - $aValues = $value->GetLabels(); + $aValues = $sValue->GetLabels(); } else { - $aValues = $value->GetValues(); + $aValues = $sValue->GetValues(); } if (!empty($aValues)) { $sRes .= ''.implode('', $aValues).''; @@ -636,7 +638,7 @@ HTML; public function FromJSONToValue($json) { $oSet = new ormTagSet($this->GetHostClass(), $this->GetCode(), $this->GetMaxItems()); - $oSet->SetValues($json); + $oSet->SetValues(json_decode($json, true)); return $oSet; }