X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_lists.inc;h=2034446a1126764625eea53b1c179cf319266eb7;hb=013ea39b39e3804a662db8e84761999281ce0230;hp=687c035eedccf87261123b83182df277975f90f9;hpb=ccc6ec0bcb632b559ee068effa0b61f5b1b6276f;p=fa-stable.git diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 687c035e..2034446a 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -1,313 +1,371 @@ "; -//$search_button = " "; +$_search_button = " "; -$all_items = reserved_words::get_all(); - -// TDB for all list functions : if there is no data, display a link to the releveant -// page to add an item, eg. for locations, if no locations, link to Add Location - -function supplier_list($name, $selected_id, $all_option=false, $submit_on_change=false) -{ - global $all_items; - - if ($selected_id == null) - $selected_id = ((!isset($_POST[$name]) || $_POST[$name] == "") ? "" : $_POST[$name]); - $no_supplier_list = get_company_pref('no_supplier_list'); - if ($no_supplier_list) - { - global $search_button; - $edit_name = $name."_edit"; - $edit_button = $name."_button"; +$_select_button = " "; - $val = (isset($_POST[$edit_name]) && $_POST[$edit_name] != "" ? $_POST[$edit_name] : ""); - if (isset($_POST[$edit_button])) - { - $selected_id = $_POST[$name] = ""; - } +$all_items = reserved_words::get_all(); - if ($selected_id != "") - { - $val = DEFVAL; - $supplier_sql = "SELECT supplier_id, supp_name, curr_code FROM ".TB_PREF."suppliers WHERE supplier_id=$selected_id"; - $supplier_result = db_query($supplier_sql); - } +//---------------------------------------------------------------------------- +// Universal combo generator +// $sql must return selector values and selector texts in columns 0 & 1 +// Options are merged with defaults. + +function combo_input($name, $selected_id, $sql, $valfield, $namefield, + $options=null) +{ + global $Ajax; + + $opts = array( // default options + 'where'=> array(), // additional constraints + 'order' => $namefield, // list sort order + // special option parameters + 'spec_option'=>false, // option text or false + 'spec_id' => 0, // option id + // submit on select parameters + 'select_submit' => false, //submit on select: true/false + 'async' => true, // select update via ajax (true) vs _page_body reload + // search box parameters + 'sel_hint' => null, + 'search_box' => false, // name or true/false + 'type' => 0, // type of extended selector: + // 0 - with (optional) visible search box, search by id + // 1 - with hidden search box, search by option text + // 2 - TODO reverse: box with hidden selector available via enter; this + // would be convenient for optional ad hoc adding of new item + 'search_submit' => true, //search submit button: true/false + 'size' => 8, // size and max of box tag + 'max' => 50, + 'cells' => false, // combo displayed as 2