From: Bernd Bleßmann Date: Mon, 1 Feb 2016 15:45:22 +0000 (+0100) Subject: Auftrags-Controller: Preisfaktor berücksichtigen X-Git-Tag: release-3.4.1~328 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=32951b1fd055b51e0f8e4d5896f4cc98258eec50;p=kivitendo-erp.git Auftrags-Controller: Preisfaktor berücksichtigen --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index eba061c08..6e88036e8 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -21,6 +21,7 @@ use SL::DB::Project; use SL::DB::Default; use SL::DB::Unit; use SL::DB::Price; +use SL::DB::PriceFactor; use SL::DB::Part; use SL::DB::Printer; use SL::DB::Language; @@ -39,7 +40,7 @@ use File::Spec; use Rose::Object::MakeMethods::Generic ( scalar => [ qw(item_ids_to_delete) ], - 'scalar --get_set_init' => [ qw(order valid_types type cv p multi_items_models) ], + 'scalar --get_set_init' => [ qw(order valid_types type cv p multi_items_models all_price_factors) ], ); @@ -413,7 +414,11 @@ sub action_add_item { $self->_recalc(); my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000); - my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $item, ID => $item_id); + my $row_as_html = $self->p->render('order/tabs/_row', + ITEM => $item, + ID => $item_id, + ALL_PRICE_FACTORS => $self->all_price_factors + ); $self->js ->append('#row_table_id', $row_as_html) @@ -472,7 +477,11 @@ sub action_add_multi_items { foreach my $item (@items) { my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000); - my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $item, ID => $item_id); + my $row_as_html = $self->p->render('order/tabs/_row', + ITEM => $item, + ID => $item_id, + ALL_PRICE_FACTORS => $self->all_price_factors + ); $self->js ->append('#row_table_id', $row_as_html) @@ -629,6 +638,10 @@ sub init_multi_items_models { ); } +sub init_all_price_factors { + SL::DB::Manager::PriceFactor->get_all; +} + sub _check_auth { my ($self) = @_; @@ -797,8 +810,9 @@ sub _new_item { my %new_attr; $new_attr{part} = $part; - $new_attr{description} = $part->description if ! $item->description; - $new_attr{qty} = 1.0 if ! $item->qty; + $new_attr{description} = $part->description if ! $item->description; + $new_attr{qty} = 1.0 if ! $item->qty; + $new_attr{price_factor_id} = $part->price_factor_id if ! $item->price_factor_id; $new_attr{sellprice} = $price_src->price; $new_attr{discount} = $discount_src->discount; $new_attr{active_price_source} = $price_src; diff --git a/templates/webpages/order/tabs/_row.html b/templates/webpages/order/tabs/_row.html index bfd14cc3f..af035993f 100644 --- a/templates/webpages/order/tabs/_row.html +++ b/templates/webpages/order/tabs/_row.html @@ -40,10 +40,12 @@ class="recalc reformat_number numeric") %] - [%- L.input_tag("order.orderitems[].price_factor", - ITEM.price_factor, - size = 5, - class="recalc numeric") %] + [%- L.select_tag("order.orderitems[].price_factor_id", + ALL_PRICE_FACTORS, + default = ITEM.price_factor_id, + title_key = 'description', + with_empty = 1, + class="recalc") %] [%- L.select_tag("order.orderitems[].unit", diff --git a/templates/webpages/order/tabs/basic_data.html b/templates/webpages/order/tabs/basic_data.html index b3c9fa050..7732c2288 100644 --- a/templates/webpages/order/tabs/basic_data.html +++ b/templates/webpages/order/tabs/basic_data.html @@ -172,7 +172,7 @@ [%- FOREACH item = SELF.order.items_sorted %] - [%- PROCESS order/tabs/_row.html ITEM=item ID=item.id %] + [%- PROCESS order/tabs/_row.html ITEM=item ID=item.id ALL_PRICE_FACTORS=SELF.all_price_factors %] [%- END %]