From: Bernd Bleßmann Date: Fri, 8 Oct 2021 11:42:23 +0000 (+0200) Subject: Belege verknüpfen: auch nach Belegnummer filtern können X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~333 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=149efbb1910ebf5e9ada649a4735777376067ab3;p=kivitendo-erp.git Belege verknüpfen: auch nach Belegnummer filtern können --- 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) %]