From: Niclas Zimmermann Date: Fri, 24 May 2013 09:45:56 +0000 (+0200) Subject: currencies in SL/InstanceConfiguration.pm X-Git-Tag: release-3.1.0beta1~401^2~21^2 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2678f499f5781d25e5c21cbb7c16f2a6054ee497;p=kivitendo-erp.git currencies in SL/InstanceConfiguration.pm In der InstanceConfiguration.pm wird jetzt auch auf die Tabelle currencies zugegriffen. --- diff --git a/SL/InstanceConfiguration.pm b/SL/InstanceConfiguration.pm index 1e9c6a10f..850e50cb3 100644 --- a/SL/InstanceConfiguration.pm +++ b/SL/InstanceConfiguration.pm @@ -15,9 +15,9 @@ sub init { $self->{data} = selectfirst_hashref_query($::form, $::form->get_standard_dbh, qq|SELECT * FROM defaults|); - my $curr = $self->{data}->{curr} || ''; - $curr =~ s/\s+//g; - $self->{currencies} = [ split m/:/, $curr ]; + #To get all currencies and the default currency: + ($self->{data}->{curr}) = selectrow_query($::form, $::form->get_standard_dbh, qq|SELECT name AS curr FROM currencies WHERE id = (SELECT currency_id FROM defaults)|); + $self->{currencies} = [ map { $_->{name} } selectall_hashref_query($::form, $::form->get_standard_dbh, qq|SELECT name FROM currencies ORDER BY id|) ]; return $self; } @@ -25,13 +25,13 @@ sub init { sub get_default_currency { my ($self) = @_; - return ($self->get_currencies)[0]; + return $self->{data}->{curr}; } sub get_currencies { my ($self) = @_; - return $self->{currencies} ? @{ $self->{currencies} } : (); + return @{ $self->{currencies} }; } sub get_accounting_method {