N°4538 - Dashlet Groupby on ExternalKey with special character, bad display

This commit is contained in:
acognet
2022-04-15 10:03:04 +02:00
parent e691454339
commit 6fa2d47780
2 changed files with 21 additions and 14 deletions

View File

@@ -1223,7 +1223,7 @@ class DesignerComboField extends DesignerFormField
$sChecked = $this->defaultValue ? 'checked' : '';
$sMandatory = $this->bMandatory ? 'true' : 'false';
$sReadOnly = $this->IsReadOnly() ? 'disabled="disabled"' : '';
if ($this->IsSorted())
if ($this->IsSorted() && isset($this->aAllowedValues) )
{
asort($this->aAllowedValues);
}
@@ -1271,19 +1271,17 @@ class DesignerComboField extends DesignerFormField
$sHtml .= "<option value=\"\">".$this->sNullLabel."</option>";
}
}
foreach($this->aAllowedValues as $sKey => $sDisplayValue)
{
if ($this->bMultipleSelection)
{
$sSelected = in_array($sKey, $this->defaultValue) ? 'selected' : '';
if ( isset($this->aAllowedValues) ) {
foreach ($this->aAllowedValues as $sKey => $sDisplayValue) {
if ($this->bMultipleSelection) {
$sSelected = in_array($sKey, $this->defaultValue) ? 'selected' : '';
} else {
$sSelected = ($sKey == $this->defaultValue) ? 'selected' : '';
}
// Quick and dirty: display the menu parents as a tree
$sHtmlValue = str_replace(' ', '&nbsp;', $sDisplayValue);
$sHtml .= "<option value=\"".htmlentities($sKey, ENT_QUOTES, 'UTF-8')."\" $sSelected>$sHtmlValue</option>";
}
else
{
$sSelected = ($sKey == $this->defaultValue) ? 'selected' : '';
}
// Quick and dirty: display the menu parents as a tree
$sHtmlValue = str_replace(' ', '&nbsp;', htmlentities($sDisplayValue, ENT_QUOTES, 'UTF-8'));
$sHtml .= "<option value=\"".htmlentities($sKey, ENT_QUOTES, 'UTF-8')."\" $sSelected>$sHtmlValue</option>";
}
$sHtml .= "</select>";
if ($this->bOtherChoices)

View File

@@ -1368,7 +1368,16 @@ EOF
foreach($aUpdatedProperties as $sProp)
{
$sDecodedProp = str_replace('attr_', '', $sProp); // Remove the attr_ prefix
$aCurrentValues[$sDecodedProp] = (isset($aPreviousValues[$sProp]) ? $aPreviousValues[$sProp] : ''); // Set the previous value
// Set the previous value
if ( isset($aPreviousValues[$sProp]) && $aPreviousValues[$sProp] != '' ){
$aCurrentValues[$sDecodedProp] = $aPreviousValues[$sProp];
} else {
if(gettype($aCurrentValues[$sDecodedProp]) == "array") {
$aCurrentValues[$sDecodedProp] = [];
} else {
$aCurrentValues[$sDecodedProp] = '';
}
}
$aUpdatedDecoded[] = $sDecodedProp;
}