Bug 23463: (follow-up 3) Fix timestamp default value

This is the only situation I found where:
 * t/db_dependent/Koha/Item.t is passing
 * t/db_dependent/Koha/Object.t is passing
 * MySQL 8 is happy (and not fail with "Column 'timestamp' cannot be null"), which is certainly what I missed in the previous follow-up

About the change to Object.t: the next store was called without the
generated timestamp, so it is needed to call discard_changes.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2020-03-23 17:21:24 +01:00 committed by Martin Renvoize
parent af1275ce7d
commit 9c383aa286
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
3 changed files with 2 additions and 4 deletions

View file

@ -156,8 +156,6 @@ sub store {
$self->permanent_location( $self->location );
}
$self->timestamp(undef) if $self->timestamp; # Maybe move this to Koha::Object->store?
C4::Biblio::ModZebra( $self->biblionumber, "specialUpdate", "biblioserver" );
$self->_after_item_action_hooks({ action => 'modify' });

View file

@ -155,7 +155,7 @@ sub store {
&& $columns_info->{$col}->{datetime_undef_if_invalid} )
{
# timestamp
# $self->_result()->set_column($col => $columns_info->{$col}->{default_value});
$self->_result()->set_column($col => $columns_info->{$col}->{default_value});
}
}
}

View file

@ -58,7 +58,7 @@ subtest 'is_changed / make_column_dirty' => sub {
$object->categorycode( $categorycode );
$object->branchcode( $branchcode );
$object->surname("Test Surname");
$object->store();
$object->store->discard_changes;
is( $object->is_changed(), 0, "Object is unchanged" );
$object->surname("Test Surname");
is( $object->is_changed(), 0, "Object is still unchanged" );