From a96e9d18d632cc730a2b4f44d0774a73246915c5 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Tue, 13 May 2008 22:48:25 +0000 Subject: [PATCH] When no_item_list or no_customer_list or no_supplier_list was checked in company setup the listboxes were filled with all the records when there were no search values. --- CHANGELOG.txt | 5 +++++ includes/ui/ui_lists.inc | 36 +++++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 536d3a30..258a2dec 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,11 @@ Legend: ! -> Note $ -> Affected files +14-May-2008 Joe Hunt +# When no_item_list or no_customer_list or no_supplier_list was checked in company setup the listboxes were filled with all + the records when there were no search values. +$ /includes/ui/ui_lists.inc + 09-May-2008 Joe Hunt ! Due to differences in Javascript the script update_db.php had to be changed. ! New fields, base_sales in 0_company and factor in 0_sales_types affects the default chart of accounts. diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 80ff7269..fe373e8d 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -43,15 +43,17 @@ function supplier_list($name, $selected_id, $all_option=false, $submit_on_change } elseif ($val != "" && $val != DEFVAL) { - $supplier_sql .= "WHERE supp_name LIKE '%{$val}%'"; + $supplier_sql .= "WHERE supp_name LIKE '%{$val}%' ORDER BY supp_name"; } + else + $supplier_sql .= "ORDER BT supp_name LIMIT 1"; echo " "; echo sprintf($search_button, $edit_button); } - $supplier_result = db_query($supplier_sql." ORDER BY supp_name"); + $supplier_result = db_query($supplier_sql); if ($submit_on_change==true) echo " "; echo sprintf($search_button, $edit_button); } - - $customer_result = db_query($customer_sql." ORDER BY name"); + $customer_result = db_query($customer_sql); if ($submit_on_change==true) echo " "; echo sprintf($search_button, $edit_button); @@ -894,6 +898,7 @@ function stock_purchasable_items_list($name, &$selected_id, $all_option=false, $ AND mb_flag !='M' "; if (get_company_pref('no_item_list')) { + global $search_button; $edit_name = $name."_edit"; $edit_button = $name."_button"; @@ -915,10 +920,11 @@ function stock_purchasable_items_list($name, &$selected_id, $all_option=false, $ (stock_id LIKE '%{$val}%' OR ".TB_PREF."stock_category.description LIKE '%{$val}%' OR " .TB_PREF."stock_master.description LIKE '%{$val}%')"; } + else + $sql .= "LIMIT 1"; + echo " "; - echo " "; - - echo " "; + echo sprintf($search_button, $edit_button); } $result = db_query($sql); @@ -1279,7 +1285,7 @@ function credit_status_list_row($label, $name, $selected_id) function sales_types_list($name, $selected_id, $submit_on_change=false, $special_option=null) { simple_codeandname_list("SELECT id, sales_type FROM ".TB_PREF."sales_types", - $name, $selected_id, + $name, $selected_id, isset($special_option), $special_option, true, $submit_on_change); } -- 2.30.2