BUG 12395 History log no refleja verdaderos datos historicos SOLVED
- El engine de formularios no mostraba ningun valor para valores previamente almacenados que ya no tengan esa opcion en el control - Para el modo VISTA de los campos de tipo DROPDOWN, LISTBOX, RADIOGROUP y CHECKGROUP ahora se muestran los valores que se guardaron previamente, aunque el valor ya no exista en la definicion del control, ya sea que sus opciones sean agregadas manualmente o bien sean obtenidas por un SQL
This commit is contained in:
@@ -3643,7 +3643,11 @@ class XmlForm_Field_Dropdown extends XmlForm_Field
|
|||||||
$html .= $this->renderHint();
|
$html .= $this->renderHint();
|
||||||
}
|
}
|
||||||
if ($displayStyle != '') {
|
if ($displayStyle != '') {
|
||||||
$html = $displayLabel . $html;
|
if ($value === $findValue) {
|
||||||
|
$html = $displayLabel . $html;
|
||||||
|
} else {
|
||||||
|
$html = $value . $html;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
@@ -3691,12 +3695,6 @@ class XmlForm_Field_Listbox extends XmlForm_Field
|
|||||||
public $sql = '';
|
public $sql = '';
|
||||||
public $sqlOption = array ();
|
public $sqlOption = array ();
|
||||||
|
|
||||||
public function validateValue ($value, $owner)
|
|
||||||
{
|
|
||||||
$this->executeSQL( $owner );
|
|
||||||
return true; // isset($value) && ( array_key_exists( $value , $this->options ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function render
|
* Function render
|
||||||
*
|
*
|
||||||
@@ -3741,13 +3739,26 @@ class XmlForm_Field_Listbox extends XmlForm_Field
|
|||||||
$html .= $this->renderHint();
|
$html .= $this->renderHint();
|
||||||
return $html;
|
return $html;
|
||||||
} elseif ($this->mode === 'view') {
|
} elseif ($this->mode === 'view') {
|
||||||
|
$valuesFound = array();
|
||||||
$html = '<select multiple="multiple" id="form[' . $this->name . ']" ' . $this->NSFieldType() . ' name="form[' . $this->name . '][]" size="' . $this->size . '" ' . $this->NSFieldType() . ' style="background: none;" disabled="disabled">';
|
$html = '<select multiple="multiple" id="form[' . $this->name . ']" ' . $this->NSFieldType() . ' name="form[' . $this->name . '][]" size="' . $this->size . '" ' . $this->NSFieldType() . ' style="background: none;" disabled="disabled">';
|
||||||
foreach ($this->option as $optionName => $option) {
|
foreach ($this->option as $optionName => $option) {
|
||||||
|
if (in_array( $optionName . "", $value )) {
|
||||||
|
$valuesFound[] = $optionName . "";
|
||||||
|
}
|
||||||
$html .= "<option value=\"" . $optionName . "\" " . ((in_array( $optionName . "", $value )) ? "class=\"module_ListBoxView\" selected=\"selected\"" : "") . ">" . $option . "</option>";
|
$html .= "<option value=\"" . $optionName . "\" " . ((in_array( $optionName . "", $value )) ? "class=\"module_ListBoxView\" selected=\"selected\"" : "") . ">" . $option . "</option>";
|
||||||
}
|
}
|
||||||
foreach ($this->sqlOption as $optionName => $option) {
|
foreach ($this->sqlOption as $optionName => $option) {
|
||||||
|
if (in_array( $optionName . "", $value )) {
|
||||||
|
$valuesFound[] = $optionName . "";
|
||||||
|
}
|
||||||
$html .= "<option value=\"" . $optionName . "\" " . ((in_array( $optionName . "", $value )) ? "class=\"module_ListBoxView\" selected=\"selected\"" : "") . ">" . $option . "</option>";
|
$html .= "<option value=\"" . $optionName . "\" " . ((in_array( $optionName . "", $value )) ? "class=\"module_ListBoxView\" selected=\"selected\"" : "") . ">" . $option . "</option>";
|
||||||
}
|
}
|
||||||
|
if (count($valuesFound) < count($value)) {
|
||||||
|
$valuesNotFound = array_diff($value, $valuesFound);
|
||||||
|
foreach ($valuesNotFound as $option) {
|
||||||
|
$html .= "<option value=\"" . $option . "\" class=\"module_ListBoxView\" selected=\"selected\">" . $option . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
$html .= '</select>';
|
$html .= '</select>';
|
||||||
foreach ($this->option as $optionName => $option) {
|
foreach ($this->option as $optionName => $option) {
|
||||||
$html .= "<input type=\"hidden\" id=\"form[" . $this->name . "]\" name=\"form[" . $this->name . "][]\" value=\"" . ((in_array( $optionName . "", $value )) ? $optionName : "__NULL__") . "\">";
|
$html .= "<input type=\"hidden\" id=\"form[" . $this->name . "]\" name=\"form[" . $this->name . "][]\" value=\"" . ((in_array( $optionName . "", $value )) ? $optionName : "__NULL__") . "\">";
|
||||||
@@ -3755,6 +3766,12 @@ class XmlForm_Field_Listbox extends XmlForm_Field
|
|||||||
foreach ($this->sqlOption as $optionName => $option) {
|
foreach ($this->sqlOption as $optionName => $option) {
|
||||||
$html .= "<input type=\"hidden\" id=\"form[" . $this->name . "]\" name=\"form[" . $this->name . "][]\" value=\"" . ((in_array( $optionName . "", $value )) ? $optionName : "__NULL__") . "\">";
|
$html .= "<input type=\"hidden\" id=\"form[" . $this->name . "]\" name=\"form[" . $this->name . "][]\" value=\"" . ((in_array( $optionName . "", $value )) ? $optionName : "__NULL__") . "\">";
|
||||||
}
|
}
|
||||||
|
if (count($valuesFound) < count($value)) {
|
||||||
|
$valuesNotFound = array_diff($value, $valuesFound);
|
||||||
|
foreach ($valuesNotFound as $option) {
|
||||||
|
$html .= "<input type=\"hidden\" id=\"form[" . $this->name . "]\" name=\"form[" . $this->name . "][]\" value=\"" . $option . "\">";
|
||||||
|
}
|
||||||
|
}
|
||||||
return $html;
|
return $html;
|
||||||
} else {
|
} else {
|
||||||
return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' );
|
return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' );
|
||||||
@@ -3792,19 +3809,6 @@ class XmlForm_Field_RadioGroup extends XmlForm_Field
|
|||||||
public $viewAlign = 'vertical';
|
public $viewAlign = 'vertical';
|
||||||
public $linkType;
|
public $linkType;
|
||||||
|
|
||||||
/**
|
|
||||||
* validate the execution of a query
|
|
||||||
*
|
|
||||||
* @param $value
|
|
||||||
* @param $owner
|
|
||||||
* @return $value
|
|
||||||
*/
|
|
||||||
public function validateValue ($value, $owner)
|
|
||||||
{
|
|
||||||
$this->executeSQL( $owner );
|
|
||||||
return isset( $value ) && (array_key_exists( $value, $this->options ));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function render
|
* Function render
|
||||||
*
|
*
|
||||||
@@ -3842,12 +3846,18 @@ class XmlForm_Field_RadioGroup extends XmlForm_Field
|
|||||||
return $html;
|
return $html;
|
||||||
} elseif ($this->mode === 'view') {
|
} elseif ($this->mode === 'view') {
|
||||||
$html = '';
|
$html = '';
|
||||||
|
$existsValue = false;
|
||||||
foreach ($this->options as $optionName => $option) {
|
foreach ($this->options as $optionName => $option) {
|
||||||
$html .= '<input class="module_app_input___gray" id="form[' . $this->name . '][' . $optionName . ']" ' . $this->NSFieldType() . ' name="form[' . $this->name . ']" type=\'radio\' value="' . $optionName . '" ' . (($optionName == $value) ? 'checked' : '') . ' disabled><span class="FormCheck"><label for="form[' . $this->name . '][' . $optionName . ']">' . $option . '</label></span></input><br>';
|
$html .= '<input class="module_app_input___gray" id="form[' . $this->name . '][' . $optionName . ']" ' . $this->NSFieldType() . ' name="form[' . $this->name . ']" type=\'radio\' value="' . $optionName . '" ' . (($optionName == $value) ? 'checked' : '') . ' disabled><span class="FormCheck"><label for="form[' . $this->name . '][' . $optionName . ']">' . $option . '</label></span></input><br>';
|
||||||
if ($optionName == $value) {
|
if ($optionName == $value) {
|
||||||
|
$existsValue = true;
|
||||||
$html .= '<input type="hidden" id="form[' . $this->name . '][' . $optionName . ']" name="form[' . $this->name . ']" value="' . (($optionName == $value) ? $optionName : '') . '">';
|
$html .= '<input type="hidden" id="form[' . $this->name . '][' . $optionName . ']" name="form[' . $this->name . ']" value="' . (($optionName == $value) ? $optionName : '') . '">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$existsValue && $value !== '') {
|
||||||
|
$html .= '<input class="module_app_input___gray" id="form[' . $this->name . '][' . $value . ']" ' . $this->NSFieldType() . ' name="form[' . $this->name . ']" type=\'radio\' value="' . $value . '" checked disabled><span class="FormCheck"><label for="form[' . $this->name . '][' . $value . ']">' . $value . '</label></span></input><br>';
|
||||||
|
$html .= '<input type="hidden" id="form[' . $this->name . '][' . $value . ']" name="form[' . $this->name . ']" value="' . $value . '">';
|
||||||
|
}
|
||||||
return $html;
|
return $html;
|
||||||
} else {
|
} else {
|
||||||
return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' );
|
return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' );
|
||||||
@@ -3949,11 +3959,22 @@ class XmlForm_Field_CheckGroup extends XmlForm_Field
|
|||||||
} //fin for
|
} //fin for
|
||||||
return $html;
|
return $html;
|
||||||
} elseif ($this->mode === 'view') {
|
} elseif ($this->mode === 'view') {
|
||||||
|
$valuesFound = array();
|
||||||
$html = '';
|
$html = '';
|
||||||
foreach ($this->options as $optionName => $option) {
|
foreach ($this->options as $optionName => $option) {
|
||||||
|
if (in_array( $optionName . "", $value )) {
|
||||||
|
$valuesFound[] = $optionName . "";
|
||||||
|
}
|
||||||
$html .= "<input " . $this->NSFieldType() . "class=\"FormCheck\" type=\"checkbox\" id=\"form[" . $this->name . "][" . $optionName . "]\" value=\"" . $optionName . "\"" . (in_array( $optionName . "", $value ) ? " checked=\"checked\" " : "") . " disabled=\"disabled\"><span class=\"FormCheck\"><label for=\"form[" . $this->name . "][" . $optionName . "]\">" . $option . "</label></span></input><br />";
|
$html .= "<input " . $this->NSFieldType() . "class=\"FormCheck\" type=\"checkbox\" id=\"form[" . $this->name . "][" . $optionName . "]\" value=\"" . $optionName . "\"" . (in_array( $optionName . "", $value ) ? " checked=\"checked\" " : "") . " disabled=\"disabled\"><span class=\"FormCheck\"><label for=\"form[" . $this->name . "][" . $optionName . "]\">" . $option . "</label></span></input><br />";
|
||||||
$html .= "<input type=\"hidden\" name=\"form[" . $this->name . "][]\" value=\"" . ((in_array( $optionName . "", $value )) ? $optionName : "__NULL__") . "\">";
|
$html .= "<input type=\"hidden\" name=\"form[" . $this->name . "][]\" value=\"" . ((in_array( $optionName . "", $value )) ? $optionName : "__NULL__") . "\">";
|
||||||
}
|
}
|
||||||
|
if (count($valuesFound) < count($value)) {
|
||||||
|
$valuesNotFound = array_diff($value, $valuesFound);
|
||||||
|
foreach ($valuesNotFound as $option) {
|
||||||
|
$html .= "<input " . $this->NSFieldType() . "class=\"FormCheck\" type=\"checkbox\" id=\"form[" . $this->name . "][" . $option . "]\" value=\"" . $option . "\" checked=\"checked\" disabled=\"disabled\"><span class=\"FormCheck\"><label for=\"form[" . $this->name . "][" . $option . "]\">" . $option . "</label></span></input><br />";
|
||||||
|
$html .= "<input type=\"hidden\" name=\"form[" . $this->name . "][]\" value=\"" . $option . "\">";
|
||||||
|
}
|
||||||
|
}
|
||||||
return $html;
|
return $html;
|
||||||
} else {
|
} else {
|
||||||
return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' );
|
return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' );
|
||||||
|
|||||||
Reference in New Issue
Block a user