gelöschte Benutzer in do/form_header ausblenden
authorSven Schöling <s.schoeling@linet-services.de>
Mon, 13 Feb 2012 14:35:41 +0000 (15:35 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Mon, 13 Feb 2012 14:35:41 +0000 (15:35 +0100)
bin/mozilla/do.pl
templates/webpages/do/form_header.html

index f06bd32..e16286d 100644 (file)
@@ -272,13 +272,14 @@ sub form_header {
                      "all"          => 0,
                      "old_id"       => \@old_project_ids
                    },
-                   "employees"      => "ALL_EMPLOYEES",
-                   "salesmen"       => "ALL_SALESMEN",
                    $vc              => "ALL_VC",
                    "price_factors"  => "ALL_PRICE_FACTORS",
                    "departments"    => "ALL_DEPARTMENTS",
                    "business_types" => "ALL_BUSINESS_TYPES",
     );
+
+  $::form->{ALL_EMPLOYEES}         = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{employee_id},  deleted => 0 ] ]);
+  $::form->{ALL_SALESMEN}          = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{salesman_id},  deleted => 0 ] ]);
   $::form->{ALL_CONTACTS}          = SL::DB::Manager::Contact->get_all(query => [
     or => [
       cp_cv_id => $::form->{"$::form->{vc}_id"} * 1,
index 3ed1be2..b195637 100644 (file)
          [% IF row.id == employee_id %][%- IF row.name %][%- HTML.escape(row.name) %][%- ELSE %][% HTML.escape(row.login) %][%- END %][% END %]
          [%- END %]
          [%- ELSE %]
-         <select name="employee_id">
-          [%- FOREACH row = ALL_EMPLOYEES %]
-          <option value="[% HTML.escape(row.id) %]"[% IF row.id == employee_id %] selected[% END %]>
-           [%- IF row.name %][%- HTML.escape(row.name) %][%- ELSE %][% HTML.escape(row.login) %][%- END %]
-          </option>
-          [%- END %]
-         </select>
+           [% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, default=employee_id, title='safe_name')) %]
          [%- END %]
         </td>
        </tr>
          [% IF row.id == the_salesman_id %][%- IF row.name %][%- HTML.escape(row.name) %][%- ELSE %][% HTML.escape(row.login) %][%- END %][% END %]
          [%- END %]
          [%- ELSE %]
-         <select name="salesman_id">
-          [%- FOREACH row = ALL_SALESMEN %]
-          <option value="[% HTML.escape(row.id) %]"[% IF row.id == the_salesman_id %] selected[% END %]>
-           [%- IF row.name %][%- HTML.escape(row.name) %][%- ELSE %][% HTML.escape(row.login) %][%- END %]
-          </option>
-          [%- END %]
-         </select>
+          [% L.select_tag('salesman_id', L.options_for_select(ALL_SALESMEN, default=(salesman_id ? salesman_id : employee_id), title='safe_name')) %]
          [%- END %]
         </td>
        </tr>