Controller für Mandantenkonfiguration.
[kivitendo-erp.git] / SL / Controller / ClientConfig.pm
1 package SL::Controller::ClientConfig;
2
3 use strict;
4 use parent qw(SL::Controller::Base);
5
6 use SL::DB::Default;
7 use SL::Helper::Flash;
8
9 __PACKAGE__->run_before('check_auth');
10
11
12 sub action_edit {
13   my ($self, %params) = @_;
14
15   $self->{payment_options} = [ { title => $::locale->text("never"), value => 0 },
16                                { title => $::locale->text("every time"), value => 1 },
17                                { title => $::locale->text("on the same day"), value => 2 }, ];
18
19   $self->{payments_changeable} = SL::DB::Default->get->payments_changeable;
20
21   $self->render('client_config/form', title => $::locale->text('Client Configuration'));
22 }
23
24
25 sub action_save {
26   my ($self, %params) = @_;
27
28   SL::DB::Default->get->update_attributes('payments_changeable' => $::form->{payments_changeable});
29
30   flash_later('info', $::locale->text('Client Configuration saved!'));
31
32   $self->redirect_to(action => 'edit');
33 }
34
35
36 #################### private stuff ##########################
37
38 sub check_auth {
39   $::auth->assert('admin');
40 }
41
42 1;