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 if ($method =~ m/^get_/) {
48 $method = substr $method, 4;
49 return $self->data->{$method} if exists $self->data->{$method};
50 croak "Invalid method 'get_${method}'";
53 croak "Invalid method '${method}'" if !$self->can($method);
54 return $self->$method(@_);
67 SL::InstanceConfiguration - Provide instance-specific configuration data
71 kivitendo has two configuration levels: installation specific
72 (provided by the global variable C<%::lx_office_conf>) and instance
73 specific. The latter is provided by a global instance of this class,
82 Creates a new instance. Does not read the configuration.
86 Reads the configuration from the database. Returns C<$self>.
88 =item C<get_currencies>
90 Returns an array of configured currencies.
92 =item C<get_default_currency>
94 Returns the default currency or undef if no currency has been
97 =item C<get_accounting_method>
99 Returns the default accounting method, accrual or cash
101 =item C<get_inventory_system>
103 Returns the default inventory system, perpetual or periodic
105 =item C<get_profit_determination>
107 Returns the default profit determination method, balance or income
110 =item C<get_is_changeable>
112 =item C<get_ir_changeable>
114 =item C<get_ar_changeable>
116 =item C<get_ap_changeable>
118 =item C<get_gl_changeable>
120 Returns if and when these record types are changeable or deleteable after
121 posting. 0 means never, 1 means always and 2 means on the same day.
123 =item C<get_datev_check_on_sales_invoice>
125 Returns true if datev check should be performed on sales invoices
127 =item C<get_datev_check_on_purchase_invoice>
129 Returns true if datev check should be performed on purchase invoices
131 =item C<get_datev_check_on_ar_transaction>
133 Returns true if datev check should be performed on ar transactions
135 =item C<get_datev_check_on_ap_transaction>
137 Returns true if datev check should be performed on ap transactions
139 =item C<get_datev_check_on_gl_transaction>
141 Returns true if datev check should be performed on gl transactions
143 =item C<get_show_bestbefore>
145 Returns the default behavior for showing best before date, true or false
147 =item C<get_is_show_mark_as_paid>
149 =item C<get_ir_show_mark_as_paid>
151 =item C<get_ar_show_mark_as_paid>
153 =item C<get_ap_show_mark_as_paid>
155 Returns the default behavior for showing the mark as paid button for the
156 corresponding record type (true or false).
158 =item C<get_sales_order_show_delete>
160 =item C<get_purchase_order_show_delete>
162 =item C<get_sales_delivery_order_show_delete>
164 =item C<get_purchase_delivery_order_show_delete>
166 Returns the default behavior for showing the delete button for the
167 corresponding record type (true or false).
169 =item C<get_default_warehouse_id>
171 Returns the default warehouse_id
173 =item C<get_default_bin_id>
175 Returns the default bin_id
177 =item C<get_default_warehouse_id_ignore_onhand>
179 Returns the default warehouse_id for transfers without checking the
180 current stock quantity
182 =item C<get_default_bin_id_ignore_onhand>
184 Returns the default bin_id for transfers without checking the.
185 current stock quantity
189 =item C<get_transfer_default>
191 =item C<get_transfer_default_use_master_default_bin>
193 =item C<get_transfer_default_ignore_onhand>
195 Returns the default behavior for the transfer out default feature (true or false)
197 =item C<get_max_future_booking_interval>
199 Returns the maximum interval value for future bookings
203 Returns the configuration for webdav
205 =item C<get_webdav_documents>
207 Returns the configuration for storing documents in the corresponding webdav folder
209 =item C<get_vertreter>
211 Returns the configuration for "vertreter"
213 =item C<get_parts_show_image>
215 Returns the configuarion for show image in parts
217 =item C<get_parts_image_css>
219 Returns the css format string for images shown in parts
221 =item C<get_parts_listing_image>
223 Returns the configuartion for showing the picture in the results when you search for parts
229 Updates to the I<defaults> table require that the instance
230 configuration is re-read. This has not been implemented yet.
234 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>