Stock item types moved to types.inc
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 17 Mar 2009 20:21:44 +0000 (20:21 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 17 Mar 2009 20:21:44 +0000 (20:21 +0000)
includes/types.inc
includes/ui/ui_lists.inc

index d4f3c4a17bc4c676203a302cb6cadb718c8c2663..f1db9b1b8fdafe9693687748ad44b1fc34870e8a 100644 (file)
@@ -337,6 +337,11 @@ $quick_entry_types = array(
                QE_SUPPINV => _("Supplier Invoice/Credit")
 );
 
-
+// Types of stock items
+$stock_types = array(
+               'M' => _("Manufactured"),
+               'B' => _("Purchased"),
+               'D' => _("Service")
+);
 
 ?>
\ No newline at end of file
index 87526293545838e62b62c1a537926562758194d3..a44a115eafd7826f325196f52e583b82542d9692 100644 (file)
@@ -897,18 +897,14 @@ function stock_purchasable_items_list_row($label, $name, $selected_id=null,
 
 function stock_item_types_list_row($label, $name, $selected_id=null, $enabled=true)
 {
-       $types = array(
-               'M' => _("Manufactured"),
-               'B' => _("Purchased"),
-               'D' => _("Service")
-       );
+       global $stock_types;
 
        echo "<tr>";
        if ($label != null)
                echo "<td>$label</td>\n";
        echo "<td>";
 
-       array_selector($name, $selected_id, $types, 
+       array_selector($name, $selected_id, $stock_types, 
                array( 
                        'select_submit'=> true, 
                        'disabled' => !$enabled) );
@@ -1481,26 +1477,29 @@ function class_list_row($label, $name, $selected_id=null, $submit_on_change=fals
 
 //-----------------------------------------------------------------------------------------------
 
-function stock_categories_list($name, $selected_id=null)
+function stock_categories_list($name, $selected_id=null, $submit_on_change=false)
 {
        $sql = "SELECT category_id, description FROM ".TB_PREF."stock_category";
        combo_input($name, $selected_id, $sql, 'category_id', 'description',
-       array('order'=>'category_id'));
+       array('order'=>'category_id',
+               'select_submit'=> $submit_on_change,
+               'async' => true
+       ));
 }
 
-function stock_categories_list_cells($label, $name, $selected_id=null)
+function stock_categories_list_cells($label, $name, $selected_id=null, $submit_on_change=false)
 {
        if ($label != null)
                echo "<td>$label</td>\n";
        echo "<td>";
-       stock_categories_list($name, $selected_id);
+       stock_categories_list($name, $selected_id, $submit_on_change);
        echo "</td>\n";
 }
 
-function stock_categories_list_row($label, $name, $selected_id=null)
+function stock_categories_list_row($label, $name, $selected_id=null, $submit_on_change=false)
 {
        echo "<tr>\n";
-       stock_categories_list_cells($label, $name, $selected_id);
+       stock_categories_list_cells($label, $name, $selected_id, $submit_on_change);
        echo "</tr>\n";
 }