1 package SL::Controller::Gdpdu;
4 # - depending exclusive checkboses via javascript
8 use parent qw(SL::Controller::Base);
11 use SL::Locale::String qw(t8);
12 use SL::Helper::Flash;
14 use Rose::Object::MakeMethods::Generic (
15 'scalar --get_set_init' => [ qw(from to) ],
18 __PACKAGE__->run_before('check_auth');
23 $self->from(DateTime->today->add(years => -1)->add(days => 1)) if !$self->from;
24 $self->to(DateTime->today) if !$self->to;
26 $self->render('gdpdu/filter', title => t8('GDPDU Export'));
32 if (!$self->check_inputs) {
37 my $gdpdu = SL::GDPDU->new(
38 company => $::instance_conf->get_company,
39 location => $::instance_conf->get_address,
42 all_tables => $::form->{all_tables},
45 my $filename = $gdpdu->generate_export;
47 $self->send_file($filename, name => t8('gdpdu-#1-#2.zip', $self->from->ymd, $self->to->ymd), unlink => 1);
52 sub check_auth { $::auth->assert('report') }
59 if (!$::form->{from}) {
60 my $epoch = DateTime->new(day => 1, month => 1, year => 1900);
61 flash('info', t8('No start date given, setting to #1', $epoch->to_kivitendo));
66 flash('info', t8('No end date given, setting to today'));
67 $self->to(DateTime->today);
73 sub init_from { DateTime->from_kivitendo($::form->{from}) }
74 sub init_to { DateTime->from_kivitendo($::form->{to}) }