From: Jan Büren Date: Mon, 3 Nov 2014 18:47:40 +0000 (+0100) Subject: DeliveryPlan - kleinere Details verbesert X-Git-Tag: release-3.2.0beta~282 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d827669e7276da1a37906454acd20e24362d8174;p=kivitendo-erp.git DeliveryPlan - kleinere Details verbesert a) SQL-sanitize $vc param b) Syntaxfehler in Template c) SELF.vc leicht sinnvoller als nur $vc d) Column defs mit visible an- und ausschalten, bzw. hotfix für heute --- diff --git a/SL/Controller/DeliveryPlan.pm b/SL/Controller/DeliveryPlan.pm index 6b16634dc..1ea6d7c7c 100644 --- a/SL/Controller/DeliveryPlan.pm +++ b/SL/Controller/DeliveryPlan.pm @@ -8,6 +8,7 @@ use SL::DB::OrderItem; use SL::Controller::Helper::GetModels; use SL::Controller::Helper::ReportGenerator; use SL::Locale::String; +use Carp; use Rose::Object::MakeMethods::Generic ( scalar => [ qw(db_args flat_filter) ], @@ -50,8 +51,9 @@ sub prepare_report { my $report = SL::ReportGenerator->new(\%::myconfig, $::form); $self->{report} = $report; - my @columns = qw(reqdate customer ordnumber partnumber description qty shipped_qty not_shipped_qty delivered_qty value_of_goods); - my @sortable = qw(reqdate customer ordnumber partnumber description); + my @columns = qw(reqdate customer vendor ordnumber partnumber description qty shipped_qty not_shipped_qty delivered_qty value_of_goods); + + my @sortable = qw(reqdate customer vendor ordnumber partnumber description); my %column_defs = ( reqdate => { sub => sub { $_[0]->reqdate_as_date || $_[0]->order->reqdate_as_date } }, @@ -65,14 +67,28 @@ sub prepare_report { delivered_qty => { sub => sub { $::form->format_amount(\%::myconfig, $_[0]->delivered_qty, 2) . ' ' . $_[0]->unit } }, ordnumber => { sub => sub { $_[0]->order->ordnumber }, obj_link => sub { $self->link_to($_[0]->order) } }, - $vc => { sub => sub { $_[0]->order->$vc->name }, - obj_link => sub { $self->link_to($_[0]->order->$vc) } }, + #vendor => { sub => sub { $_[0]->order->vendor->name }, + # obj_link => sub { $self->link_to($_[0]->order->vendor) } }, + #customer => { sub => sub { $_[0]->order->customer->name }, + # obj_link => sub { $self->link_to($_[0]->order->customer) } }, ); # add value of goods in report if ($main::auth->assert('sales_order_edit') && $::instance_conf->get_delivery_plan_show_value_of_goods) { $column_defs{value_of_goods} = { sub => sub { $::form->format_amount(\%::myconfig, $_[0]->value_of_goods, 2) . ' ' . $_[0]->taxincluded } }; } + + # hotfix for today + # if visible is not working + if ($vc eq 'customer') { + $column_defs{customer} = { sub => sub { $_[0]->order->customer->name }, + obj_link => sub { $self->link_to($_[0]->order->customer) } }; + } + if ($vc eq 'vendor') { + $column_defs{vendor} = { sub => sub { $_[0]->order->vendor->name }, + obj_link => sub { $self->link_to($_[0]->order->vendor) } }, + } + $column_defs{$_}->{text} = $sort_columns{$_} for keys %column_defs; $report->set_options( @@ -112,8 +128,10 @@ sub make_filter_summary { [ $filter->{"reqdate:date::ge"}, $::locale->text('Delivery Date') . " " . $::locale->text('From Date') ], [ $filter->{"reqdate:date::le"}, $::locale->text('Delivery Date') . " " . $::locale->text('To Date') ], [ $filter->{"qty:number"}, $::locale->text('Quantity') ], - [ $filter->{order}{$vc}{"name:substr::ilike"}, ($vc eq 'customer') ? $::locale->text('Customer') : $::locale->text('Vendor') ], - [ $filter->{order}{$vc}{"${vc}number:substr::ilike"}, ($vc eq 'customer') ? $::locale->text('Customer Number') : $::locale->text('Vendor Number') ], + [ $filter->{order}{vendor}{"name:substr::ilike"}, $::locale->text('Vendor') ], + [ $filter->{order}{vendor}{"vendornumber:substr::ilike"}, $::locale->text('Vendor Number') ], + [ $filter->{order}{customer}{"name:substr::ilike"}, $::locale->text('Customer') ], + [ $filter->{order}{customer}{"customernumber:substr::ilike"}, $::locale->text('Customer Number') ], ); my %flags = ( @@ -264,7 +282,7 @@ sub init_all_edit_right { $::auth->assert('sales_all_edit', 1) } sub init_vc { - return $::form->{vc} || croak "self (DeliveryPlan) has no vc defined"; + return $::form->{vc} if ($::form->{vc} eq 'customer' || $::form->{vc} eq 'vendor') || croak "self (DeliveryPlan) has no vc defined"; } sub link_to { diff --git a/templates/webpages/delivery_plan/_filter.html b/templates/webpages/delivery_plan/_filter.html index 602c8650c..402da6341 100644 --- a/templates/webpages/delivery_plan/_filter.html +++ b/templates/webpages/delivery_plan/_filter.html @@ -36,7 +36,7 @@ [% IF vc == 'customer' %] - [% Customer | $T8 %] + [% 'Customer' | $T8 %] [% L.input_tag('filter.order.customer.name:substr::ilike', filter.order.customer.name_substr__ilike, size = 20) %] @@ -44,7 +44,7 @@ [% L.input_tag('filter.order.customer.customernumber:substr::ilike', filter.order.customer.customernumber_substr__ilike, size = 20) %] [% ELSE %] - [% Vendor | $T8 %] + [% 'Vendor' | $T8 %] [% L.input_tag('filter.order.vendor.name:substr::ilike', filter.order.vendor.name_substr__ilike, size = 20) %] @@ -66,7 +66,7 @@ [% L.hidden_tag('sort_by', FORM.sort_by) %] [% L.hidden_tag('sort_dir', FORM.sort_dir) %] [% L.hidden_tag('page', FORM.page) %] -[% L.hidden_tag('vc', vc) %] +[% L.hidden_tag('vc', SELF.vc) %] [% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]