Änderbarkeit und Löschbarkeit von Belegen in Mandantenkonfiguration einstellbar.
[kivitendo-erp.git] / SL / InstanceConfiguration.pm
1 package SL::InstanceConfiguration;
2
3 use strict;
4
5 use SL::DBUtils;
6
7 sub new {
8   my ($class) = @_;
9
10   return bless {}, $class;
11 }
12
13 sub init {
14   my ($self) = @_;
15
16   $self->{data} = selectfirst_hashref_query($::form, $::form->get_standard_dbh, qq|SELECT * FROM defaults|);
17
18   my $curr            =  $self->{data}->{curr} || '';
19   $curr               =~ s/\s+//g;
20   $self->{currencies} =  [ split m/:/, $curr ];
21
22   return $self;
23 }
24
25 sub get_default_currency {
26   my ($self) = @_;
27
28   return ($self->get_currencies)[0];
29 }
30
31 sub get_currencies {
32   my ($self) = @_;
33
34   return $self->{currencies} ? @{ $self->{currencies} } : ();
35 }
36
37 sub get_accounting_method {
38   my ($self) = @_;
39   return $self->{data}->{accounting_method};
40 }
41
42 sub get_inventory_system {
43   my ($self) = @_;
44   return $self->{data}->{inventory_system};
45 }
46
47 sub get_profit_determination {
48   my ($self) = @_;
49   return $self->{data}->{profit_determination};
50 }
51
52 sub get_is_changeable {
53   my ($self) = @_;
54   return $self->{data}->{is_changeable};
55 }
56
57 sub get_ir_changeable {
58   my ($self) = @_;
59   return $self->{data}->{ir_changeable};
60 }
61
62 sub get_ar_changeable {
63   my ($self) = @_;
64   return $self->{data}->{ar_changeable};
65 }
66
67 sub get_ap_changeable {
68   my ($self) = @_;
69   return $self->{data}->{ap_changeable};
70 }
71
72 sub get_gl_changeable {
73   my ($self) = @_;
74   return $self->{data}->{gl_changeable};
75 }
76
77 sub get_datev_check_on_sales_invoice {
78   my ($self) = @_;
79   return $self->{data}->{datev_check_on_sales_invoice};
80 }
81
82 sub get_datev_check_on_purchase_invoice {
83   my ($self) = @_;
84   return $self->{data}->{datev_check_on_purchase_invoice};
85 }
86
87 sub get_datev_check_on_ar_transaction {
88   my ($self) = @_;
89   return $self->{data}->{datev_check_on_ar_transaction};
90 }
91
92 sub get_datev_check_on_ap_transaction {
93   my ($self) = @_;
94   return $self->{data}->{datev_check_on_ap_transaction};
95 }
96
97 sub get_datev_check_on_gl_transaction {
98   my ($self) = @_;
99   return $self->{data}->{datev_check_on_gl_transaction};
100 }
101
102 sub get_show_bestbefore {
103   my ($self) = @_;
104   return $self->{data}->{show_bestbefore};
105 }
106
107 1;
108
109 __END__
110
111 =pod
112
113 =encoding utf8
114
115 =head1 NAME
116
117 SL::InstanceConfiguration - Provide instance-specific configuration data
118
119 =head1 SYNOPSIS
120
121 Lx-Office has two configuration levels: installation specific
122 (provided by the global variable C<%::lx_office_conf>) and instance
123 specific. The latter is provided by a global instance of this class,
124 C<$::instance_conf>.
125
126 =head1 FUNCTIONS
127
128 =over 4
129
130 =item C<new>
131
132 Creates a new instance. Does not read the configuration.
133
134 =item C<init>
135
136 Reads the configuration from the database. Returns C<$self>.
137
138 =item C<get_currencies>
139
140 Returns an array of configured currencies.
141
142 =item C<get_default_currency>
143
144 Returns the default currency or undef if no currency has been
145 configured.
146
147 =item C<get_accounting_method>
148
149 Returns the default accounting method, accrual or cash
150
151 =item C<get_inventory_system>
152
153 Returns the default inventory system, perpetual or periodic
154
155 =item C<get_profit_determination>
156
157 Returns the default profit determination method, balance or income
158
159
160 =item C<get_is_changeable>
161
162 =item C<get_ir_changeable>
163
164 =item C<get_ar_changeable>
165
166 =item C<get_ap_changeable>
167
168 =item C<get_gl_changeable>
169
170 Returns if and when these record types are changeable or deleteable after
171 posting. 0 means never, 1 means always and 2 means on the same day.
172
173 =item C<get_datev_check_on_sales_invoice>
174
175 Returns true if datev check should be performed on sales invoices
176
177 =item C<get_datev_check_on_purchase_invoice>
178
179 Returns true if datev check should be performed on purchase invoices
180
181 =item C<get_datev_check_on_ar_transaction>
182
183 Returns true if datev check should be performed on ar transactions
184
185 =item C<get_datev_check_on_ap_transaction>
186
187 Returns true if datev check should be performed on ap transactions
188
189 =item C<get_datev_check_on_gl_transaction>
190
191 Returns true if datev check should be performed on gl transactions
192
193 =item C<get_show_bestbefore>
194
195 Returns the default behavior for showing best before date, true or false
196
197 =back
198
199 =head1 BUGS
200
201 Updates to the I<defaults> table require that the instance
202 configuration is re-read. This has not been implemented yet.
203
204 =head1 AUTHOR
205
206 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
207
208 =cut