Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 75e726e7

Von Sven Schöling vor etwa 11 Jahren hinzugefügt

  • ID 75e726e709d422448c623e139012edb3bce73acc
  • Vorgänger 9d015fd3
  • Nachfolger 7dfa1a54

Projects auf getmodels

Unterschiede anzeigen:

SL/Controller/Project.pm
7 7
use Clone qw(clone);
8 8

  
9 9
use SL::Controller::Helper::GetModels;
10
use SL::Controller::Helper::Paginated;
11
use SL::Controller::Helper::Sorted;
12
use SL::Controller::Helper::Filtered;
13 10
use SL::Controller::Helper::ParseFilter;
14 11
use SL::Controller::Helper::ReportGenerator;
15 12
use SL::CVar;
......
25 22
use Rose::Object::MakeMethods::Generic
26 23
(
27 24
 scalar => [ qw(project linked_records) ],
25
 'scalar --get_set_init' => [ qw(models) ],
28 26
);
29 27

  
30 28
__PACKAGE__->run_before('check_auth');
31 29
__PACKAGE__->run_before('load_project', only => [ qw(edit update destroy) ]);
32 30

  
33
__PACKAGE__->make_filtered(
34
  MODEL         => 'Project',
35
  LAUNDER_TO    => 'filter',
36
  ONLY          => [ qw(list) ],
37
);
38
__PACKAGE__->make_paginated(
39
  MODEL         => 'Project',
40
#  PAGINATE_ARGS => 'db_args',
41
  ONLY          => [ qw(list) ],
42
);
43

  
44
__PACKAGE__->make_sorted(
45
  MODEL         => 'Project',
46
  ONLY          => [ qw(list) ],
47

  
48
  DEFAULT_BY    => 'projectnumber',
49
  DEFAULT_DIR   => 1,
50

  
51
  customer      => t8('Customer'),
52
  description   => t8('Description'),
53
  projectnumber => t8('Project Number'),
54
  type          => t8('Type'),
55
);
56

  
57

  
58 31
#
59 32
# actions
60 33
#
......
78 51

  
79 52
  # $self->make_filter_summary;
80 53

  
81
  my $projects = $self->get_models(
82
    with_objects => [ 'customer' ],
83
  );
54
  my $projects = $self->models->get;
84 55

  
85 56
  $self->prepare_report;
86 57

  
......
210 181
sub prepare_report {
211 182
  my ($self)      = @_;
212 183

  
213
  my $callback    = $self->get_callback;
184
  my $callback    = $self->models->get_callback;
214 185

  
215 186
  my $report      = SL::ReportGenerator->new(\%::myconfig, $::form);
216 187
  $self->{report} = $report;
......
229 200
                       text => $::locale->text('Valid')  },
230 201
  );
231 202

  
232
  map { $column_defs{$_}->{text} ||= $::locale->text( $self->get_sort_spec->{$_}->{title} ) } keys %column_defs;
203
  map { $column_defs{$_}->{text} ||= $::locale->text( $self->models->get_sort_spec->{$_}->{title} ) } keys %column_defs;
233 204

  
234 205
  $report->set_options(
235 206
    std_column_visibility => 1,
......
245 216
  $report->set_column_order(@columns);
246 217
  $report->set_export_options(qw(list filter));
247 218
  $report->set_options_from_form;
248
  $self->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable);
219
  $self->models->disable_pagination if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
220
  $self->models->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable);
221
  $report->set_options(
222
    top_info_text         => $::locale->text('Projects'),
223
    raw_bottom_info_text  => $self->render('project/report_bottom', { output => 0 }),
224
  );
225
}
249 226

  
250
  $self->disable_pagination if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
227
sub init_models {
228
  my ($self) = @_;
229

  
230
  SL::Controller::Helper::GetModels->new(
231
    controller => $self,
232
    model  => 'Project',
233
    sorted => {
234
      _default => {
235
        by    => 'projectnumber',
236
        dir   => 1,
237
      },
238
      customer      => t8('Customer'),
239
      description   => t8('Description'),
240
      projectnumber => t8('Project Number'),
241
      type          => t8('Type'),
242
    },
243
    with_objects => [ 'customer' ],
244
  );
251 245
}
252 246

  
253 247
1;
templates/webpages/project/report_bottom.html
1 1
[% USE L %]
2
[%- L.paginate_controls %]
2
[%- L.paginate_controls(models=SELF.models) %]

Auch abrufbar als: Unified diff