From cf085911ff3fd52515487d5adb55b04082593539 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 9 Nov 2010 12:19:16 +0100 Subject: [PATCH] =?utf8?q?Auslesen=20der=20Standardw=C3=A4hrung?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/Default.pm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/SL/DB/Default.pm b/SL/DB/Default.pm index 497ce3598..2da27d5c1 100644 --- a/SL/DB/Default.pm +++ b/SL/DB/Default.pm @@ -1,6 +1,3 @@ -# This file has been auto-generated only because it didn't exist. -# Feel free to modify it at will; it will not be overwritten automatically. - package SL::DB::Default; use strict; @@ -10,4 +7,16 @@ use SL::DB::MetaSetup::Default; # Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. __PACKAGE__->meta->make_manager_class; +sub get_default_currency { + my $self = _selfify(@_); + my @currencies = grep { $_ } split(/:/, $self->curr || ''); + return $currencies[0] || ''; +} + +sub _selfify { + my ($class_or_self) = @_; + return $class_or_self if ref($class_or_self); + return SL::DB::Manager::Default->get_all(limit => 1)->[0]; +} + 1; -- 2.20.1