mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 06:18:44 +02:00
N°9525 - TagSet Errors
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -21,6 +21,7 @@ SetupWebPage::AddModule(
|
||||
// Components
|
||||
//
|
||||
'datamodel' => [
|
||||
'model.itop-faq-light.php',
|
||||
],
|
||||
'data.struct' => [
|
||||
//'data.struct.itop-knownerror-mgmt.xml',
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user