Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6aa91d87

Von Tamino Steinert vor 5 Tagen hinzugefügt

  • ID 6aa91d87a08278d91d6dafc7b5443af6229b1e20
  • Vorgänger a5dff514
  • Nachfolger dfdfb88c

S:Presenter:Filter: Separaten Presenter für komplexe Berichtsfilter

Unterschiede anzeigen:

SL/Controller/Reclamation.pm
6 6
use SL::Helper::Flash qw(flash_later);
7 7
use SL::HTML::Util;
8 8
use SL::Presenter::Tag qw(select_tag hidden_tag div_tag);
9
use SL::Presenter::ReclamationFilter qw(filter);
9
use SL::Presenter::Filter::Reclamation;
10 10
use SL::Locale::String qw(t8);
11 11
use SL::SessionFile::Random;
12 12
use SL::PriceSource;
......
216 216
sub action_list {
217 217
  my ($self) = @_;
218 218

  
219
  $::form->{filter} ||= {};
220

  
219 221
  $self->_setup_search_action_bar;
220
  $self->prepare_report;
222
  my $report = $self->prepare_report;
221 223
  $self->report_generator_list_objects(
222
    report => $self->{report},
224
    report => $report,
223 225
    objects => $self->models->get,
224 226
    options => {
225 227
      action_bar_additional_submit_values => {
......
1186 1188
      closed                  => t8('Closed'),
1187 1189
    },
1188 1190
    query => [
1189
      SL::DB::Manager::Reclamation->type_filter($self->type),
1191
      (record_type => $self->type),
1190 1192
      (salesman_id => SL::DB::Manager::Employee->current->id) x ($self->reclamation->is_sales  && !$::auth->assert('sales_all_edit', 1)),
1191 1193
      (employee_id => SL::DB::Manager::Employee->current->id) x ($self->reclamation->is_sales  && !$::auth->assert('sales_all_edit', 1)),
1192 1194
      (employee_id => SL::DB::Manager::Employee->current->id) x (!$self->reclamation->is_sales && !$::auth->assert('purchase_all_edit', 1)),
......
1672 1674
  my ($self)         = @_;
1673 1675

  
1674 1676
  my $report         =  SL::ReportGenerator->new(\%::myconfig, $::form);
1675
  $report->{title}   =  t8('Sales Reclamations');
1676
  if ($self->type eq PURCHASE_RECLAMATION_TYPE()){
1677
    $report->{title} = t8('Purchase Reclamations');
1678
  }
1679 1677

  
1680 1678
  $self->models->disable_plugin('paginated') if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
1681 1679
  $self->models->add_additional_url_params(type => $self->type);
......
1683 1681

  
1684 1682
  my $callback    = $self->models->get_callback;
1685 1683

  
1686
  $self->{report} = $report;
1687

  
1688 1684
  # TODO: shipto_id is not linked to custom_shipto
1689 1685
  my @columns_order = qw(
1690 1686
    id
......
1892 1888
  unless ($::form->{active_in_report}) {
1893 1889
    $::form->{active_in_report}->{$_} = 1 foreach @default_columns;
1894 1890
  }
1891

  
1895 1892
  $self->models->add_additional_url_params(
1896
    active_in_report => $::form->{active_in_report});
1897
  map { $column_defs{$_}->{visible} = $::form->{active_in_report}->{"$_"} }
1898
    keys %column_defs;
1893
    active_in_report => $::form->{active_in_report}
1894
  );
1895

  
1896
  $column_defs{$_}->{visible} = $::form->{active_in_report}->{"$_"} || 0
1897
    foreach keys %column_defs;
1899 1898

  
1900 1899
  ## add cvars TODO: Add own cvars
1901 1900
  #my %cvar_column_defs = map {
......
1915 1914
  # make all sortable
1916 1915
  my @sortable = keys %column_defs;
1917 1916

  
1918
  my $filter_html = SL::Presenter::ReclamationFilter::filter(
1917
  my $filter_html = SL::Presenter::Filter::Reclamation::filter(
1919 1918
    $::form->{filter}, $self->type, active_in_report => $::form->{active_in_report}
1920 1919
  );
1921 1920

  
......
1940 1939
  $report->set_columns(%column_defs);
1941 1940
  $report->set_column_order(@columns_order);
1942 1941
  #$report->set_export_options(qw(list filter), @cvar_column_form_names); TODO: for cvars
1943
  $report->set_export_options(qw(list filter active_in_report));
1942
  $report->set_export_options('list', qw(filter active_in_report));
1944 1943
  $report->set_options_from_form;
1945 1944
  $self->models->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable);
1945

  
1946
  return $report;
1946 1947
}
1947 1948

  
1948 1949
sub _setup_edit_action_bar {
......
2139 2140
    $bar->add(
2140 2141
      action => [
2141 2142
        t8('Update'),
2142
        submit    => [ '#search_form', { action => 'Reclamation/list', type => $self->type } ],
2143
        submit    => [ '#filter_form', { action => 'Reclamation/list', type => $self->type } ],
2143 2144
        accesskey => 'enter',
2144 2145
      ],
2145 2146
      link => [

Auch abrufbar als: Unified diff