From 4800abb9a0b8363c3c529927f34a5b26551497b2 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 20 Jan 2017 13:36:06 +0100 Subject: [PATCH] Verkaufsrechnungssuche: keine Multibox mehr nutzen --- SL/AR.pm | 9 +----- bin/mozilla/ar.pl | 16 +++------- templates/webpages/ar/search.html | 53 +++---------------------------- 3 files changed, 11 insertions(+), 67 deletions(-) diff --git a/SL/AR.pm b/SL/AR.pm index 079e9e889..4caf5273c 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -499,14 +499,7 @@ sub ar_transactions { $where .= " AND NOT invoice = 'f' "; # remove ar transactions from Sales -> Reports -> Invoices }; - if ($form->{customernumber}) { - $where .= " AND c.customernumber = ?"; - push(@values, trim($form->{customernumber})); - } - if ($form->{customer_id}) { - $where .= " AND a.customer_id = ?"; - push(@values, $form->{customer_id}); - } elsif ($form->{customer}) { + if ($form->{customer}) { $where .= " AND c.name ILIKE ?"; push(@values, like($form->{customer})); } diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 0039d317b..16be58c09 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -40,6 +40,7 @@ use SL::AR; use SL::FU; use SL::GL; use SL::IS; +use SL::DB::Business; use SL::DB::Currency; use SL::DB::Default; use SL::DB::Employee; @@ -789,18 +790,11 @@ sub search { my $locale = $main::locale; my $cgi = $::request->{cgi}; - # setup customer selection - $form->all_vc(\%myconfig, "customer", "AR"); - $form->{title} = $locale->text('AR Transactions'); - # Auch in Rechnungsübersicht nach Kundentyp filtern - jan - $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 }, - "customers" => "ALL_VC", - "business_types" => "ALL_BUSINESS_TYPES"); $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]); - $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all; - $form->{SHOW_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0; + $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted; + $form->{ALL_BUSINESS_TYPES} = SL::DB::Manager::Business->get_all_sorted; $form->{CT_CUSTOM_VARIABLES} = CVar->get_configs('module' => 'CT'); ($form->{CT_CUSTOM_VARIABLES_FILTER_CODE}, @@ -811,6 +805,8 @@ sub search { # constants and subs for template $form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" }; + $::request->layout->add_javascripts("autocomplete_project.js"); + $form->header; print $form->parse_html_template('ar/search', { %myconfig }); @@ -849,8 +845,6 @@ sub ar_transactions { my ($callback, $href, @columns); - ($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer}); - report_generator_set_default_sort('transdate', 1); AR->ar_transactions(\%myconfig, \%$form); diff --git a/templates/webpages/ar/search.html b/templates/webpages/ar/search.html index fffbd9c21..85f1d1249 100644 --- a/templates/webpages/ar/search.html +++ b/templates/webpages/ar/search.html @@ -1,5 +1,5 @@ [%- USE T8 %] -[%- USE L %] +[%- USE L %][%- USE P -%]

[% title %]

@@ -10,21 +10,7 @@ - + @@ -68,34 +54,12 @@ - + - [% IF SHOW_BUSINESS_TYPES %] + [% IF ALL_BUSINESS_TYPES.as_list.size > 0 %] - + [% END %] @@ -255,10 +219,3 @@
- -- 2.20.1
[% 'Customer' | $T8 %] - [%- INCLUDE 'generic/multibox.html' - name = 'customer', - default = oldcustomer, - style = 'width: 250px', - DATA = ALL_VC, - id_sub = 'vc_keys', - label_key = 'name', - select = vc_select, - limit = vclimit, - show_empty = 1, - allow_textbox = 1, - class = 'initial_focus', - -%] - [% L.input_tag("customer", customer, style="width: 250px", class="initial_focus") %]
[% 'Contact Person' | $T8 %]
[% 'Project Number' | $T8 %] - [%- INCLUDE 'generic/multibox.html' - name = 'project_id', - style = "width: 250px", - DATA = ALL_PROJECTS, - id_key = 'id', - label_key = 'projectnumber', - limit = vclimit, - show_empty = 1, - allow_textbox = 0, - -%] - [% P.project_picker("project_id", project_id, style="width: 250px") %]
[% 'Customer type' | $T8 %] - [%- INCLUDE 'generic/multibox.html' - name = 'business_id', - style = "width: 250px", - DATA = ALL_BUSINESS_TYPES, - id_key = 'id', - label_key = 'description', - limit = vclimit, - show_empty = 1, - allow_textbox = 0, - -%] - [% L.select_tag("business_id", ALL_BUSINESS_TYPES, with_empty=1, title_key="description", style="width: 250px") %]