X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/dd6282f6e20d531511ae35cadc491a8c7ab8bad5..2eb2bc5583f28aa5f9bb18c2cd314995d0570f8c:/SL/DB/Unit.pm diff --git a/SL/DB/Unit.pm b/SL/DB/Unit.pm index 59740e789..b133d8f13 100644 --- a/SL/DB/Unit.pm +++ b/SL/DB/Unit.pm @@ -4,6 +4,7 @@ use strict; use SL::DB::MetaSetup::Unit; use SL::DB::Manager::Unit; +use SL::DB::Helper::ActsAsList; __PACKAGE__->meta->add_relationships( base => { @@ -26,10 +27,12 @@ sub unit_class { sub convertible_units { my $self = shift; + my $all_units = scalar(@_) && (ref($_[0]) eq 'ARRAY') ? $_[0] : \@_; + $all_units = SL::DB::Manager::Unit->get_all if !@{ $all_units }; return [ sort { $a->sortkey <=> $b->sortkey } grep { $_->unit_class->name eq $self->unit_class->name } - @{ SL::DB::Manager::Unit->get_all } + @{ $all_units } ]; }