Bugzilla – Attachment 159604 Details for
Bug 35491
Reverting waiting status for holds is not logged
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35491: Add logging to RevertWaitingStatus
Bug-35491-Add-logging-to-RevertWaitingStatus.patch (text/plain), 3.54 KB, created by
ByWater Sandboxes
on 2023-12-05 18:01:43 UTC
(
hide
)
Description:
Bug 35491: Add logging to RevertWaitingStatus
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2023-12-05 18:01:43 UTC
Size:
3.54 KB
patch
obsolete
>From e32570da5b3b504f01da8072af9dcebcf7dc11a1 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 5 Dec 2023 16:27:44 +0000 >Subject: [PATCH] Bug 35491: Add logging to RevertWaitingStatus > >This patch simply adds a logaction line to RevertWaitingStatus > >To test: >1 - Enable HoldsLog >2 - Place a hold >3 - Fill the hold >4 - Revert the waiting status >5 - Note there is no action log added >6 - Apply patch >7 - Repeat 2-4 >8 - Confirm you now have a MODIFY action logged for the reversion > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> >--- > C4/Reserves.pm | 3 +++ > t/db_dependent/Reserves.t | 27 +++++++++++++++++++++------ > 2 files changed, 24 insertions(+), 6 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 872abfa13b..c95a3d7ad4 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -2169,6 +2169,9 @@ sub RevertWaitingStatus { > } > )->store(); > >+ logaction( 'HOLDS', 'MODIFY', $hold->id, $hold ) >+ if C4::Context->preference('HoldsLog'); >+ > _FixPriority( { biblionumber => $hold->biblionumber } ); > > Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 0076dc2e15..83b84bbc2d 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -989,7 +989,7 @@ subtest 'reserves.item_level_hold' => sub { > ); > > subtest 'item level hold' => sub { >- plan tests => 3; >+ plan tests => 5; > my $reserve_id = AddReserve( > { > branchcode => $item->homebranch, >@@ -1017,24 +1017,39 @@ subtest 'reserves.item_level_hold' => sub { > } ); > > t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 1 ); >+ t::lib::Mocks::mock_preference( 'HoldsLog', 1 ); > > # Revert the waiting status >- C4::Reserves::RevertWaitingStatus( >- { itemnumber => $item->itemnumber } ); >+ C4::Reserves::RevertWaitingStatus( { itemnumber => $item->itemnumber } ); > > $hold = Koha::Holds->find($reserve_id); > >- is( $hold->itemnumber, $item->itemnumber, 'Itemnumber should not be removed when the waiting status is revert' ); >+ is( >+ $hold->itemnumber, $item->itemnumber, >+ 'Itemnumber should not be removed when the waiting status is revert' >+ ); >+ >+ my $log = >+ Koha::ActionLogs->search( { module => 'HOLDS', action => 'MODIFY', object => $hold->reserve_id } )->next; >+ my $expected = sprintf q{'timestamp' => '%s'}, $hold->timestamp; >+ like( $log->info, qr{$expected}, 'Timestamp logged is the current one' ); >+ my $log_count = >+ Koha::ActionLogs->search( { module => 'HOLDS', action => 'MODIFY', object => $hold->reserve_id } )->count; > > t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 0 ); >+ t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); > > $hold->set_waiting; > > # Revert the waiting status, RealTimeHoldsQueue => shouldn't add a test >- C4::Reserves::RevertWaitingStatus( >- { itemnumber => $item->itemnumber } ); >+ C4::Reserves::RevertWaitingStatus( { itemnumber => $item->itemnumber } ); > > $hold->delete; # cleanup >+ >+ my $log_count_after = >+ Koha::ActionLogs->search( { module => 'HOLDS', action => 'MODIFY', object => $hold->reserve_id } )->count; >+ is( $log_count, $log_count_after, "No logging is added for RevertWaitingStatus when HoldsLog is disabled" ); >+ > }; > > subtest 'biblio level hold' => sub { >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35491
:
159595
|
159604
|
159903