N°9525 - TagSet Errors

This commit is contained in:
Eric Espie
2026-04-20 17:42:35 +02:00
parent 848d869954
commit 900bd6956a
4 changed files with 17 additions and 14 deletions

View File

@@ -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
*

View File

@@ -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 = "<Set>\n";
if ($bLocalize) {
$aValues = $value->GetLabels();
$aValues = $sValue->GetLabels();
} else {
$aValues = $value->GetValues();
$aValues = $sValue->GetValues();
}
if (!empty($aValues)) {
$sRes .= '<Tag>'.implode('</Tag><Tag>', $aValues).'</Tag>';
@@ -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;
}