From 2def6461e70255e05432757a744188e84c767f79 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Fri, 22 Feb 2013 17:57:38 +0100 Subject: [PATCH] =?utf8?q?Verkauf=20->=20Berichte=20->=20Kunden=20-=20Land?= =?utf8?q?=20und=20Verk=C3=A4ufer?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit neue Häkchen bei "In Bericht aufnehmen" * nach Land filtern und in Ergebnis anzeigen * Verkäufer anzeigen. --- SL/CT.pm | 29 +++++++++++++++++++++++------ bin/mozilla/ct.pl | 9 ++++++--- locale/de/all | 1 + templates/webpages/ct/search.html | 15 ++++++++++++++- 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/SL/CT.pm b/SL/CT.pm index a32486b59..63b252d9e 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -617,7 +617,7 @@ sub search { my %allowed_sort_columns = map { $_, 1 } qw( id customernumber vendornumber name contact phone fax email street - taxnumber business invnumber ordnumber quonumber zipcode city + taxnumber business invnumber ordnumber quonumber zipcode city country salesman ); my $sortorder = $form->{sort} && $allowed_sort_columns{$form->{sort}} ? $form->{sort} : "name"; $form->{sort} = $sortorder; @@ -659,6 +659,19 @@ sub search { push @values, ('%' . $form->{addr_city} . '%') x 2; } + if ($form->{addr_country}) { + $where .= " AND ((lower(ct.country) LIKE lower(?)) + OR + (ct.id IN ( + SELECT trans_id + FROM shipto + WHERE (module = 'CT') + AND (lower(shiptocountry) LIKE lower(?)) + )) + )"; + push @values, ('%' . $form->{addr_country} . '%') x 2; + } + if ( $form->{status} eq 'orphaned' ) { $where .= qq| AND ct.id NOT IN | . @@ -676,7 +689,7 @@ sub search { qq| WHERE cv.id = a.vendor_id)|; } $form->{l_invnumber} = $form->{l_ordnumber} = $form->{l_quonumber} = ""; - } + }; if ($form->{obsolete} eq "Y") { $where .= qq| AND obsolete|; @@ -716,10 +729,11 @@ sub search { } my $query = - qq|SELECT ct.*, b.description AS business | . + qq|SELECT ct.*, b.description AS business, e.name as salesman | . (qq|, NULL AS invnumber, NULL AS ordnumber, NULL AS quonumber, NULL AS invid, NULL AS module, NULL AS formtype, NULL AS closed | x!! $join_records) . qq|FROM $cv ct | . qq|LEFT JOIN business b ON (ct.business_id = b.id) | . + qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | . qq|WHERE $where|; my @saved_values = @values; @@ -733,13 +747,14 @@ sub search { push(@values, @saved_values); $query .= qq| UNION | . - qq|SELECT ct.*, b.description AS business, | . + qq|SELECT ct.*, b.description AS business, e.name as salesman, | . qq| a.invnumber, a.ordnumber, a.quonumber, a.id AS invid, | . qq| '$module' AS module, 'invoice' AS formtype, | . qq| (a.amount = a.paid) AS closed | . qq|FROM $cv ct | . qq|JOIN $ar a ON (a.${cv}_id = ct.id) | . qq|LEFT JOIN business b ON (ct.business_id = b.id) | . + qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | . qq|WHERE $where AND (a.invoice = '1')|; } @@ -747,12 +762,13 @@ sub search { push(@values, @saved_values); $query .= qq| UNION | . - qq|SELECT ct.*, b.description AS business,| . + qq|SELECT ct.*, b.description AS business, e.name as salesman, | . qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | . qq| 'oe' AS module, 'order' AS formtype, o.closed | . qq|FROM $cv ct | . qq|JOIN oe o ON (o.${cv}_id = ct.id) | . qq|LEFT JOIN business b ON (ct.business_id = b.id) | . + qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | . qq|WHERE $where AND (o.quotation = '0')|; } @@ -760,12 +776,13 @@ sub search { push(@values, @saved_values); $query .= qq| UNION | . - qq|SELECT ct.*, b.description AS business, | . + qq|SELECT ct.*, b.description AS business, e.name as salesman, | . qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | . qq| 'oe' AS module, 'quotation' AS formtype, o.closed | . qq|FROM $cv ct | . qq|JOIN oe o ON (o.${cv}_id = ct.id) | . qq|LEFT JOIN business b ON (ct.business_id = b.id) | . + qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | . qq|WHERE $where AND (o.quotation = '1')|; } } diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index ff7eedef6..c127b24c9 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -161,6 +161,7 @@ sub list_names { push @options, $locale->text('Billing/shipping address (city)') . " : $form->{addr_city}" if $form->{addr_city}; push @options, $locale->text('Billing/shipping address (zipcode)') . " : $form->{zipcode}" if $form->{addr_zipcode}; push @options, $locale->text('Billing/shipping address (street)') . " : $form->{street}" if $form->{addr_street}; + push @options, $locale->text('Billing/shipping address (country)') . " : $form->{country}" if $form->{addr_country}; if ($form->{business_id}) { my $business = SL::DB::Manager::Business->find_by(id => $form->{business_id}); @@ -171,9 +172,9 @@ sub list_names { } my @columns = ( - 'id', 'name', "$form->{db}number", 'contact', 'phone', - 'fax', 'email', 'taxnumber', 'street', 'zipcode' , 'city', - 'business', 'invnumber', 'ordnumber', 'quonumber' + 'id', 'name', "$form->{db}number", 'contact', 'phone', + 'fax', 'email', 'taxnumber', 'street', 'zipcode' , 'city', + 'business', 'invnumber', 'ordnumber', 'quonumber', 'salesman', 'country' ); my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs }; @@ -199,6 +200,8 @@ sub list_names { 'street' => { 'text' => $locale->text('Street'), }, 'zipcode' => { 'text' => $locale->text('Zipcode'), }, 'city' => { 'text' => $locale->text('City'), }, + 'country' => { 'text' => $locale->text('Country'), }, + 'salesman' => { 'text' => $locale->text('Salesman'), }, %column_defs_cvars, ); diff --git a/locale/de/all b/locale/de/all index d88e2ec70..15f94b8af 100644 --- a/locale/de/all +++ b/locale/de/all @@ -284,6 +284,7 @@ $self->{texts} = { 'Bilanz' => 'Bilanz', 'Billing Address' => 'Rechnungsadresse', 'Billing/shipping address (city)' => 'Rechnungsadresse (Stadt)', + 'Billing/shipping address (country)' => 'Rechnungsadresse (Land)', 'Billing/shipping address (street)' => 'Rechnungsadresse (Straße)', 'Billing/shipping address (zipcode)' => 'Rechnungsadresse (PLZ)', 'Bin' => 'Lagerplatz', diff --git a/templates/webpages/ct/search.html b/templates/webpages/ct/search.html index 2d78134fe..4d4bbf2de 100644 --- a/templates/webpages/ct/search.html +++ b/templates/webpages/ct/search.html @@ -43,6 +43,11 @@ [% 'Billing/shipping address (city)' | $T8 %] + + [% 'Billing/shipping address (country)' | $T8 %] + + + [% IF SHOW_BUSINESS_TYPES %] [% IF IS_CUSTOMER %][% 'Customer type' | $T8 %][% ELSE %][% 'Vendor type' | $T8 %][% END %] @@ -128,7 +133,7 @@ - + @@ -145,6 +150,14 @@ + + + + + + + + -- 2.20.1