From ee9f9f9aa4c3b9d5d20ab10a45c12bcaa6aa78d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 1 Oct 2010 12:46:24 +0200 Subject: [PATCH] Rechungssuche - Department bei selectbox richtig suchen. Applikation des Multibox Features von eben. Department wird im Suchpfad jetzt getrennt von department_id behandelt, und die selectbox stellt rendert gleich den korrekten Elementnamen. --- SL/AR.pm | 12 +++++++++--- bin/mozilla/ar.pl | 3 +++ templates/webpages/ar/search.html | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/SL/AR.pm b/SL/AR.pm index 04af97350..fe3e4431b 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -435,7 +435,8 @@ sub ar_transactions { qq|LEFT JOIN employee e2 ON (a.salesman_id = e2.id) | . qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id)| . qq|LEFT JOIN tax_zones tz ON (tz.id = c.taxzone_id)| . - qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)|; + qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)| . + qq|LEFT JOIN department d ON (d.id = a.department_id)|; my $where = "1 = 1"; if ($form->{customer_id}) { @@ -445,11 +446,16 @@ sub ar_transactions { $where .= " AND c.name ILIKE ?"; push(@values, $form->like($form->{customer})); } - if ($form->{department}) { - my ($null, $department_id) = split /--/, $form->{department}; + if ($form->{department_id}) { + my $department_id = $form->{department_id}; $where .= " AND a.department_id = ?"; push(@values, $department_id); } + if ($form->{department}) { + my $department = "%" . $form->{department} . "%"; + $where .= " AND d.description ILIKE ?"; + push(@values, $department); + } foreach my $column (qw(invnumber ordnumber notes transaction_description)) { if ($form->{$column}) { $where .= " AND a.$column ILIKE ?"; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 35f23d6dd..8efd498fa 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -1398,6 +1398,9 @@ sub ar_transactions { my ($department) = split /--/, $form->{department}; push @options, $locale->text('Department') . " : $department"; } + if ($form->{department_id}) { + push @options, $locale->text('Department Id') . " : $form->{department_id}"; + } if ($form->{invnumber}) { push @options, $locale->text('Invoice Number') . " : $form->{invnumber}"; } diff --git a/templates/webpages/ar/search.html b/templates/webpages/ar/search.html index cf8c70a54..9245d6b29 100644 --- a/templates/webpages/ar/search.html +++ b/templates/webpages/ar/search.html @@ -31,6 +31,7 @@ [%- INCLUDE 'generic/multibox.html' name = 'department', + select_name = 'department_id', style = 'width: 250px', DATA = ALL_DEPARTMENTS, id_key = 'id', -- 2.20.1