Added short name, name and tax id as search options in customer and supplier lists
[fa-stable.git] / includes / ui / ui_lists.inc
index 0240b9536c92882cc57294d77143ba8f77bd1fb9..27f812da38675e43b1bb7a0f267d787dc47c33cf 100644 (file)
@@ -450,6 +450,7 @@ function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_
            'order' => array('supp_ref'),
                'search_box' => $mode!=0,
                'type' => 1,
+        'search' => array("supp_ref","supp_name","gst_no"),        
                'spec_option' => $spec_option === true ? _("All Suppliers") : $spec_option,
                'spec_id' => $all_items,
                'select_submit'=> $submit_on_change,
@@ -502,6 +503,7 @@ function customer_list($name, $selected_id=null, $spec_option=false, $submit_on_
                'search_box' => $mode!=0,
                'type' => 1,
                'size' => 20,
+        'search' => array("debtor_ref","name","tax_id"),        
                'spec_option' => $spec_option === true ? _("All Customers") : $spec_option,
                'spec_id' => $all_items,
                'select_submit'=> $submit_on_change,
@@ -709,7 +711,7 @@ $options = array(
        if (!$showclosed)
                $options['where'][] = "closed=0";
        if($showtype)
-               $options['where'][] = "type_=$showtype";
+               $options['where'][] = "type_=".db_escape($showtype);
 
        return combo_input($name, $selected_id, $sql, 'id', 'ref', $options);
 }
@@ -833,8 +835,11 @@ function sales_items_list($name, $selected_id=null, $all_option=false,
          ), $opts) );
 }
 
-function sales_items_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false)
+function sales_items_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false, $editkey=false)
 {
+       if ($editkey)
+               set_editor('item', $name, $editkey);
+
        if ($label != null)
                echo "<td>$label</td>\n";
        echo sales_items_list($name, $selected_id, $all_option, $submit_on_change,
@@ -889,7 +894,7 @@ function stock_component_items_list($name, $parent_stock_id, $selected_id=null,
        $all_option=false, $submit_on_change=false, $editkey = false)
 {
        return stock_items_list($name, $selected_id, $all_option, $submit_on_change,
-               array('where'=>array("stock_id != '$parent_stock_id'")), $editkey);
+               array('where'=>array("stock_id != ".db_escape($parent_stock_id))), $editkey);
 }
 
 function stock_component_items_list_cells($label, $name, $parent_stock_id, 
@@ -898,7 +903,7 @@ function stock_component_items_list_cells($label, $name, $parent_stock_id,
        if ($label != null)
                echo "<td>$label</td>\n";
        echo stock_items_list($name, $selected_id, $all_option, $submit_on_change,
-               array('where'=>array("stock_id != '$parent_stock_id'"), 'cells'=>true),
+               array('where'=>array("stock_id != ".db_escape($parent_stock_id)), 'cells'=>true),
                $editkey);
 }
 //------------------------------------------------------------------------------------
@@ -1409,7 +1414,7 @@ function workcenter_list_row($label, $name, $selected_id=null, $all_option=false
 
 //-----------------------------------------------------------------------------------------------
 
-function bank_accounts_list($name, $selected_id=null, $submit_on_change=false)
+function bank_accounts_list($name, $selected_id=null, $submit_on_change=false, $spec_option=false)
 {
        $sql = "SELECT ".TB_PREF."bank_accounts.id, bank_account_name, bank_curr_code, inactive
                FROM ".TB_PREF."bank_accounts";
@@ -1418,6 +1423,8 @@ function bank_accounts_list($name, $selected_id=null, $submit_on_change=false)
        array(
                'format' => '_format_add_curr',
                'select_submit'=> $submit_on_change,
+               'spec_option' => $spec_option,
+               'spec_id' => '',
                'async' => false
        ) );
 }
@@ -1910,8 +1917,7 @@ function journal_types_list_cells($label, $name, $value=null, $submit_on_change=
        $items = $systypes_array;
 
        // exclude quotes, orders and dimensions
-       foreach (array(ST_PURCHORDER, ST_WORKORDER, ST_SALESORDER, ST_DIMENSION, 
-                               ST_SALESQUOTE, ST_LOCTRANSFER) as $excl)
+       foreach (array(ST_PURCHORDER, ST_SALESORDER, ST_DIMENSION, ST_SALESQUOTE, ST_LOCTRANSFER) as $excl)
                        unset($items[$excl]);
        
        echo array_selector($name, $value, $items, 
@@ -2200,7 +2206,7 @@ function security_roles_list_row($label, $name, $selected_id=null, $new_item=fal
        echo "</tr>\n";
 }
 
-function tab_list_row($label, $name, $selected_id=null, $all = false)
+function tab_list_row($label, $name, $selected_id=null)
 {
        global $installed_extensions;
        
@@ -2208,12 +2214,6 @@ function tab_list_row($label, $name, $selected_id=null, $all = false)
        foreach ($_SESSION['App']->applications as $app) {
                $tabs[$app->id] = access_string($app->name, true);
        }
-       if ($all) {     // add also not active ext. modules
-               foreach ($installed_extensions as $ext) {
-                       if ($ext['type'] == 'module' && !$ext['active'])
-                               $tabs[$ext['tab']] = access_string($ext['title'], true);
-               }
-       }
        echo "<tr>\n";
        echo "<td class='label'>$label</td><td>\n";
        echo array_selector($name, $selected_id, $tabs);