Removed obsolete Movement Types handling.
[fa-stable.git] / includes / ui / ui_lists.inc
index f604f69a6a190ad25f213a01d14a2bcd8666c8c9..6170e79f41496303cda59347fc4fd520a38bb721 100644 (file)
@@ -212,11 +212,15 @@ $opts = array(            // default options
                        }
                        $cat = $contact_row[$opts['category']];
                        if ($opts['category'] !== false && $cat != $lastcat){
+                               if ($lastcat!==null)
+                                       $selector .= "</optgroup>";
                                $selector .= "<optgroup label='".$cat."'>\n";
                                $lastcat = $cat;
                        }
                        $selector .= "<option $sel $optclass value='$value'>$descr</option>\n";
                }
+               if ($lastcat!==null)
+                       $selector .= "</optgroup>";
                db_free_result($result);
        }
 
@@ -364,7 +368,6 @@ $opts = array(              // default options
 
        if ($first_id!==false) {
                $sel = ($found===$first_id) || ($found===false && ($spec_option===false)) ? "selected='selected'" : '';
-               $selector = sprintf($first_opt, $sel).$selector;
        }
        // Prepend special option.
        if ($spec_option !== false) { // if special option used - add it
@@ -1309,29 +1312,6 @@ function sales_types_list_row($label, $name, $selected_id=null, $submit_on_chang
 
 //-----------------------------------------------------------------------------------------------
 
-function movement_types_list($name, $selected_id=null)
-{
-       $sql = "SELECT id, name FROM ".TB_PREF."movement_types";
-       return combo_input($name, $selected_id, $sql, 'id', 'name', array());
-}
-
-function movement_types_list_cells($label, $name, $selected_id=null)
-{
-       if ($label != null)
-               echo "<td>$label</td>\n";
-       echo "<td>";
-       echo movement_types_list($name, $selected_id);
-       echo "</td>\n";
-}
-
-function movement_types_list_row($label, $name, $selected_id=null)
-{
-       echo "<tr><td class='label'>$label</td>";
-       movement_types_list_cells(null, $name, $selected_id);
-       echo "</tr>\n";
-}
-
-//-----------------------------------------------------------------------------------------------
 function _format_date($row)
 {
        return sql2date($row['reconciled']);
@@ -2444,3 +2424,24 @@ function accounts_type_list_row($label, $name, $selected_id=null)
        echo "</td></tr>\n";
 }
 
+function users_list_cells($label, $name, $selected_id=null, $submit_on_change=false, $spec_opt=true)
+{
+    $where = false;
+    $sql = " SELECT user_id, real_name FROM ".TB_PREF."users";
+
+    if ($label != null)
+        echo "<td>$label</td>\n";
+    echo "<td>";
+
+    echo combo_input($name, $selected_id, $sql, 'user_id', 'real_name',
+        array(
+            'spec_option' => $spec_opt===true ?_("All users") : $spec_opt,
+            'spec_id' => '',
+            'order' => 'real_name',
+            'select_submit'=> $submit_on_change,
+            'async' => false
+        ) );
+    echo "</td>";
+
+}
+