From b1c40d4de868ead7dc9f2a007d7d461b02318d29 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Wed, 28 Jan 2015 21:58:04 +0100 Subject: [PATCH] =?utf8?q?Stammdaten=20->=20Berichte=20->=20Kunden:=20Nach?= =?utf8?q?=20Standardverk=C3=A4ufer=20filtern=20k=C3=B6nnen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/CT.pm | 5 +++++ bin/mozilla/ct.pl | 11 +++++++++-- templates/webpages/ct/search.html | 9 +++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/SL/CT.pm b/SL/CT.pm index b430272e0..ab931c04c 100644 --- 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)) { diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index b5b83c19f..5a2dbd6c5 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -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)), diff --git a/templates/webpages/ct/search.html b/templates/webpages/ct/search.html index 57b970cbe..933a7d1c0 100644 --- a/templates/webpages/ct/search.html +++ b/templates/webpages/ct/search.html @@ -57,6 +57,15 @@ [% END %] + [% IF IS_CUSTOMER && ALL_SALESMEN.size %] + + [% 'Salesman' | $T8 %] + + [% L.select_tag('salesman_id', ALL_SALESMEN, title_key = 'name', with_empty = 1) %] + + + [% END %] + [% CUSTOM_VARIABLES_FILTER_CODE %] -- 2.20.1