BUG 5934 "save labels for checkgroups.... solving problems"
This commit is contained in:
@@ -312,8 +312,14 @@ class Form extends XmlForm
|
|||||||
|
|
||||||
case 'checkgroup':
|
case 'checkgroup':
|
||||||
case 'listbox':
|
case 'listbox':
|
||||||
|
if ( is_array($newValues[$k]) ) {
|
||||||
$values[$k] = '';
|
$values[$k] = '';
|
||||||
foreach ($newValues[$k] as $i => $value) {
|
foreach ($newValues[$k] as $i => $value) {
|
||||||
|
//if $value is empty continue with the next loop, because this is a not selected/checked item
|
||||||
|
if (trim($value) == '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$values[$k] .= ($i != 0 ? '|': '') . $value;
|
$values[$k] .= ($i != 0 ? '|': '') . $value;
|
||||||
|
|
||||||
if (isset($v->options[$value])){
|
if (isset($v->options[$value])){
|
||||||
@@ -336,6 +342,10 @@ class Form extends XmlForm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$newValues[$k] = $values["{$k}_label"];
|
$newValues[$k] = $values["{$k}_label"];
|
||||||
|
} else {
|
||||||
|
$values[$k] = $newValues[$k];
|
||||||
|
$values["{$k}_label"] = $newValues["{$k}_label"];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'dropdown':
|
case 'dropdown':
|
||||||
|
|||||||
@@ -4177,7 +4177,7 @@ class XmlForm
|
|||||||
|
|
||||||
if (isset ( $xmlNode [$k]->attributes ['required'] )) {
|
if (isset ( $xmlNode [$k]->attributes ['required'] )) {
|
||||||
// the fields or xml nodes with a required attribute are put in an array that is passed to the view file
|
// the fields or xml nodes with a required attribute are put in an array that is passed to the view file
|
||||||
if ($xmlNode [$k]->attributes ['required'] == 1)
|
if ($xmlNode [$k]->attributes ['required'] == 1 && $xmlNode [$k]->attributes['mode'] != 'view' && $this->mode == 'edit')
|
||||||
$this->requiredFields [] = array ('name' => $field->name, 'type' => $xmlNode [$k]->attributes ['type'], 'label' => trim ( $field->label ) );
|
$this->requiredFields [] = array ('name' => $field->name, 'type' => $xmlNode [$k]->attributes ['type'], 'label' => trim ( $field->label ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user