X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/e3aa3f5b7ea363bf7ec8e547c583b3b4a0758492..4180aaea33e9ff3bb35f3fa6cf91651a6225f7ad:/SL/DB/Object.pm?ds=sidebyside diff --git a/SL/DB/Object.pm b/SL/DB/Object.pm index fc1365213..3cf670d55 100755 --- a/SL/DB/Object.pm +++ b/SL/DB/Object.pm @@ -60,6 +60,14 @@ sub _assign_attributes { my %types = map { $_->name => $_->type } ref($self)->meta->columns; + # Special case for *_as_man_days/*_as_man_days_unit: the _unit + # variation must always be called after the non-unit method. + my @man_days_attributes = grep { m/_as_man_days$/ } 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')