BUG 10920 "Add subtitles inside a drop-down" SOLVED

- New feature, add subtitles inside a drop-down
- Solved problem, added grouping elements in DropDowns
- If a DropDown has enabled optgroup, an example with SQL would be the following:
    (SELECT 'optgroup1' AS UID, 'Users' AS NAME)
    UNION
    (SELECT USR.USR_UID AS UID, USR.USR_USERNAME AS NAME
     FROM   USERS AS USR
     WHERE  USR.USR_USERNAME <> '' AND USR.USR_USERNAME LIKE 'u%'
    )
    UNION
    (SELECT 'optgroup2' AS UID, 'Countries' AS NAME)
    UNION
    (SELECT COUNTRY.IC_UID AS UID, COUNTRY.IC_NAME AS NAME
     FROM   ISO_COUNTRY AS COUNTRY
     WHERE  COUNTRY.IC_NAME LIKE 'b%'
    )
* Available from version ProcessMaker-2.0.47 (2.5.1)
This commit is contained in:
Victor Saisa Lopez
2013-03-27 09:57:22 -04:00
parent baca267dff
commit 3cd724a9ed
9 changed files with 531 additions and 309 deletions

View File

@@ -137,7 +137,17 @@ if (! (isset( $fields->Fields['XMLNODE_NAME'] ) && ($fields->Fields['XMLNODE_NAM
if (! is_array( $options ) || count( $options ) == 0) {
$options = array ('' => '' );
}
$Fields['PME_OPTIONS'] = array ('NAME' => array_keys( $options ),'LABEL' => array_values( $options ) );
$arrayOptionName = array_keys($options);
$arrayOptionLabel = array_values($options);
$arrayOptionOptGroup = array();
foreach ($arrayOptionName as $value) {
$arrayOptionOptGroup[] = (preg_match("/^optgroup\d+$/", $value))? 1 : 0;
}
$Fields["PME_OPTIONS"] = array("NAME" => $arrayOptionName, "LABEL" => $arrayOptionLabel, "OPTGROUP" => $arrayOptionOptGroup);
$type = strtolower( $fields->Fields['TYPE'] );
if ($type === 'checkbox') {
if ($Fields['PME_DEFAULTVALUE'] === $Fields['PME_VALUE']) {