Removed fixed assets from list item search and popup search.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 10 Dec 2015 21:21:42 +0000 (22:21 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 10 Dec 2015 21:21:42 +0000 (22:21 +0100)
includes/ui/ui_lists.inc
inventory/inquiry/stock_list.php

index 29afc214baa777b2c056c385aef3306b5bb24cce..9cb41a4863e43bfd0f51e9c04986cde894ea0502 100644 (file)
@@ -292,11 +292,11 @@ $opts = array(            // default options
        }
        default_focus(($search_box && $by_id) ? $search_box : $name);
 
-       if ($SysPrefs->use_popup_search)
+       $img = "";
+       if ($SysPrefs->use_popup_search && !isset($opts['fixed_asset']))
        {
-               $img = "";
-               $img_title = "";
-               $link = "";
+               $img_title = "";
+               $link = "";
                $id = $name;
                if ($SysPrefs->use_popup_windows) {
                switch (strtolower($type)) {
@@ -329,10 +329,6 @@ $opts = array(             // default options
                                $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=kits&client_id=" . $id;
                                $img_title = _("Search items");
                                break;
-                       case "assets":
-                               $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=assets&client_id=" . $id;
-                               $img_title = _("Search items");
-                               break;
                        case "customer":
                                $link = $path_to_root . "/sales/inquiry/customers_list.php?popup=1&client_id=" . $id;
                                $img_title = _("Search customers");
@@ -363,20 +359,10 @@ $opts = array(            // default options
        if ($opts['editlink'])
                $selector .= ' '.$opts['editlink'];
 
-       if ($SysPrefs->use_popup_search)
-       {
-               if ($search_box && $opts['cells'])
-                       $str = ($edit_entry!='' ? "<td>$edit_entry</td>" : '')."<td>$selector$img</td>";
-               else
-                       $str = $edit_entry.$selector.$img;
-       }
+       if ($search_box && $opts['cells'])
+               $str = ($edit_entry!='' ? "<td>$edit_entry</td>" : '')."<td>$selector$img</td>";
        else
-       {
-               if ($search_box && $opts['cells'])
-                       $str = ($edit_entry!='' ? "<td>$edit_entry</td>" : '')."<td>$selector</td>";
-               else
-                       $str = $edit_entry.$selector;
-       }               
+               $str = $edit_entry.$selector.$img;
        return $str;
 }
 
@@ -828,8 +814,6 @@ function stock_items_list($name, $selected_id=null, $all_option=false,
        if ($editkey)
                set_editor('item', $name, $editkey);
 
-       if (isset($opts['fixed_asset']) && $opts['fixed_asset'])
-               $type = 'assets';
        $ret = combo_input($name, $selected_id, $sql, 'stock_id', 's.description',
                array_merge(
                  array(
@@ -838,7 +822,7 @@ function stock_items_list($name, $selected_id=null, $all_option=false,
                        'spec_id' => ALL_TEXT,
                        'search_box' => true,
                        'search' => array("stock_id", "c.description","s.description"),
-                       'search_submit' => get_company_pref('no_item_list')!=0,
+                       'search_submit' => get_company_pref('no_item_list')!=0 && !isset($opts['fixed_asset']),
                        'size'=>10,
                        'select_submit'=> $submit_on_change,
                        'category' => 2,
index c0db0f695cb877d4d95ed8d3436fad8a43ebfd5b..d33ab81a65b89ef50795c2a8148d84f502668cc7 100644 (file)
@@ -75,29 +75,26 @@ if (isset($_GET['type'])) {
 
 switch ($type) {
   case "sales":
-    $sql .= " AND !s.no_sale AND mb_flag != 'F'";
+    $sql .= " AND !s.no_sale AND mb_flag <> 'F'";
     break;
   case "manufactured":
     $sql .= " AND mb_flag = 'M'";
     break;
   case "purchasable":
-    $sql .= " AND NOT no_purchase AND mb_flag != 'F' AND i.item_code=i.stock_id";
+    $sql .= " AND NOT no_purchase AND mb_flag <> 'F' AND i.item_code=i.stock_id";
     break;
   case "costable":
-    $sql .= " AND mb_flag != 'D' AND mb_flag != 'F' AND  i.item_code=i.stock_id";
+    $sql .= " AND mb_flag <> 'D' AND mb_flag <> 'F' AND  i.item_code=i.stock_id";
     break;
   case "component":
        $parent = $_GET['parent'];
-    $sql .= " AND  i.item_code=i.stock_id AND i.stock_id <> '$parent' AND mb_flag != 'F' ";
-    break;
-  case "assets":
-    $sql .= " AND mb_flag = 'F'";
+    $sql .= " AND  i.item_code=i.stock_id AND i.stock_id <> '$parent' AND mb_flag <> 'F' ";
     break;
   case "kits":
-       $sql .= " AND !i.is_foreign AND i.item_code!=i.stock_id AND mb_flag != 'F'";
+       $sql .= " AND !i.is_foreign AND i.item_code!=i.stock_id AND mb_flag <> 'F'";
        break;
   case "all":
-    $sql .= " AND mb_flag != 'F' AND i.item_code=i.stock_id";
+    $sql .= " AND mb_flag <> 'F' AND i.item_code=i.stock_id";
     // NOTHING TO DO.
     break;
 }