Stammdaten -> Berichte -> Kunden: Nach Standardverkäufer filtern können.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 28 Jan 2015 20:58:04 +0000 (21:58 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 28 Jan 2015 20:58:41 +0000 (21:58 +0100)
SL/CT.pm
bin/mozilla/ct.pl
templates/webpages/ct/search.html

index b430272..ab931c0 100644 (file)
--- a/SL/CT.pm
+++ b/SL/CT.pm
@@ -171,6 +171,11 @@ sub search {
     push(@values, conv_i($form->{business_id}));
   }
 
+  if ($form->{salesman_id}) {
+    $where .= qq| AND (ct.salesman_id = ?)|;
+    push(@values, conv_i($form->{salesman_id}));
+  }
+
   # Nur Kunden finden, bei denen ich selber der Verkäufer bin
   # Gilt nicht für Lieferanten
   if ($cv eq 'customer' &&   !$main::auth->assert('customer_vendor_all_edit', 1)) {
index b5b83c1..5a2dbd6 100644 (file)
@@ -76,7 +76,8 @@ sub search {
 
   $form->{IS_CUSTOMER} = $form->{db} eq 'customer';
 
-  $form->get_lists("business_types" => "ALL_BUSINESS_TYPES");
+  $form->get_lists("business_types" => "ALL_BUSINESS_TYPES",
+                   "salesmen"       => "ALL_SALESMEN");
   $form->{SHOW_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0;
 
   $form->{CUSTOM_VARIABLES}                  = CVar->get_configs('module' => 'CT');
@@ -152,6 +153,12 @@ sub list_names {
       push @options, $label . " : " . $business->description;
     }
   }
+  if ($form->{salesman_id}) {
+    my $salesman = SL::DB::Manager::Employee->find_by(id => $form->{salesman_id});
+    if ($salesman) {
+      push @options, $locale->text('Salesman') . " : " . $salesman->name;
+    }
+  }
 
   my @columns = (
     'id',        'name',    "$form->{db}number",   'contact',   'phone',    'discount',
@@ -194,7 +201,7 @@ sub list_names {
 
   my @hidden_variables  = ( qw(
       db status obsolete name contact email cp_name addr_street addr_zipcode
-      addr_city addr_country business_id
+      addr_city addr_country business_id salesman_id
     ), "$form->{db}number",
     map({ "cvar_$_->{name}" } @searchable_custom_variables),
     map({'cvar_'. $_->{name} .'_qtyop'} grep({$_->{type} eq 'number'} @searchable_custom_variables)),
index 57b970c..933a7d1 100644 (file)
    </tr>
    [% END %]
 
+   [% IF IS_CUSTOMER && ALL_SALESMEN.size %]
+   <tr>
+    <th align="right" nowrap>[% 'Salesman' | $T8 %]</th>
+    <td>
+     [% L.select_tag('salesman_id', ALL_SALESMEN, title_key = 'name', with_empty = 1) %]
+    </td>
+   </tr>
+   [% END %]
+
    [% CUSTOM_VARIABLES_FILTER_CODE %]
 
    <tr>