Bug 37023: Update timestamp when filling a hold

This patch updates the timestamp of the hold when it is filled and moved to old_reserves.

Test plan:
1) Apply the patch
2) prove t/db_dependent/Koha/Hold.t

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Johanna Raisa 2024-06-04 14:44:56 +03:00 committed by Katrin Fischer
parent 2e790c7c49
commit d98603d6b0
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 5 additions and 2 deletions

View File

@ -847,6 +847,7 @@ sub fill {
{
found => 'F',
priority => 0,
timestamp => dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ),
$params->{item_id} ? ( itemnumber => $params->{item_id} ) : (),
}
);

View File

@ -106,7 +106,7 @@ subtest 'pickup_library/branch tests' => sub {
subtest 'fill() tests' => sub {
plan tests => 14;
plan tests => 15;
$schema->storage->txn_begin;
@ -136,6 +136,7 @@ subtest 'fill() tests' => sub {
biblionumber => $biblio->id,
borrowernumber => $patron->id,
itemnumber => $item->id,
timestamp => dt_from_string('2021-06-25 14:05:35'),
priority => 10,
}
}
@ -148,7 +149,7 @@ subtest 'fill() tests' => sub {
my $interface = 'api';
C4::Context->interface($interface);
my $hold_timestamp = $hold->timestamp;
my $ret = $hold->fill;
is( ref($ret), 'Koha::Hold', '->fill returns the object type' );
@ -159,6 +160,7 @@ subtest 'fill() tests' => sub {
is( $old_hold->id, $hold->id, 'reserve_id retained' );
is( $old_hold->priority, 0, 'priority set to 0' );
isnt( $old_hold->timestamp, $hold_timestamp, 'timestamp updated' );
is( $old_hold->found, 'F', 'found set to F' );
subtest 'item_id parameter' => sub {