From 52f5223a1dcfe217be3fc9f1b4002fe917a7a4c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Thu, 26 Mar 2020 12:43:07 +0100 Subject: [PATCH] Artikelsuche: Suche nach in Erzeugnis verbauten Artikeln MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Als Ergebnis werden Erzeugnisse und deren Bestandteile angezeigt. Gültige Suchkriterien sind aktuell nur die Spalten in parts --- SL/IC.pm | 16 ++++++++++++++++ locale/de/all | 1 + templates/webpages/ic/search.html | 1 + 3 files changed, 18 insertions(+) diff --git a/SL/IC.pm b/SL/IC.pm index 16ebef0b8..0983e2a8a 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -526,6 +526,22 @@ sub all_parts { push @bind_vars, @cvar_values; } + # simple search for assemblies by items used in assemblies + if ($form->{bom} eq '2' && $form->{l_assembly}) { + # nuke where clause and bind vars + $where_clause = ' 1=1 AND p.id in (SELECT id from assembly where parts_id IN ' . + ' (select id from parts where 1=1 AND '; + @bind_vars = (); + # use only like filter for items used in assemblies + foreach (@like_filters) { + next unless $form->{$_}; + $form->{"l_$_"} = '1'; # show the column + $where_clause .= " $_ ILIKE ? "; + push @bind_vars, like($form->{$_}); + } + $where_clause .='))'; + } + my $query = <<" SQL"; SELECT DISTINCT $select_clause FROM parts p diff --git a/locale/de/all b/locale/de/all index 96281457a..b25c483ec 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2803,6 +2803,7 @@ $self->{texts} = { 'Search AR Aging' => 'Offene Forderungen', 'Search bank transactions' => 'Filter für Bankbuchungen', 'Search contacts' => 'Personensuche', + 'Search for Items used in Assemblies' => 'Suche nach in Erzeugnissen verbauten Artikeln', 'Search parts by customer partnumber in sales order forms' => 'Artikel nach Kunden-Art.-Nr. in Verkaufsbelegen suchen', 'Search parts by vendor partnumber (model) in purchase order forms' => 'Artikel nach Lieferanten-Art.-Nr. in Einkaufsbelegen suchen', 'Search term' => 'Suchbegriff', diff --git a/templates/webpages/ic/search.html b/templates/webpages/ic/search.html index 3e68dc0cf..42ec5fb86 100644 --- a/templates/webpages/ic/search.html +++ b/templates/webpages/ic/search.html @@ -102,6 +102,7 @@ [% L.radio_button_tag('bom', id='bom_0', value=0, checked=1, label=LxERP.t8('Top Level Designation only')) %] [% L.radio_button_tag('bom', id='bom_1', value=1, label=LxERP.t8('Individual Items')) %] + [% L.radio_button_tag('bom', id='bom_2', value=2, label=LxERP.t8('Search for Items used in Assemblies')) %] -- 2.20.1