N°985 - Add applicable contexts on Trigger (Fix regression)

This commit is contained in:
Eric
2020-01-28 12:18:05 +01:00
parent b31eb6aab9
commit 029fe6882d

View File

@@ -10090,7 +10090,7 @@ class AttributeEnumSet extends AttributeSet
return array_merge(parent::ListExpectedParams(), array('possible_values', 'is_null_allowed', 'max_items')); return array_merge(parent::ListExpectedParams(), array('possible_values', 'is_null_allowed', 'max_items'));
} }
private function GetRawValues($aArgs = array(), $sContains = '') private function GetRawPossibleValues($aArgs = array(), $sContains = '')
{ {
$oValSetDef = $this->Get('possible_values'); $oValSetDef = $this->Get('possible_values');
if (!$oValSetDef) if (!$oValSetDef)
@@ -10103,7 +10103,7 @@ class AttributeEnumSet extends AttributeSet
public function GetPossibleValues($aArgs = array(), $sContains = '') public function GetPossibleValues($aArgs = array(), $sContains = '')
{ {
$aRawValues = $this->GetRawValues($aArgs, $sContains); $aRawValues = $this->GetRawPossibleValues($aArgs, $sContains);
$aLocalizedValues = array(); $aLocalizedValues = array();
foreach($aRawValues as $sKey => $sValue) foreach($aRawValues as $sKey => $sValue)
{ {
@@ -10115,7 +10115,7 @@ class AttributeEnumSet extends AttributeSet
public function GetValueLabel($sValue) public function GetValueLabel($sValue)
{ {
$aValues = $this->GetRawValues(); $aValues = $this->GetRawPossibleValues();
if (isset($aValues[$sValue])) if (isset($aValues[$sValue]))
{ {
$sValue = $aValues[$sValue]; $sValue = $aValues[$sValue];
@@ -10170,14 +10170,14 @@ class AttributeEnumSet extends AttributeSet
return $sDescription; return $sDescription;
} }
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) public function GetAsHTML($value, $oHostObject = null, $bLocalize = true)
{ {
if ($bLocalize) if ($bLocalize)
{ {
if ($sValue instanceof ormSet) if ($value instanceof ormSet)
{ {
/** @var ormSet $oOrmSet */ /** @var ormSet $oOrmSet */
$oOrmSet = $sValue; $oOrmSet = $value;
$aRes = array(); $aRes = array();
foreach ($oOrmSet->GetValues() as $sValue) foreach ($oOrmSet->GetValues() as $sValue)
{ {
@@ -10189,14 +10189,14 @@ class AttributeEnumSet extends AttributeSet
} }
else else
{ {
$sLabel = $this->GetValueLabel($sValue); $sLabel = $this->GetValueLabel($value);
$sDescription = $this->GetValueDescription($sValue); $sDescription = $this->GetValueDescription($value);
$sRes = "<span title=\"$sDescription\">".parent::GetAsHtml($sLabel)."</span>"; $sRes = "<span title=\"$sDescription\">".parent::GetAsHtml($sLabel)."</span>";
} }
} }
else else
{ {
$sRes = parent::GetAsHtml($sValue, $oHostObject, $bLocalize); $sRes = parent::GetAsHtml($value, $oHostObject, $bLocalize);
} }
return $sRes; return $sRes;
@@ -10204,36 +10204,6 @@ class AttributeEnumSet extends AttributeSet
} }
class AttributeContextSet extends AttributeEnumSet
{
public function GetPossibleValues($aArgs = array(), $sContains = '')
{
$oValSetDef = $this->Get('possible_values');
if (!$oValSetDef)
{
return null;
}
return $oValSetDef->GetValues($aArgs, $sContains);
}
public function GetValueLabel($sValue)
{
$aValues = $this->GetPossibleValues();
if (in_array($sValue, $aValues))
{
return $aValues[$sValue];
}
return Dict::S('Enum:Undefined');
}
public function GetValueDescription($sValue)
{
return '';
}
}
class AttributeClassAttCodeSet extends AttributeSet class AttributeClassAttCodeSet extends AttributeSet
{ {
@@ -10393,8 +10363,9 @@ class AttributeClassAttCodeSet extends AttributeSet
if (is_null($aJsonFromWidget)) if (is_null($aJsonFromWidget))
{ {
$proposedValue = trim($proposedValue); $proposedValue = trim($proposedValue);
$aProposedValues = $this->FromStringToArray($proposedValue);
$aValues = array(); $aValues = array();
foreach(explode(',', $proposedValue) as $sValue) foreach($aProposedValues as $sValue)
{ {
$sAttCode = trim($sValue); $sAttCode = trim($sValue);
if (empty($aAllowedAttributes) || isset($aAllowedAttributes[$sAttCode])) if (empty($aAllowedAttributes) || isset($aAllowedAttributes[$sAttCode]))
@@ -10601,8 +10572,9 @@ class AttributeQueryAttCodeSet extends AttributeSet
if (is_string($proposedValue) && !empty($proposedValue)) if (is_string($proposedValue) && !empty($proposedValue))
{ {
$proposedValue = trim($proposedValue); $proposedValue = trim($proposedValue);
$aProposedValues = $this->FromStringToArray($proposedValue);
$aValues = array(); $aValues = array();
foreach(explode(',', $proposedValue) as $sValue) foreach($aProposedValues as $sValue)
{ {
$sAttCode = trim($sValue); $sAttCode = trim($sValue);
if (empty($aAllowedAttributes) || isset($aAllowedAttributes[$sAttCode])) if (empty($aAllowedAttributes) || isset($aAllowedAttributes[$sAttCode]))