From a34838e6d1ff8d00fb76dbaf09b8a98db0f0b295 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Fri, 12 Feb 2016 17:58:36 +0100 Subject: [PATCH] =?utf8?q?Stammdaten->Berichte->Kunden/Lieferanten:=20Stra?= =?utf8?q?=C3=9Fe=20u.=20PLZ=20auch=20in=20Lieferadressen=20suchen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit So, wie es die Bezeichung auch suggeriert. --- SL/CT.pm | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/SL/CT.pm b/SL/CT.pm index f21f73b82..ded457738 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -118,6 +118,28 @@ sub search { push @values, '%' . $form->{cp_name} . '%'; } + if ($form->{addr_street}) { + $where .= qq| AND ((ct.street ILIKE ?) | . + qq| OR | . + qq| (ct.id IN ( | . + qq| SELECT sc.trans_id FROM shipto sc | . + qq| WHERE (sc.module = 'CT') | . + qq| AND (sc.shiptostreet ILIKE ?) | . + qq| ))) |; + push @values, ('%' . $form->{addr_street} . '%') x 2; + } + + if ($form->{addr_zipcode}) { + $where .= qq| AND ((ct.zipcode ILIKE ?) | . + qq| OR | . + qq| (ct.id IN ( | . + qq| SELECT sc.trans_id FROM shipto sc | . + qq| WHERE (sc.module = 'CT') | . + qq| AND (sc.shiptozipcode ILIKE ?) | . + qq| ))) |; + push @values, ('%' . $form->{addr_zipcode} . '%') x 2; + } + if ($form->{addr_city}) { $where .= " AND ((lower(ct.city) LIKE lower(?)) OR @@ -218,16 +240,6 @@ sub search { push @values, @cvar_values; } - if ($form->{addr_street}) { - $where .= qq| AND (ct.street ILIKE ?)|; - push @values, '%' . $form->{addr_street} . '%'; - } - - if ($form->{addr_zipcode}) { - $where .= qq| AND (ct.zipcode ILIKE ?)|; - push @values, $form->{addr_zipcode} . '%'; - } - my $pg_select = $form->{l_pricegroup} ? qq|, pg.pricegroup as pricegroup | : ''; my $pg_join = $form->{l_pricegroup} ? qq|LEFT JOIN pricegroup pg ON (ct.klass = pg.id) | : ''; my $query = -- 2.20.1