1 package SL::InstanceConfiguration;
8 use parent qw(Rose::Object);
9 use Rose::Object::MakeMethods::Generic (
10 'scalar --get_set_init' => [ qw(data currencies) ],
14 return {} if !$::auth->client;
16 my $dbh = $::form->get_standard_dbh;
17 my $data = SL::DBUtils::selectfirst_hashref_query($::form, $dbh, qq|SELECT * FROM defaults|);
18 $data->{default_currency} = (SL::DBUtils::selectfirst_array_query($::form, $dbh, qq|SELECT name FROM currencies WHERE id = ?|, $data->{currency_id}))[0] if $data->{currency_id};
24 return [] if !$::auth->client;
25 return [ map { $_->{name} } SL::DBUtils::selectall_hashref_query($::form, $::form->get_standard_dbh, qq|SELECT name FROM currencies ORDER BY id ASC|) ];
30 $self->{data} = $self->init_data;
31 $self->{currencies} = $self->init_currencies;
37 return @{ $self->currencies };
44 my $method = $AUTOLOAD;
47 return if $method eq 'DESTROY';
49 if ($method =~ m/^get_/) {
50 $method = substr $method, 4;
51 return $self->data->{$method} if exists $self->data->{$method};
52 croak "Invalid method 'get_${method}'";
55 croak "Invalid method '${method}'" if !$self->can($method);
56 return $self->$method(@_);
69 SL::InstanceConfiguration - Provide instance-specific configuration data
73 kivitendo has two configuration levels: installation specific
74 (provided by the global variable C<%::lx_office_conf>) and instance
75 specific. The latter is provided by a global instance of this class,
84 Creates a new instance. Does not read the configuration.
88 Reads the configuration from the database. Returns C<$self>.
90 =item C<get_currencies>
92 Returns an array of configured currencies.
94 =item C<get_default_currency>
96 Returns the default currency or undef if no currency has been
99 =item C<get_accounting_method>
101 Returns the default accounting method, accrual or cash
103 =item C<get_inventory_system>
105 Returns the default inventory system, perpetual or periodic
107 =item C<get_profit_determination>
109 Returns the default profit determination method, balance or income
112 =item C<get_is_changeable>
114 =item C<get_ir_changeable>
116 =item C<get_ar_changeable>
118 =item C<get_ap_changeable>
120 =item C<get_gl_changeable>
122 Returns if and when these record types are changeable or deleteable after
123 posting. 0 means never, 1 means always and 2 means on the same day.
125 =item C<get_datev_check_on_sales_invoice>
127 Returns true if datev check should be performed on sales invoices
129 =item C<get_datev_check_on_purchase_invoice>
131 Returns true if datev check should be performed on purchase invoices
133 =item C<get_datev_check_on_ar_transaction>
135 Returns true if datev check should be performed on ar transactions
137 =item C<get_datev_check_on_ap_transaction>
139 Returns true if datev check should be performed on ap transactions
141 =item C<get_datev_check_on_gl_transaction>
143 Returns true if datev check should be performed on gl transactions
145 =item C<get_show_bestbefore>
147 Returns the default behavior for showing best before date, true or false
149 =item C<get_is_show_mark_as_paid>
151 =item C<get_ir_show_mark_as_paid>
153 =item C<get_ar_show_mark_as_paid>
155 =item C<get_ap_show_mark_as_paid>
157 Returns the default behavior for showing the mark as paid button for the
158 corresponding record type (true or false).
160 =item C<get_sales_order_show_delete>
162 =item C<get_purchase_order_show_delete>
164 =item C<get_sales_delivery_order_show_delete>
166 =item C<get_purchase_delivery_order_show_delete>
168 Returns the default behavior for showing the delete button for the
169 corresponding record type (true or false).
171 =item C<get_warehouse_id>
173 Returns the default warehouse_id
177 Returns the default bin_id
179 =item C<get_warehouse_id_ignore_onhand>
181 Returns the default warehouse_id for transfers without checking the
182 current stock quantity
184 =item C<get_bin_id_ignore_onhand>
186 Returns the default bin_id for transfers without checking the.
187 current stock quantity
191 =item C<get_transfer_default>
193 =item C<get_transfer_default_use_master_default_bin>
195 =item C<get_transfer_default_ignore_onhand>
197 Returns the default behavior for the transfer out default feature (true or false)
199 =item C<get_max_future_booking_interval>
201 Returns the maximum interval value for future bookings
205 Returns the configuration for WebDAV
207 =item C<get_webdav_documents>
209 Returns the configuration for storing documents in the corresponding WebDAV folder
211 =item C<get_vertreter>
213 Returns the configuration for "vertreter"
215 =item C<get_parts_show_image>
217 Returns the configuarion for show image in parts
219 =item C<get_parts_image_css>
221 Returns the css format string for images shown in parts
223 =item C<get_parts_listing_image>
225 Returns the configuartion for showing the picture in the results when you search for parts
231 Updates to the I<defaults> table require that the instance
232 configuration is re-read. This has not been implemented yet.
236 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>