From a81fe5ec1762786c527389066c35db2074402227 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 19 Oct 2018 12:14:20 +0200 Subject: [PATCH] Bug 21610: (follow-up) Default value for dates Content-Type: text/plain; charset=utf-8 We have some dates with DEFAULT CURRENT_TIMESTAMP and some dates with default and UPDATE clause. Test plan: Run Object.t again. Signed-off-by: Marcel de Rooy --- Koha/Object.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Koha/Object.pm b/Koha/Object.pm index 71a4ba8..a74ae2d 100644 --- a/Koha/Object.pm +++ b/Koha/Object.pm @@ -141,7 +141,9 @@ sub store { } elsif ( _date_or_datetime_column_type( $columns_info->{$col}->{data_type} ) ) { # Set to null if an empty string (or == 0 but should not happen) - $self->$col(undef) unless $self->$col; + # Skip a default value for dates LIKE CURRENT_TIMESTAMP + # In DBIx represented as: default_value => \'now()' + $self->$col(undef) unless $self->$col || $columns_info->{$col}->{default_value}; } } -- 2.1.4