Two smaller bugs [0000023],[0000026]
[fa-stable.git] / includes / ui / ui_lists.inc
index a2cb1b7f2dc69e4ef90fcbffa64530fb27e83c8c..86968c9fbe644a6c13336ae6dc7a082fb5902af2 100644 (file)
@@ -6,10 +6,10 @@ include_once($path_to_root . "/includes/types.inc");
 include_once($path_to_root . "/includes/current_user.inc");
 
 $_search_button = "<input %s type='submit' class='combo_submit' style='border:0;background:url($path_to_root/themes/"
-       ."%s/images/locate.png) no-repeat;%s' fallback='1' name='%s' value=' ' title='"._("Set filter")."'> ";
+       ."%s/images/locate.png) no-repeat;%s' aspect='fallback' name='%s' value=' ' title='"._("Set filter")."'> ";
 
 $_select_button = "<input %s type='submit' class='combo_select' style='border:0;background:url($path_to_root/themes/"
-       ."%s/images/button_ok.png) no-repeat;%s' fallback='1' name='%s' value=' ' title='"._("Select")."'> ";
+       ."%s/images/button_ok.png) no-repeat;%s' aspect='fallback' name='%s' value=' ' title='"._("Select")."'> ";
 
 $all_items = reserved_words::get_all();
 
@@ -51,7 +51,8 @@ $opts = array(                // default options
        'box_hint' => null // box/selectors hints; null = std see below
 );
 // ------ merge options with defaults ----------
-       $opts = array_merge($opts, $options);
+       if($options != null)
+               $opts = array_merge($opts, $options);
        if (!is_array($opts['where']))  $opts['where'] = array($opts['where']);
 
        $search_box = $opts['search_box']===true ? '_'.$name.'_edit' : $opts['search_box'];
@@ -71,7 +72,7 @@ $opts = array(                // default options
                        '' : _('Press Space tab for search pattern entry');
 
        if ($opts['box_hint'] === null)
-               $opts['box_hint'] = $search_box ?
+               $opts['box_hint'] = $search_box && $search_submit != false ?
                        ($by_id ? _('Enter code fragment to search or * for all')
                        : _('Enter description fragment to search or * for all')) :'';
 
@@ -231,7 +232,8 @@ $opts = array(              // default options
        'disabled' => false
 );
 // ------ merge options with defaults ----------
-       $opts = array_merge($opts, $options);
+       if($options != null)
+               $opts = array_merge($opts, $options);
        $select_submit =  $opts['select_submit']===true ? '_'.$name.'_update' : $opts['select_submit'];
        $spec_id = $opts['spec_id'];
        $spec_option = $opts['spec_option'];
@@ -482,20 +484,20 @@ return combo_input($name, $selected_id, $sql, 'curr_abrev', 'currency',
        ) );
 }
 
-function currencies_list_cells($label, $name, $selected_id=null)
+function currencies_list_cells($label, $name, $selected_id=null, $submit_on_change=false)
 {
        if ($label != null)
                echo "<td>$label</td>\n";
        echo "<td>";
-       $str = currencies_list($name, $selected_id);
+       $str = currencies_list($name, $selected_id, $submit_on_change);
        echo "</td>\n";
        return $str;
 }
 
-function currencies_list_row($label, $name, $selected_id=null)
+function currencies_list_row($label, $name, $selected_id=null, $submit_on_change=false)
 {
        echo "<tr>\n";
-       $str = currencies_list_cells($label, $name, $selected_id);
+       $str = currencies_list_cells($label, $name, $selected_id, $submit_on_change);
        echo "</tr>\n";
        return $str;
 }
@@ -1297,7 +1299,7 @@ function gl_account_types_list_row($label, $name, $selected_id=null, $all_option
 
 //-----------------------------------------------------------------------------------------------
 function gl_all_accounts_list($name, $selected_id=null, $skip_bank_accounts=false,
-       $show_group=false, $cells=false, $all_option=false)
+       $show_group=false, $cells=false, $all_option=false, $submit_on_change=false)
 {
        if ($skip_bank_accounts)
                $sql = "SELECT chart.account_code, chart.account_name, type.name
@@ -1321,7 +1323,9 @@ function gl_all_accounts_list($name, $selected_id=null, $skip_bank_accounts=fals
                        'search_submit' => false,
                        'size' => 12,
                        'max' => 10,
-                       'cells' => true
+                       'cells' => true,
+               'select_submit'=> $submit_on_change,
+               'async' => false
        ) );
 
 }
@@ -1363,7 +1367,7 @@ function yesno_list($name, $selected_id=null, $name_yes="", $name_no="", $submit
 
        return array_selector($name, $selected_id, $items, 
                array( 
-                       'select_submit'=> true, 
+                       'select_submit'=> $submit_on_change,
                        'async' => false ) ); // FIX?
 }
 
@@ -1423,10 +1427,7 @@ function bank_account_types_list($name, $selected_id=null)
        $items = array();
        foreach ($types as $type)
        {
-               if (payment_person_types::has_items($type['id']))
-               {
                        $items[$type['id']] = $type['name'];
-               }
        }
        
        return array_selector($name, $selected_id, $items );