X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/342d55f7174ada9dfa2bfc16c74e37284f8b13ab..678f57a3852524663977b8903c47404070d17469:/SL/Controller/PriceRule.pm diff --git a/SL/Controller/PriceRule.pm b/SL/Controller/PriceRule.pm index 82d5d858f..c77a2da48 100644 --- a/SL/Controller/PriceRule.pm +++ b/SL/Controller/PriceRule.pm @@ -37,7 +37,7 @@ sub action_list { $self->prepare_report; - $self->report_generator_list_objects(report => $self->{report}, objects => $price_rules); + $self->report_generator_list_objects(report => $self->{report}, objects => $price_rules, $::form->{inline} ? (layout => 0, header => 0) : ()); } sub action_new { @@ -145,8 +145,8 @@ sub prepare_report { my $report = SL::ReportGenerator->new(\%::myconfig, $::form); $self->{report} = $report; - my @columns = qw(name type priority price discount); - my @sortable = qw(name type priority price discount); + my @columns = qw(name type priority price discount items); + my @sortable = qw(name type priority price discount ); my %column_defs = ( name => { obj_link => sub { $self->url_for(action => 'edit', 'price_rule.id' => $_[0]->id, callback => $callback) } }, @@ -154,6 +154,7 @@ sub prepare_report { price => { sub => sub { $_[0]->price_as_number } }, discount => { sub => sub { $_[0]->discount_as_number } }, obsolete => { sub => sub { $_[0]->obsolete_as_bool_yn } }, + items => { sub => sub { $_[0]->item_summary } }, ); map { $column_defs{$_}->{text} ||= $::locale->text( $self->models->get_sort_spec->{$_}->{title} ) } keys %column_defs; @@ -166,13 +167,14 @@ sub prepare_report { controller_class => 'PriceRule', output_format => 'HTML', title => ($self->vc eq 'customer' ? t8('Sales Price Rules') : t8('Purchase Price Rules')) , - allow_pdf_export => 1, - allow_csv_export => 1, + allow_pdf_export => !$::form->{inline}, + allow_csv_export => !$::form->{inline}, ); $report->set_columns(%column_defs); $report->set_column_order(@columns); $report->set_export_options(qw(list filter)); $report->set_options_from_form; + $self->models->get_models_url_params(sub{ map { $_ => $::form->{$_} } qw(inline) }); $self->models->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable); $report->set_options( raw_bottom_info_text => $self->render('price_rule/report_bottom', { output => 0 }), @@ -196,11 +198,17 @@ sub make_filter_summary { push @filter_strings, "$_->[1]: $_->[0]" if $_->[0]; } + if ($filter->{has_item_type}) { + push @filter_strings, sprintf "%s: %s", t8('Has item type'), join ', ', map { + SL::DB::Manager::PriceRuleItem->get_type($_)->{description} + } @{ $filter->{has_item_type} || [] }; + } + $self->{filter_summary} = join ', ', @filter_strings; } sub all_price_rule_item_types { - SL::DB::Manager::PriceRuleItem->get_all_types($_[0]->price_rule->type); + SL::DB::Manager::PriceRuleItem->get_all_types($_[0]->vc || $_[0]->price_rule->type); } sub add_javascripts { @@ -262,6 +270,7 @@ sub init_models { price => t8('Price'), discount => t8('Discount'), obsolete => t8('Obsolete'), + items => t8('Rule Details'), }, ); }