allow empty string as a default value
This commit is contained in:
parent
40c57b4b23
commit
a0f733615c
|
@ -395,8 +395,8 @@ sub set {
|
||||||
if ( ( ! exists $$self{$field} ) or (!defined $$self{$field}) or ( $$self{$field} eq '' ) ) {
|
if ( ( ! exists $$self{$field} ) or (!defined $$self{$field}) or ( $$self{$field} eq '' ) ) {
|
||||||
$log->debug("Setting default ($field) (".def_or_undef($$self{$field}).') ('.def_or_undef($defaults{$field}).') ') if $debug;
|
$log->debug("Setting default ($field) (".def_or_undef($$self{$field}).') ('.def_or_undef($defaults{$field}).') ') if $debug;
|
||||||
if ( defined $defaults{$field} ) {
|
if ( defined $defaults{$field} ) {
|
||||||
if ( $defaults{$field} eq 'NOW()' ) {
|
if ( $defaults{$field} eq '' or $defaults{$field} eq 'NOW()' ) {
|
||||||
$$self{$field} = 'NOW()';
|
$$self{$field} = $defaults{$field};
|
||||||
} else {
|
} else {
|
||||||
$$self{$field} = eval($defaults{$field});
|
$$self{$field} = eval($defaults{$field});
|
||||||
$log->error( "Eval error of object default $field default ($defaults{$field}) Reason: " . $@ ) if $@;
|
$log->error( "Eval error of object default $field default ($defaults{$field}) Reason: " . $@ ) if $@;
|
||||||
|
|
Loading…
Reference in New Issue