From: Moritz Bunkus Date: Wed, 10 Feb 2021 10:49:50 +0000 (+0100) Subject: Order-Controller: Artikelklassifizierung berücksichtigen X-Git-Tag: kivitendo-mebil_0.1-0~9^2~481 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1b7759ed7c474adef6eb75b6cc04431768fff8c3;p=kivitendo-erp.git Order-Controller: Artikelklassifizierung berücksichtigen --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 72a27ae85..d8887e03c 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -17,6 +17,7 @@ use SL::DB::Order; use SL::DB::Default; use SL::DB::Unit; use SL::DB::Part; +use SL::DB::PartClassification; use SL::DB::PartsGroup; use SL::DB::Printer; use SL::DB::Language; @@ -43,7 +44,7 @@ use Sort::Naturally; use Rose::Object::MakeMethods::Generic ( scalar => [ qw(item_ids_to_delete is_custom_shipto_to_delete) ], - 'scalar --get_set_init' => [ qw(order valid_types type cv p all_price_factors search_cvpartnumber show_update_button) ], + 'scalar --get_set_init' => [ qw(order valid_types type cv p all_price_factors search_cvpartnumber show_update_button part_picker_classification_ids) ], ); @@ -1170,6 +1171,13 @@ sub init_all_price_factors { SL::DB::Manager::PriceFactor->get_all; } +sub init_part_picker_classification_ids { + my ($self) = @_; + my $attribute = 'used_for_' . ($self->type =~ m{sales} ? 'sale' : 'purchase'); + + return [ map { $_->id } @{ SL::DB::Manager::PartClassification->get_all(where => [ $attribute => 1 ]) } ]; +} + sub check_auth { my ($self) = @_; diff --git a/js/kivi.Part.js b/js/kivi.Part.js index 8daaf8c33..b83fb044d 100644 --- a/js/kivi.Part.js +++ b/js/kivi.Part.js @@ -349,7 +349,7 @@ namespace('kivi.Part', function(ns) { data['filter.obsolete'] = 0; if (this.o.classification_id) - data['filter.classification_id'] = this.o.classification_id.split(','); + data['filter.classification_id:any'] = this.o.classification_id.replaceAll(',', ' '); if (this.o.unit) data['filter.unit'] = this.o.unit.split(','); diff --git a/templates/webpages/order/tabs/_item_input.html b/templates/webpages/order/tabs/_item_input.html index 7d76df2c0..62f5ccf79 100644 --- a/templates/webpages/order/tabs/_item_input.html +++ b/templates/webpages/order/tabs/_item_input.html @@ -23,6 +23,7 @@ fat_set_item=1, multiple_pos_input=1, action={set_multi_items='kivi.Order.add_multi_items'}, + classification_id=SELF.part_picker_classification_ids.as_list.join(','), $PARAM_KEY=PARAM_VAL) %] [% L.input_tag('add_item.description', '', class="add_item_input") %]