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 my $dbh = $::form->get_standard_dbh;
15 my $data = SL::DBUtils::selectfirst_hashref_query($::form, $dbh, qq|SELECT * FROM defaults|);
16 $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};
22 return [ map { $_->{name} } SL::DBUtils::selectall_hashref_query($::form, $::form->get_standard_dbh, qq|SELECT name FROM currencies ORDER BY id ASC|) ];
27 $self->{data} = $self->init_data;
28 $self->{currencies} = $self->init_currencies;
34 return @{ $self->currencies };
41 my $method = $AUTOLOAD;
44 if ($method =~ m/^get_/) {
45 $method = substr $method, 4;
46 return $self->data->{$method} if exists $self->data->{$method};
47 croak "Invalid method 'get_${method}'";
50 croak "Invalid method '${method}'" if !$self->can($method);
51 return $self->$method(@_);
64 SL::InstanceConfiguration - Provide instance-specific configuration data
68 kivitendo has two configuration levels: installation specific
69 (provided by the global variable C<%::lx_office_conf>) and instance
70 specific. The latter is provided by a global instance of this class,
79 Creates a new instance. Does not read the configuration.
83 Reads the configuration from the database. Returns C<$self>.
85 =item C<get_currencies>
87 Returns an array of configured currencies.
89 =item C<get_default_currency>
91 Returns the default currency or undef if no currency has been
94 =item C<get_accounting_method>
96 Returns the default accounting method, accrual or cash
98 =item C<get_inventory_system>
100 Returns the default inventory system, perpetual or periodic
102 =item C<get_profit_determination>
104 Returns the default profit determination method, balance or income
107 =item C<get_is_changeable>
109 =item C<get_ir_changeable>
111 =item C<get_ar_changeable>
113 =item C<get_ap_changeable>
115 =item C<get_gl_changeable>
117 Returns if and when these record types are changeable or deleteable after
118 posting. 0 means never, 1 means always and 2 means on the same day.
120 =item C<get_datev_check_on_sales_invoice>
122 Returns true if datev check should be performed on sales invoices
124 =item C<get_datev_check_on_purchase_invoice>
126 Returns true if datev check should be performed on purchase invoices
128 =item C<get_datev_check_on_ar_transaction>
130 Returns true if datev check should be performed on ar transactions
132 =item C<get_datev_check_on_ap_transaction>
134 Returns true if datev check should be performed on ap transactions
136 =item C<get_datev_check_on_gl_transaction>
138 Returns true if datev check should be performed on gl transactions
140 =item C<get_show_bestbefore>
142 Returns the default behavior for showing best before date, true or false
144 =item C<get_is_show_mark_as_paid>
146 =item C<get_ir_show_mark_as_paid>
148 =item C<get_ar_show_mark_as_paid>
150 =item C<get_ap_show_mark_as_paid>
152 Returns the default behavior for showing the mark as paid button for the
153 corresponding record type (true or false).
155 =item C<get_sales_order_show_delete>
157 =item C<get_purchase_order_show_delete>
159 =item C<get_sales_delivery_order_show_delete>
161 =item C<get_purchase_delivery_order_show_delete>
163 Returns the default behavior for showing the delete button for the
164 corresponding record type (true or false).
166 =item C<get_default_warehouse_id>
168 Returns the default warehouse_id
170 =item C<get_default_bin_id>
172 Returns the default bin_id
174 =item C<get_default_warehouse_id_ignore_onhand>
176 Returns the default warehouse_id for transfers without checking the
177 current stock quantity
179 =item C<get_default_bin_id_ignore_onhand>
181 Returns the default bin_id for transfers without checking the.
182 current stock quantity
186 =item C<get_transfer_default>
188 =item C<get_transfer_default_use_master_default_bin>
190 =item C<get_transfer_default_ignore_onhand>
192 Returns the default behavior for the transfer out default feature (true or false)
194 =item C<get_max_future_booking_interval>
196 Returns the maximum interval value for future bookings
200 Returns the configuration for webdav
202 =item C<get_webdav_documents>
204 Returns the configuration for storing documents in the corresponding webdav folder
206 =item C<get_vertreter>
208 Returns the configuration for "vertreter"
210 =item C<get_parts_show_image>
212 Returns the configuarion for show image in parts
214 =item C<get_parts_image_css>
216 Returns the css format string for images shown in parts
218 =item C<get_parts_listing_image>
220 Returns the configuartion for showing the picture in the results when you search for parts
226 Updates to the I<defaults> table require that the instance
227 configuration is re-read. This has not been implemented yet.
231 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>