From aff48c9512cb1cf6568654f7819c16638af0eac8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Fri, 14 Mar 2014 15:16:35 +0100 Subject: [PATCH] Kundenfilter im Verkaufsbericht nicht mit check_name implementieren. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sondern einfach nach dem Teilstring in der Abfarge suchen. Oder nach der id, wenn der Name aus der Drop-Down-Box kommt. Hintergrund: check_name überschreibt einige form-Variablen (z.B. country und salesman_id) und dann ist der Bericht falsch. Behebt #2468. --- SL/VK.pm | 5 ++++- bin/mozilla/vk.pl | 26 ++++++-------------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/SL/VK.pm b/SL/VK.pm index cc49cb412..6d7df707a 100644 --- a/SL/VK.pm +++ b/SL/VK.pm @@ -110,7 +110,10 @@ sub invoice_transactions { if ($form->{customer_id}) { $where .= " AND ar.customer_id = ?"; push(@values, $form->{customer_id}); - }; + } elsif ($form->{customer}) { + $where .= " AND ct.name ILIKE ?"; + push(@values, $form->like($form->{customer})); + } if ($form->{customernumber}) { $where .= qq| AND ct.customernumber = ? |; push(@values, $form->{customernumber}); diff --git a/bin/mozilla/vk.pl b/bin/mozilla/vk.pl index a14a051ab..9bc079168 100644 --- a/bin/mozilla/vk.pl +++ b/bin/mozilla/vk.pl @@ -110,24 +110,10 @@ sub invoice_transactions { }; if ( $form->{customer} =~ /--/ ) { - # field data comes from dropdown box - ($form->{customername}, $form->{customer_id}) = split(/--/, $form->{customer}); - } elsif ($form->{customer}) { - - # a value was added in the input box, we only want to filter for one - # customer, so check that a unique customer can be found - - # check_name is executed with no_select => 1, if the result isn't unique - # quit with an error message, the user has to enter a new name - - # Without no_select selecting a customer causes an update which doesn't - # return anything, which is the reason for this workaround - - &check_name('customer', no_select => 1); - - # $form->{customer_id} was already set by check_name - $form->{customername} = $form->{customer}; - }; + # Felddaten kommen aus Dropdownbox + my $dummy; + ($dummy, $form->{customer_id}) = split(/--/, $form->{customer}); + } # if $form->{customer} is empty nothing further happens here # test for decimalplaces or set to default of 2 @@ -168,7 +154,7 @@ sub invoice_transactions { # pass hidden variables for pdf/csv export # first with l_ to determine which columns to show # then with the options for headings (such as transdatefrom, partnumber, ...) - my @hidden_variables = (qw(l_headers_mainsort l_headers_subsort l_subtotal_mainsort l_subtotal_subsort l_total l_parts l_customername l_customernumber transdatefrom transdateto decimalplaces customer customername customer_id department partnumber partsgroup country business description project_id customernumber salesman employee salesman_id employee_id business_id partsgroup_id mainsort subsort), + my @hidden_variables = (qw(l_headers_mainsort l_headers_subsort l_subtotal_mainsort l_subtotal_subsort l_total l_parts l_customername l_customernumber transdatefrom transdateto decimalplaces customer customer_id department partnumber partsgroup country business description project_id customernumber salesman employee salesman_id employee_id business_id partsgroup_id mainsort subsort), "$form->{db}number", map({ "cvar_$_->{name}" } @searchable_custom_variables), map { "l_$_" } @columns @@ -222,7 +208,7 @@ sub invoice_transactions { my @options; push @options, $locale->text('Description') . " : $form->{description}" if $form->{description}; - push @options, $locale->text('Customer') . " : $form->{customername}" if $form->{customer}; + push @options, $locale->text('Customer') . " : $form->{customer}" if $form->{customer}; push @options, $locale->text('Customer Number') . " : $form->{customernumber}" if $form->{customernumber}; # TODO: only customer id is passed push @options, $locale->text('Department') . " : " . (split /--/, $form->{department})[0] if $form->{department}; -- 2.20.1