From 9af3833f8658ad932d63493c02e16d3a9fe85a17 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 27 Jan 2020 16:54:20 +0100 Subject: [PATCH] Bug 23463: Fix timestamp default value This sounds wrong as we should let the DBMS do that, but it was failing. Here we are doing the same as Koha::Patron->store for dateenrolled To recreate the failure, prove t/db_dependent/Koha/Item.t without this patch: DBD::mysql::st execute failed: Column 'timestamp' cannot be null [for Statement "UPDATE `items` SET `more_subfields_xml` = ?, `timestamp` = ? WHERE ( `itemnumber` = ? )" with ParamValues: 0=' Signed-off-by: Signed-off-by: Tomas Cohen Arazi Signed-off-by: Signed-off-by: Nick Clemens --- Koha/Item.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 65b55558b1..e0e1505d3a 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -148,7 +148,9 @@ sub store { $self->permanent_location( $self->location ); } - $self->timestamp(undef) if $self->timestamp; # Maybe move this to Koha::Object->store? + if ( $self->timestamp ) { + $self->timestamp(dt_from_string); # Maybe move this to Koha::Object->store? + } C4::Biblio::ModZebra( $self->biblionumber, "specialUpdate", "biblioserver" ); -- 2.20.1