From f70a738bca1782e7a90ef217473c2d50e335e3e4 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: Tomas Cohen Arazi Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- 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.39.5