X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_lists.inc;h=0ddf0c34f6dad80ce61af1721c539cf6cfe73697;hb=21ba0553185531c12f16efef9010033d5dd62cdc;hp=6d24ed627e03096acf073a98241a1a5d1c217ba8;hpb=94bf640ca2382815f0fd54ee54adc823a9675123;p=fa-stable.git diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 6d24ed62..0ddf0c34 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -89,21 +89,20 @@ $opts = array( // default options $opts['sel_hint'] = $by_id || $search_box==false ? '' : _('Press Space tab for search pattern entry'); - if ($opts['box_hint'] === null) // dodaƦ hint dla pustego **** + if ($opts['box_hint'] === null) $opts['box_hint'] = $search_box && $search_submit != false ? ($by_id ? _('Enter code fragment to search or * for all') : _('Enter description fragment to search or * for all')) :''; if ($selected_id == null) { - $selected_id = get_post($name, $opts['default']); + $selected_id = get_post($name, (string)$opts['default']); } if(!is_array($selected_id)) - $selected_id = array($selected_id); // code is generalized for multiple selection support + $selected_id = array((string)$selected_id); // code is generalized for multiple selection support $txt = get_post($search_box); $rel = ''; $limit = ''; - if (isset($_POST['_'.$name.'_update'])) { // select list or search box change if ($by_id) $txt = $_POST[$name]; @@ -145,6 +144,7 @@ $opts = array( // default options } } } + // sql completion if (count($opts['where'])) { $where = strpos($sql, 'WHERE')==false ? ' WHERE ':' AND '; @@ -181,7 +181,8 @@ $opts = array( // default options if (get_post($search_button) && ($txt == $value)) { $selected_id[] = $value; } - if (in_array($value, $selected_id)) { + + if (in_array((string)$value, $selected_id, true)) { $sel = 'selected'; $found = $value; $edit = $opts['editable'] && $contact_row['editable'] @@ -327,7 +328,7 @@ $opts = array( // default options $selected_id = get_post($name, $opts['default']); } if(!is_array($selected_id)) - $selected_id = array($selected_id); // code is generalized for multiple selection support + $selected_id = array((string)$selected_id); // code is generalized for multiple selection support if (isset($_POST[ '_'.$name.'_update'])) { if (!$opts['async']) @@ -343,17 +344,15 @@ $opts = array( // default options //if($name=='SelectStockFromList') display_error($sql); foreach($items as $value=>$descr) { $sel = ''; - if (in_array((string)$value, $selected_id)) { - $sel = "selected='selected'"; + if (in_array((string)$value, $selected_id, true)) { + $sel = 'selected'; $found = $value; } if ($first_id === false) { $first_id = $value; - $first_opt = "\n"; - } - else { - $selector .= "\n"; + $first_opt = $descr; } + $selector .= "\n"; } if ($first_id!==false) { @@ -364,7 +363,7 @@ $opts = array( // default options if ($spec_option !== false) { // if special option used - add it $first_id = $spec_id; $first_opt = $spec_option; - $sel = $found===false ? "selected='selected'" : ''; + $sel = $found===false ? 'selected' : ''; $selector = "\n" . $selector; } @@ -373,6 +372,7 @@ $opts = array( // default options $selected_id = array($first_id); } $_POST[$name] = $multi ? $selected_id : $selected_id[0]; + $selector = "