X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_lists.inc;h=1176cc5f8d538dff76d8e7a721a21c729c6080af;hb=2a839495da2c19e1fad93019cae5a49e37687964;hp=d0dd4776b162993e2aa89ee140c627e05ac57fcd;hpb=0ddbffd3121056b6cf10dbd715d72d10fffdf253;p=fa-stable.git diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index d0dd4776..1176cc5f 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -81,6 +81,9 @@ $opts = array( // default options $limit = ''; if (isset($_POST[$select_submit])) { + + if ($by_id) $txt = $_POST[$name]; + if (!$opts['async']) $Ajax->activate('_page_body'); else @@ -91,15 +94,17 @@ $opts = array( // default options $rel = "rel='$search_box'"; // set relation to list if ($opts['search_submit']) { - // if selected from list - set focus on next field if (isset($_POST[$search_submit])) { - $Ajax->activate($name); + if (!$opts['async']) + $Ajax->activate('_page_body'); + else + $Ajax->activate($name); } if ($txt == '') { - if ($spec_option === false) - $limit = ' LIMIT 1'; + if ($spec_option === false && $selected_id==null) + $limit = ' LIMIT 1'; else - $opts['where'][] = $valfield . "='". get_post($name, $spec_id)."'"; + $opts['where'][] = $valfield . "='". get_post($name, $spec_id)."'"; } else if ($txt != '*') { @@ -124,14 +129,14 @@ $opts = array( // default options $selector = $first_opt = ''; $first_id = false; $found = false; -//if($name=='code_id') display_error($sql); +//if($name=='SelectStockFromList') display_error($sql); if($result = db_query($sql)) { while ($contact_row = db_fetch($result)) { $value = $contact_row[0]; $descr = $opts['format']==null ? $contact_row[1] : call_user_func($opts['format'], $contact_row); $sel = ''; - if ($selected_id === $value) { + if ((string)($selected_id) === $value) { $sel = 'selected'; $found = $value; } @@ -351,8 +356,7 @@ return combo_input($name, $selected_id, $sql, 'loc_code', 'location_name', array( 'spec_option' => $all_option === true ? _("All Locations") : $all_option, 'spec_id' => $all_items, - 'select_submit'=> $submit_on_change, - 'async' => false + 'select_submit'=> $submit_on_change ) ); } @@ -696,7 +700,8 @@ function stock_item_types_list_row($label, $name, $selected_id, $enabled=true) echo "$label\n"; echo ""; if ($enabled) - $sel = "\n"; + else $sel = ""; // FIX ajax + echo " onchange='JsHttpRequest.request(\"_{$name}_update\", this.form);'>"; else echo ">"; echo "\n"; @@ -1815,47 +1812,55 @@ function credit_type_list_row($label, $name, $selected, $submit_on_change=false) return $str; } -function number_list($name, $selected, $from, $to, $firstlabel="") +function number_list($name, $selected, $from, $to, $no_option=false) { default_focus($name); if ($selected == null) { - $selected = (!isset($_POST[$name]) ? $from : $_POST[$name]); - if ($selected == $from) - $_POST[$name] = $selected; + $selected = (!isset($_POST[$name]) ? reserved_words::get_all_numeric() : $_POST[$name]); } echo "\n"; } -function number_list_cells($label, $name, $selected, $from, $to) +function number_list_cells($label, $name, $selected, $from, $to, $no_option=false) { if ($label != null) label_cell($label); echo "\n"; - number_list($name, $selected, $from, $to); + number_list($name, $selected, $from, $to, $no_option); echo "\n"; } -function number_list_row($label, $name, $selected, $from, $to) +function number_list_row($label, $name, $selected, $from, $to, $no_option=false) { echo "\n"; - number_list_cells($label, $name, $selected, $from, $to); + number_list_cells($label, $name, $selected, $from, $to, $no_option); echo "\n"; } ?> \ No newline at end of file