From: Joe Hunt Date: Wed, 9 Dec 2015 22:04:55 +0000 (+0100) Subject: Fixed a couple of bugs in stock list and account list search. X-Git-Tag: v2.4.2~19^2~103 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=acec14f639533b3e6b9b33c395ae5aeff29684f3;p=fa-stable.git Fixed a couple of bugs in stock list and account list search. --- diff --git a/gl/inquiry/accounts_list.php b/gl/inquiry/accounts_list.php index 9bccf881..eb8b0e2b 100644 --- a/gl/inquiry/accounts_list.php +++ b/gl/inquiry/accounts_list.php @@ -54,7 +54,6 @@ $sql = "SELECT chart.account_code, chart.account_name, type.name FROM ".TB_PREF."chart_master chart,".TB_PREF."chart_types type WHERE chart.account_type=type.id AND ( - chart.account_code LIKE " . db_escape("%" . get_post("description"). "%") . " OR chart.account_name LIKE " . db_escape("%" . get_post("description"). "%") . " OR chart.account_code LIKE " . db_escape("%" . get_post("description"). "%") . " ) diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 12ebceae..29afc214 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -299,7 +299,6 @@ $opts = array( // default options $link = ""; $id = $name; if ($SysPrefs->use_popup_windows) { - //_vd("type= $type"); switch (strtolower($type)) { case "stock": $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=all&client_id=" . $id; @@ -321,6 +320,11 @@ $opts = array( // default options $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=costable&client_id=" . $id; $img_title = _("Search items"); break; + case "component": + $parent = $opts['parent']; + $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=component&parent=".$parent."&client_id=" . $id; + $img_title = _("Search items"); + break; case "kits": $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=kits&client_id=" . $id; $img_title = _("Search items"); @@ -986,18 +990,19 @@ function stock_manufactured_items_list_row($label, $name, $selected_id=null, function stock_component_items_list($name, $parent_stock_id, $selected_id=null, $all_option=false, $submit_on_change=false, $editkey = false) { + $parent = db_escape($parent_stock_id); return stock_items_list($name, $selected_id, $all_option, $submit_on_change, - array('where'=>array("stock_id != ".db_escape($parent_stock_id))), $editkey); + array('where'=>array("stock_id != $parent"), 'parent'=> $parent_stock_id), $editkey, "component"); } + function stock_component_items_list_cells($label, $name, $parent_stock_id, $selected_id=null, $all_option=false, $submit_on_change=false, $editkey = false) { if ($label != null) echo "$label\n"; echo stock_items_list($name, $selected_id, $all_option, $submit_on_change, - array('where'=>array("stock_id != ".db_escape($parent_stock_id)), 'cells'=>true), - $editkey); + array('where'=>array("stock_id != $parent"), 'cells'=>true, 'parent'=> $parent_stock_id), $editkey, "component"); } //------------------------------------------------------------------------------------ diff --git a/inventory/inquiry/stock_list.php b/inventory/inquiry/stock_list.php index 1d1c5890..d087c41e 100644 --- a/inventory/inquiry/stock_list.php +++ b/inventory/inquiry/stock_list.php @@ -59,11 +59,8 @@ table_header($th); // Query based on function sales_items_list in includes/ui/ui_lists.inc. $sql = "SELECT COUNT(i.item_code) AS kit, i.item_code, i.description, c.description category - FROM - ".TB_PREF."stock_master s, - ".TB_PREF."item_codes i - LEFT JOIN - ".TB_PREF."stock_category c + FROM ".TB_PREF."stock_master s, ".TB_PREF."item_codes i + LEFT JOIN ".TB_PREF."stock_category c ON i.category_id=c.category_id WHERE i.stock_id=s.stock_id AND !i.inactive AND !s.inactive @@ -75,7 +72,7 @@ $type = ""; if (isset($_GET['type'])) { $type = $_GET['type']; } -//_vd("type = $type"); + switch ($type) { case "sales": $sql .= " AND !s.no_sale AND mb_flag != 'F'"; @@ -89,6 +86,9 @@ switch ($type) { case "costable": $sql .= " AND mb_flag != 'D' AND mb_flag != 'F' AND i.item_code=i.stock_id"; break; + case "component": + $sql .= " AND i.item_code=i.stock_id AND i.stock_id != ".$_GET['parent']." AND mb_flag != 'F' "; + break; case "assets": $sql .= " AND mb_flag = 'F'"; break; @@ -102,7 +102,7 @@ switch ($type) { } $sql .= " GROUP BY i.item_code ORDER BY i.description LIMIT 0, $limit"; // We only display 10 items. -//_vd($sql); + $result = db_query($sql, "Failed in retreiving item list."); $k = 0; //row colour counter