From a0f733615c6513bb5ef0d08b1e05b799e2cf63be Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 22 Oct 2020 11:26:34 -0400 Subject: [PATCH] allow empty string as a default value --- scripts/ZoneMinder/lib/ZoneMinder/Object.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Object.pm b/scripts/ZoneMinder/lib/ZoneMinder/Object.pm index b262b6f85..0f8bcb8ad 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Object.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Object.pm @@ -395,8 +395,8 @@ sub set { 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; if ( defined $defaults{$field} ) { - if ( $defaults{$field} eq 'NOW()' ) { - $$self{$field} = 'NOW()'; + if ( $defaults{$field} eq '' or $defaults{$field} eq 'NOW()' ) { + $$self{$field} = $defaults{$field}; } else { $$self{$field} = eval($defaults{$field}); $log->error( "Eval error of object default $field default ($defaults{$field}) Reason: " . $@ ) if $@;