2 |
2 |
|
3 |
3 |
use strict;
|
4 |
4 |
|
5 |
|
use SL::DBUtils;
|
|
5 |
use Carp;
|
|
6 |
use SL::DB::Currency;
|
|
7 |
use SL::DB::Default;
|
6 |
8 |
|
7 |
|
sub new {
|
8 |
|
my ($class) = @_;
|
|
9 |
use parent qw(Rose::Object);
|
|
10 |
use Rose::Object::MakeMethods::Generic (
|
|
11 |
'scalar --get_set_init' => [ qw(data currencies) ],
|
|
12 |
);
|
9 |
13 |
|
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|);
|
|
14 |
sub init_data {
|
|
15 |
my $default = SL::DB::Default->get;
|
|
16 |
my $data = { map { $_ => $default->$_ } $default->meta->columns };
|
|
17 |
$data->{default_currency} = $default->currency ? $default->currency->name : undef;
|
17 |
18 |
|
18 |
|
#To get all currencies and the default currency:
|
19 |
|
($self->{data}->{curr}) = selectrow_query($::form, $::form->get_standard_dbh, qq|SELECT name AS curr FROM currencies WHERE id = (SELECT currency_id FROM defaults)|);
|
20 |
|
$self->{currencies} = [ map { $_->{name} } selectall_hashref_query($::form, $::form->get_standard_dbh, qq|SELECT name FROM currencies ORDER BY id|) ];
|
21 |
|
|
22 |
|
return $self;
|
|
19 |
return $data;
|
23 |
20 |
}
|
24 |
21 |
|
25 |
|
sub get_default_currency {
|
26 |
|
my ($self) = @_;
|
27 |
|
|
28 |
|
return $self->{data}->{curr};
|
|
22 |
sub init_currencies {
|
|
23 |
return [ map { $_->name } @{ SL::DB::Manager::Currency->get_all_sorted } ];
|
29 |
24 |
}
|
30 |
25 |
|
31 |
|
sub get_currencies {
|
32 |
|
my ($self) = @_;
|
33 |
|
|
34 |
|
return @{ $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 |
|
sub get_is_show_mark_as_paid {
|
108 |
|
my ($self) = @_;
|
109 |
|
return $self->{data}->{is_show_mark_as_paid};
|
110 |
|
}
|
111 |
|
|
112 |
|
sub get_ir_show_mark_as_paid {
|
113 |
|
my ($self) = @_;
|
114 |
|
return $self->{data}->{ir_show_mark_as_paid};
|
115 |
|
}
|
116 |
|
|
117 |
|
sub get_ar_show_mark_as_paid {
|
118 |
|
my ($self) = @_;
|
119 |
|
return $self->{data}->{ar_show_mark_as_paid};
|
120 |
|
}
|
121 |
|
|
122 |
|
sub get_ap_show_mark_as_paid {
|
123 |
|
my ($self) = @_;
|
124 |
|
return $self->{data}->{ap_show_mark_as_paid};
|
125 |
|
}
|
126 |
|
|
127 |
|
sub get_sales_order_show_delete {
|
128 |
|
my ($self) = @_;
|
129 |
|
return $self->{data}->{sales_order_show_delete};
|
130 |
|
}
|
131 |
|
|
132 |
|
sub get_purchase_order_show_delete {
|
133 |
|
my ($self) = @_;
|
134 |
|
return $self->{data}->{purchase_order_show_delete};
|
135 |
|
}
|
136 |
|
|
137 |
|
sub get_sales_delivery_order_show_delete {
|
138 |
|
my ($self) = @_;
|
139 |
|
return $self->{data}->{sales_delivery_order_show_delete};
|
140 |
|
}
|
141 |
|
|
142 |
|
sub get_purchase_delivery_order_show_delete {
|
143 |
|
my ($self) = @_;
|
144 |
|
return $self->{data}->{purchase_delivery_order_show_delete};
|
145 |
|
}
|
146 |
|
|
147 |
|
sub get_default_warehouse_id {
|
148 |
|
my ($self) = @_;
|
149 |
|
return ($self->{data}->{warehouse_id});
|
150 |
|
}
|
151 |
|
|
152 |
|
sub get_default_bin_id {
|
153 |
|
my ($self) = @_;
|
154 |
|
return ($self->{data}->{bin_id});
|
155 |
|
}
|
156 |
|
sub get_default_warehouse_id_ignore_onhand {
|
157 |
|
my ($self) = @_;
|
158 |
|
return ($self->{data}->{warehouse_id_ignore_onhand});
|
159 |
|
}
|
160 |
|
|
161 |
|
sub get_default_bin_id_ignore_onhand {
|
162 |
|
my ($self) = @_;
|
163 |
|
return ($self->{data}->{bin_id_ignore_onhand});
|
164 |
|
}
|
165 |
|
|
166 |
|
|
167 |
|
sub get_transfer_default {
|
168 |
|
my ($self) = @_;
|
169 |
|
return ($self->{data}->{transfer_default});
|
170 |
|
}
|
171 |
|
|
172 |
|
sub get_transfer_default_use_master_default_bin {
|
173 |
|
my ($self) = @_;
|
174 |
|
return ($self->{data}->{transfer_default_use_master_default_bin});
|
175 |
|
}
|
176 |
|
|
177 |
|
sub get_transfer_default_ignore_onhand {
|
178 |
|
my ($self) = @_;
|
179 |
|
return ($self->{data}->{transfer_default_ignore_onhand});
|
180 |
|
}
|
181 |
|
# currently unused - value is set via audit_control (Bücherkontrolle)
|
182 |
|
sub get_max_future_booking_interval {
|
183 |
|
my ($self) = @_;
|
184 |
|
return ($self->{data}->{max_future_booking_interval});
|
185 |
|
}
|
186 |
|
|
187 |
|
sub get_webdav {
|
188 |
|
my ($self) = @_;
|
189 |
|
return ($self->{data}->{webdav});
|
|
26 |
sub reload {
|
|
27 |
my ($self) = @_;
|
|
28 |
$self->{data} = $self->init_data;
|
|
29 |
$self->{currencies} = $self->init_currencies;
|
|
30 |
return $self;
|
190 |
31 |
}
|
191 |
32 |
|
192 |
|
sub get_webdav_documents {
|
|
33 |
sub get_currencies {
|
193 |
34 |
my ($self) = @_;
|
194 |
|
return ($self->{data}->{webdav_documents});
|
|
35 |
return @{ $self->currencies };
|
195 |
36 |
}
|
196 |
37 |
|
197 |
|
sub get_vertreter {
|
198 |
|
my ($self) = @_;
|
199 |
|
return ($self->{data}->{vertreter});
|
200 |
|
}
|
|
38 |
sub AUTOLOAD {
|
|
39 |
our $AUTOLOAD;
|
201 |
40 |
|
202 |
|
sub get_parts_show_image {
|
203 |
|
my ($self) = @_;
|
204 |
|
return ($self->{data}->{parts_show_image});
|
205 |
|
}
|
|
41 |
my $self = shift;
|
|
42 |
my $method = $AUTOLOAD;
|
|
43 |
$method =~ s/.*:://;
|
206 |
44 |
|
207 |
|
sub get_parts_listing_images{
|
208 |
|
my ($self) = @_;
|
209 |
|
return ($self->{data}->{parts_listing_image});
|
210 |
|
}
|
|
45 |
if ($method =~ m/^get_/) {
|
|
46 |
$method = substr $method, 4;
|
|
47 |
return $self->data->{$method} if exists $self->data->{$method};
|
|
48 |
croak "Invalid method 'get_${method}'";
|
|
49 |
}
|
211 |
50 |
|
212 |
|
sub get_parts_image_css {
|
213 |
|
my ($self) = @_;
|
214 |
|
return ($self->{data}->{parts_image_css});
|
|
51 |
croak "Invalid method '${method}'" if !$self->can($method);
|
|
52 |
return $self->$method(@_);
|
215 |
53 |
}
|
216 |
54 |
|
217 |
|
|
218 |
55 |
1;
|
219 |
56 |
|
220 |
57 |
__END__
|
InstanceConfiguration durch Verwendung von AUTOLOAD vereinfacht