From 2678f499f5781d25e5c21cbb7c16f2a6054ee497 Mon Sep 17 00:00:00 2001 From: Niclas Zimmermann Date: Fri, 24 May 2013 11:45:56 +0200 Subject: [PATCH] currencies in SL/InstanceConfiguration.pm In der InstanceConfiguration.pm wird jetzt auch auf die Tabelle currencies zugegriffen. --- SL/InstanceConfiguration.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 { -- 2.20.1