projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Dokumentation: HTML- & PDF-Versionen neu gebaut
[kivitendo-erp.git]
/
SL
/
DB
/
Unit.pm
diff --git
a/SL/DB/Unit.pm
b/SL/DB/Unit.pm
index
900558f
..
508aa74
100644
(file)
--- a/
SL/DB/Unit.pm
+++ b/
SL/DB/Unit.pm
@@
-1,5
+1,8
@@
package SL::DB::Unit;
package SL::DB::Unit;
+use List::MoreUtils qw(any);
+
+
use strict;
use SL::DB::MetaSetup::Unit;
use strict;
use SL::DB::MetaSetup::Unit;
@@
-54,7
+57,13
@@
sub convert_to {
my $my_base_factor = $self->base_factor || 1;
my $other_base_factor = $other_unit->base_factor || 1;
my $my_base_factor = $self->base_factor || 1;
my $other_base_factor = $other_unit->base_factor || 1;
- return $qty * $my_base_factor / $other_base_factor;
+ return ($qty // 0) * $my_base_factor / $other_base_factor;
+}
+
+sub is_time_based {
+ my ($self) = @_;
+
+ return any { $_->id == $self->id } @{ SL::DB::Manager::Unit->time_based_units };
}
1;
}
1;