2da27d5c1a44c1933755e2790455a77f3370dbaa
[kivitendo-erp.git] / SL / DB / Default.pm
1 package SL::DB::Default;
2
3 use strict;
4
5 use SL::DB::MetaSetup::Default;
6
7 # Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
8 __PACKAGE__->meta->make_manager_class;
9
10 sub get_default_currency {
11   my $self = _selfify(@_);
12   my @currencies = grep { $_ } split(/:/, $self->curr || '');
13   return $currencies[0] || '';
14 }
15
16 sub _selfify {
17   my ($class_or_self) = @_;
18   return $class_or_self if ref($class_or_self);
19   return SL::DB::Manager::Default->get_all(limit => 1)->[0];
20 }
21
22 1;