From 321730c8b122eec74794faa919875a32338458e7 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 30 Dec 2010 16:44:56 +0100 Subject: [PATCH] assign_attributes: nur leeren String und undef bei Zahlenspaletn auf NULL mappen, Wert 0 aber nicht --- SL/DB/Object.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SL/DB/Object.pm b/SL/DB/Object.pm index 52b9300a9..5e58ed958 100644 --- a/SL/DB/Object.pm +++ b/SL/DB/Object.pm @@ -61,9 +61,10 @@ sub _assign_attributes { while (my ($attribute, $value) = each %attributes) { my $type = lc($types{$attribute} || 'text'); - $value = $type eq 'boolean' ? ($value ? 't' : 'f') - : $text_column_types{$type} ? $value - : ($value || undef); + $value = $type eq 'boolean' ? ($value ? 't' : 'f') + : $text_column_types{$type} ? $value + : defined($value) && ($value eq '') ? undef + : $value; $self->$attribute($value); } -- 2.20.1