From 149efbb1910ebf5e9ada649a4735777376067ab3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Fri, 8 Oct 2021 13:42:23 +0200 Subject: [PATCH] =?utf8?q?Belege=20verkn=C3=BCpfen:=20auch=20nach=20Belegn?= =?utf8?q?ummer=20filtern=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/RecordLinks.pm | 11 +++++++++++ templates/webpages/record_links/add_filter.html | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/SL/Controller/RecordLinks.pm b/SL/Controller/RecordLinks.pm index eec3ce20e..3e8f028e5 100644 --- a/SL/Controller/RecordLinks.pm +++ b/SL/Controller/RecordLinks.pm @@ -132,6 +132,7 @@ sub action_ajax_add_list { my $project_id = "${project}_id"; my $description = $self->link_type_desc->{description}; my $filter = $self->link_type_desc->{filter}; + my $number = $self->link_type_desc->{number}; my @where = $filter && $manager->can($filter) ? $manager->$filter($self->link_type) : (); push @where, ("${vc}.${vc}number" => { ilike => like($::form->{vc_number}) }) if $::form->{vc_number}; @@ -139,6 +140,16 @@ sub action_ajax_add_list { push @where, ($description => { ilike => like($::form->{transaction_description}) }) if $::form->{transaction_description}; push @where, ($project_id => $::form->{globalproject_id}) if $::form->{globalproject_id} && $manager->can($project_id); + if ($::form->{number}) { + my $class = 'SL::DB::' . $self->link_type_desc->{model}; + my $col_type = ref $class->meta->column($number); + if ($col_type =~ /^Rose::DB::Object::Metadata::Column::(?:Integer|Serial)$/) { + push @where, ($number => $::form->{number}); + } elsif ($col_type =~ /^Rose::DB::Object::Metadata::Column::Text$/) { + push @where, ($number => { ilike => like($::form->{number}) }); + } + } + my @with_objects = ($vc); push @with_objects, $project if $manager->can($project_id); diff --git a/templates/webpages/record_links/add_filter.html b/templates/webpages/record_links/add_filter.html index 04346b5f0..d9b02093e 100644 --- a/templates/webpages/record_links/add_filter.html +++ b/templates/webpages/record_links/add_filter.html @@ -21,6 +21,11 @@ style=style) %] + + [%- LxERP.t8("Record number") %]: + [% L.input_tag('number', '', style=style) %] + + [%- LxERP.t8("Customer/Vendor Number") %]: [% L.input_tag('vc_number', is_sales ? SELF.object.customer.customernumber : SELF.object.vendor.vendornumber, style=style) %] -- 2.20.1