Removed get_js_set_focus() and get_js_form_entry()
[fa-stable.git] / includes / ui / ui_lists.inc
index b75d66c8af1c313aae9d6e0175d1bc857990b381..f271bb65679041028e16a0378f357eb12dd321e2 100644 (file)
@@ -13,11 +13,11 @@ $all_items = reserved_words::get_all();
 
 function supplier_list($name, $selected_id, $all_option=false, $submit_on_change=false)
 {
-       global $no_supplier_list, $all_items;
+       global $all_items;
 
        if ($selected_id == null)
                $selected_id = ((!isset($_POST[$name]) || $_POST[$name] == "") ? "" : $_POST[$name]);
-
+       $no_supplier_list = get_company_pref('no_supplier_list');
        if ($no_supplier_list)
        {
                global $search_button;
@@ -127,11 +127,11 @@ function supplier_list_row($label, $name, $selected_id, $all_option=false, $subm
 
 function customer_list($name, $selected_id, $all_option=false, $submit_on_change=false)
 {
-       global $no_customer_list, $all_items;
+       global $all_items;
 
        if ($selected_id == null)
                $selected_id = ((!isset($_POST[$name]) || $_POST[$name] == "") ? "" : $_POST[$name]);
-
+       $no_customer_list = get_company_pref('no_customer_list');
        if ($no_customer_list)
        {
                global $search_button;
@@ -606,11 +606,11 @@ function dimensions_list_row($label, $name, $selected_id, $no_option=false, $sho
 
 function stock_items_list($name, $selected_id, $all_option=false, $submit_on_change=false, $extra="")
 {
-       global $all_items, $no_item_list;
+       global $all_items;
 
        if ($selected_id == null)
                $selected_id = (!isset($_POST[$name]) ? "" : $_POST[$name]);
-
+       $no_item_list = get_company_pref('no_item_list');
        if ($no_item_list)
        {
                global $search_button;
@@ -898,11 +898,11 @@ function stock_component_items_list($name, $parent_stock_id, &$selected_id,
 
 function stock_purchasable_items_list($name, &$selected_id,    $all_option=false, $submit_on_change=false, $extra="")
 {
-       global $no_item_list, $all_items;
+       global $all_items;
 
        if ($selected_id == null)
                $selected_id = (!isset($_POST[$name]) ? "" : $_POST[$name]);
-
+       $no_item_list = get_company_pref('no_item_list');
        if ($no_item_list)
        {
                $edit_name = $name."_edit";
@@ -1050,6 +1050,7 @@ function stock_units_list_row($label, $name, $value, $enabled=true)
 {
        global $stock_units;
 
+       $result = get_all_item_units();
        echo "<tr><td>$label</td>\n";
        if ($enabled)
                echo "<td><select name='$name'>";
@@ -1058,17 +1059,20 @@ function stock_units_list_row($label, $name, $value, $enabled=true)
 
        if ($value == null)
                $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
-       foreach ($stock_units as $unit)
+
+       while($unit = db_fetch($result))
        {
-               if ($value == "")
-                       $_POST[$name] = $value = $unit;
-               if ($value==$unit)
+               if ($value == "") {
+                       $_POST[$name] = $unit['abbr'];
+               }
+               $descr = $unit['name'];
+               if ($value==$unit['abbr'])
                {
-                       echo "<option selected value='$unit'>$unit</option>\n";
+                       echo "<option selected value='".$unit['abbr']."'>$descr</option>\n";
                }
                else
                {
-                       echo "<option value='$unit'>$unit</option>\n";
+                       echo "<option value='".$unit['abbr']."'>$descr</option>\n";
                }
        }
        echo "</select></td></tr>\n";
@@ -1079,7 +1083,7 @@ function stock_units_list_row($label, $name, $value, $enabled=true)
 function tax_types_list($name, $selected_id,
        $none_option=false, $none_option_name=null, $submit_on_change=false)
 {
-       simple_codeandname_list("SELECT id, name FROM ".TB_PREF."tax_types",
+       simple_codeandname_list("SELECT id, CONCAT(name, ' (',rate,'%)') as name FROM ".TB_PREF."tax_types",
                $name, $selected_id, $none_option, $none_option_name, true, $submit_on_change);
 }
 
@@ -1191,10 +1195,10 @@ function sales_persons_list_cells($label, $name, $selected_id)
        echo "</td>\n";
 }
 
-function sales_persons_list_row($label, $name, $selected_id)
+function sales_persons_list_row($label, $name, $selected_id, $submit_on_change=false)
 {
        echo "<tr>\n";
-       sales_persons_list_cells($label, $name, $selected_id);
+       sales_persons_list_cells($label, $name, $selected_id, $submit_on_change=false);
        echo "</tr>\n";
 }
 
@@ -1296,25 +1300,25 @@ function credit_status_list_row($label, $name, $selected_id)
 
 //-----------------------------------------------------------------------------------------------
 
-function sales_types_list($name, $selected_id)
+function sales_types_list($name, $selected_id, $submit_on_change=false)
 {
        simple_codeandname_list("SELECT id, sales_type FROM ".TB_PREF."sales_types",
-               $name, $selected_id);
+               $name, $selected_id, false, null, false, $submit_on_change);
 }
 
-function sales_types_list_cells($label, $name, $selected_id)
+function sales_types_list_cells($label, $name, $selected_id, $submit_on_change=false)
 {
        if ($label != null)
                echo "<td>$label</td>\n";
        echo "<td>";
-       sales_types_list($name, $selected_id);
+       sales_types_list($name, $selected_id, $submit_on_change);
        echo "</td>\n";
 }
 
-function sales_types_list_row($label, $name, $selected_id)
+function sales_types_list_row($label, $name, $selected_id, $submit_on_change=false)
 {
        echo "<tr>\n";
-       sales_types_list_cells($label, $name, $selected_id);
+       sales_types_list_cells($label, $name, $selected_id, $submit_on_change);
        echo "</tr>\n";
 }
 
@@ -1959,8 +1963,17 @@ function decseps_list_row($label, $name, $value)
 
 function themes_list_row($label, $name, $value)
 {
-       global $themes;
-
+       global $path_to_root;
+       
+       $path = $path_to_root.'/themes/';
+       $themes = array();
+       $themedir = opendir($path);
+       while(false !== ($fname = readdir($themedir))) {
+           if($fname!='.' && $fname!='..' && $fname!='CVS' && is_dir($path.$fname)) {
+                       $themes[] =  $fname;
+           } 
+       }
+       sort($themes);
        echo "<tr><td>$label</td>\n";
        echo "<td><select name='$name'>";
 
@@ -2079,6 +2092,7 @@ function cust_allocations_list_cells($label, $name, $selected)
        echo "<option " . ($selected == '2'?" selected ":"") . " value='2'>" . _("Overdue Invoices"). "</option>\n";
        echo "<option " . ($selected == '3'?" selected ":"") . " value='3'>" . _("Payments"). "</option>\n";
        echo "<option " . ($selected == '4'?" selected ":"") . " value='4'>" . _("Credit Notes"). "</option>\n";
+       echo "<option " . ($selected == '5'?" selected ":"") . " value='5'>" . _("Delivery Notes"). "</option>\n";
        echo "</select></td>\n";
 }