Suche nach und Anzeige von Abteilungen bei Lieferscheinsuche
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 11 Oct 2012 15:41:37 +0000 (17:41 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 11 Oct 2012 15:41:37 +0000 (17:41 +0200)
Implementiert #1952.

SL/DO.pm
bin/mozilla/do.pl
templates/webpages/do/search.html

index 237d523..4fbe802 100644 (file)
--- a/SL/DO.pm
+++ b/SL/DO.pm
@@ -66,13 +66,16 @@ sub transactions {
          dord.closed, dord.delivered, dord.shippingpoint, dord.shipvia,
          dord.transaction_description,
          pr.projectnumber AS globalprojectnumber,
+         dep.description AS department,
          e.name AS employee,
          sm.name AS salesman
        FROM delivery_orders dord
        LEFT JOIN $vc ct ON (dord.${vc}_id = ct.id)
        LEFT JOIN employee e ON (dord.employee_id = e.id)
        LEFT JOIN employee sm ON (dord.salesman_id = sm.id)
-       LEFT JOIN project pr ON (dord.globalproject_id = pr.id)|;
+       LEFT JOIN project pr ON (dord.globalproject_id = pr.id)
+       LEFT JOIN department dep ON (dord.department_id = dep.id)
+|;
 
   push @where, ($form->{type} eq 'sales_delivery_order' ? '' : 'NOT ') . qq|COALESCE(dord.is_sales, FALSE)|;
 
@@ -147,7 +150,8 @@ sub transactions {
     "employee"                => "e.name",
     "salesman"                => "sm.name",
     "shipvia"                 => "dord.shipvia",
-    "transaction_description" => "dord.transaction_description"
+    "transaction_description" => "dord.transaction_description",
+    "department"              => "lower(dep.description)",
   );
 
   my $sortdir   = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC';
index 1bcf209..1dc880e 100644 (file)
@@ -453,6 +453,7 @@ sub search {
 
   $form->get_lists("projects"     => { "key" => "ALL_PROJECTS",
                                        "all" => 1 },
+                   "departments"  => "ALL_DEPARTMENTS",
                    "$form->{vc}s" => "ALL_VC");
   $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]);
 
@@ -477,6 +478,7 @@ sub orders {
   my $locale   = $main::locale;
   my $cgi      = $::request->{cgi};
 
+  $form->{department_id} = (split /--/, $form->{department})[-1];
   ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} });
 
   report_generator_set_default_sort('transdate', 1);
@@ -491,7 +493,7 @@ sub orders {
     ordnumber               customernumber
     name                    employee  salesman
     shipvia                 globalprojectnumber
-    transaction_description
+    transaction_description department
     open                    delivered
   );
 
@@ -525,9 +527,10 @@ sub orders {
     'transaction_description' => { 'text' => $locale->text('Transaction description'), },
     'open'                    => { 'text' => $locale->text('Open'), },
     'delivered'               => { 'text' => $locale->text('Delivered'), },
+    'department'              => { 'text' => $locale->text('Department'), },
   );
 
-  foreach my $name (qw(id transdate donumber ordnumber name employee salesman shipvia transaction_description)) {
+  foreach my $name (qw(id transdate donumber ordnumber name employee salesman shipvia transaction_description department)) {
     my $sortdir                 = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir};
     $column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir";
   }
index 66cd07f..f7ab5d5 100644 (file)
@@ -62,7 +62,7 @@
       <select name="department" class="fixed_width">
        <option></option>
        [%- FOREACH row = ALL_DEPARTMENTS %]
-       <option[% IF department == row.value %] selected[% END %]>[% HTML.escape(row.description) %]--[% HTML.escape(row.id) %]</option>
+       <option[% IF department == row.id %] selected[% END %]>[% HTML.escape(row.description) %]--[% HTML.escape(row.id) %]</option>
        [%- END %]
       </select>
      </td>
         [% END %]
        </tr>
 
+       <tr>
+        <td>
+         <input name="l_department" id="l_department" class="checkbox" type="checkbox" value="Y">
+         <label for="l_department">[% "Department" | $T8 %]</label>
+        </td>
+
+        <td>
+         <input name="l_shipvia" id="l_shipvia" class="checkbox" type="checkbox" value="Y">
+         <label for="l_shipvia">[% 'Ship via' | $T8 %]</label>
+        </td>
+       </tr>
+
        <tr>
         <td>
          <input name="l_employee" id="l_employee" class="checkbox" type="checkbox" value="Y" checked>
          <input name="l_salesman" id="l_salesman" class="checkbox" type="checkbox" value="Y">
          <label for="l_salesman">[% 'Salesman' | $T8 %]</label>
         </td>
-
-        <td>
-         <input name="l_shipvia" id="l_shipvia" class="checkbox" type="checkbox" value="Y">
-         <label for="l_shipvia">[% 'Ship via' | $T8 %]</label>
-        </td>
        </tr>
 
        <tr>
 
 </body>
 </html>
-