X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/0b89d2ca35a0e0d9d3add90b1289e27bfc87c83c..4249eeff3d68e15d74cbba40529a73f6b06e971e:/SL/DB/Object.pm diff --git a/SL/DB/Object.pm b/SL/DB/Object.pm index fc1365213..1c7c050ea 100755 --- a/SL/DB/Object.pm +++ b/SL/DB/Object.pm @@ -60,6 +60,15 @@ sub _assign_attributes { my %types = map { $_->name => $_->type } ref($self)->meta->columns; + # Special case for *_as_man_days / *_as_man_days_string / + # *_as_man_days_unit: the _unit variation must always be called + # after the non-unit methods. + my @man_days_attributes = grep { m/_as_man_days(?:_string)?$/ } keys %attributes; + foreach my $attribute (@man_days_attributes) { + my $value = delete $attributes{$attribute}; + $self->$attribute(defined($value) && ($value eq '') ? undef : $value); + } + while (my ($attribute, $value) = each %attributes) { my $type = lc($types{$attribute} || 'text'); $value = $type eq 'boolean' ? ($value ? 't' : 'f')