Bugzilla – Attachment 171589 Details for
Bug 26282
Allow staff to decide if a hold cancellation notice will be sent when cancelling a hold
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26282: (QA follow-up) Tidy code for qa script
Bug-26282-QA-follow-up-Tidy-code-for-qa-script.patch (text/plain), 6.63 KB, created by
Kyle M Hall (khall)
on 2024-09-16 18:10:05 UTC
(
hide
)
Description:
Bug 26282: (QA follow-up) Tidy code for qa script
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-09-16 18:10:05 UTC
Size:
6.63 KB
patch
obsolete
>From 1c323b647c871143d49514b01157a5be24959a72 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 16 Sep 2024 14:03:20 -0400 >Subject: [PATCH] Bug 26282: (QA follow-up) Tidy code for qa script > >--- > misc/cronjobs/holds/cancel_expired_holds.pl | 2 +- > reserve/modrequest.pl | 29 +++++++++------------ > t/db_dependent/Koha/Hold.t | 25 ++++++++++-------- > 3 files changed, 28 insertions(+), 28 deletions(-) > >diff --git a/misc/cronjobs/holds/cancel_expired_holds.pl b/misc/cronjobs/holds/cancel_expired_holds.pl >index 81921dab910..7c7b67d2295 100755 >--- a/misc/cronjobs/holds/cancel_expired_holds.pl >+++ b/misc/cronjobs/holds/cancel_expired_holds.pl >@@ -81,6 +81,6 @@ pod2usage(1) if $help; > > cronlogaction({ info => $command_line_options }); > >-C4::Reserves::CancelExpiredReserves($reason, $notify); >+C4::Reserves::CancelExpiredReserves( $reason, $notify ); > > cronlogaction({ action => 'End', info => "COMPLETED" }); >diff --git a/reserve/modrequest.pl b/reserve/modrequest.pl >index 648fae89a46..c24f504b544 100755 >--- a/reserve/modrequest.pl >+++ b/reserve/modrequest.pl >@@ -51,31 +51,31 @@ my $count=@rank; > @biblionumber = uniq @biblionumber; > > # Cancel or modify the queue list of reserves (without item linked) >-if( $op eq 'cud-cancelall' || $op eq 'cud-modifyall' ) { >- for (my $i=0;$i<$count;$i++){ >+if ( $op eq 'cud-cancelall' || $op eq 'cud-modifyall' ) { >+ for ( my $i = 0 ; $i < $count ; $i++ ) { > undef $itemnumber[$i] if !$itemnumber[$i]; >- my $suspend_until = $query->param( "suspend_until_" . $reserve_id[$i] ); >- my $cancellation_reason = $query->param("cancellation-reason"); >+ my $suspend_until = $query->param( "suspend_until_" . $reserve_id[$i] ); >+ my $cancellation_reason = $query->param("cancellation-reason"); > my $cancellation_notify_patron = $query->param("cancellation-notify-patron"); > > my $params = { >- rank => $rank[$i], >- reserve_id => $reserve_id[$i], >+ rank => $rank[$i], >+ reserve_id => $reserve_id[$i], > expirationdate => $expirationdates[$i] || undef, >- branchcode => $branch[$i], >- itemnumber => $itemnumber[$i], >+ branchcode => $branch[$i], >+ itemnumber => $itemnumber[$i], > defined $suspend_until ? ( suspend_until => $suspend_until ) : (), > cancellation_reason => $cancellation_reason, >- notify_patron => $cancellation_notify_patron, >+ notify_patron => $cancellation_notify_patron, > }; >- if (C4::Context->preference('AllowHoldDateInFuture')) { >+ if ( C4::Context->preference('AllowHoldDateInFuture') ) { > $params->{reservedate} = $reservedates[$i] || undef; > } > > try { > ModReserve($params); > } catch { >- if ($_->isa('Koha::Exceptions::ObjectNotFound')){ >+ if ( $_->isa('Koha::Exceptions::ObjectNotFound') ) { > warn $_; > } else { > $_->rethrow; >@@ -97,11 +97,8 @@ if( $op eq 'cud-cancelall' || $op eq 'cud-modifyall' ) { > } > } > my @biblio_ids = uniq @biblionumber; >- Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( >- { >- biblio_ids => \@biblio_ids >- } >- ) if C4::Context->preference('RealTimeHoldsQueue'); >+ Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => \@biblio_ids } ) >+ if C4::Context->preference('RealTimeHoldsQueue'); > } > > my $from=$query->param('from'); >diff --git a/t/db_dependent/Koha/Hold.t b/t/db_dependent/Koha/Hold.t >index 44988e9ff85..fc9e1a6d95f 100755 >--- a/t/db_dependent/Koha/Hold.t >+++ b/t/db_dependent/Koha/Hold.t >@@ -1101,10 +1101,13 @@ subtest 'cancel() tests' => sub { > # Mock GetPreparedLetter so it raises a warning we can look for > # and returns undef, so no call to EnqueueLetter happens > my $mocked_letter = Test::MockModule->new("C4::Letters"); >- $mocked_letter->mock( 'GetPreparedLetter', sub { >- $get_prepared_letter_called = 1; >- return; >- }); >+ $mocked_letter->mock( >+ 'GetPreparedLetter', >+ sub { >+ $get_prepared_letter_called = 1; >+ return; >+ } >+ ); > > my $hold = $builder->build_object( > { >@@ -1119,7 +1122,7 @@ subtest 'cancel() tests' => sub { > > # leave this things out of the test > t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelayCharge', 0 ); >- t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); >+ t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); > > $hold = $builder->build_object( > { >@@ -1133,11 +1136,11 @@ subtest 'cancel() tests' => sub { > ); > > $get_prepared_letter_called = 0; >- $hold->cancel({ cancellation_reason => 'Some reason' }); >+ $hold->cancel( { cancellation_reason => 'Some reason' } ); > ok( !$get_prepared_letter_called, 'GetPreparedLetter not called' ); > > isnt( $hold->cancellationdate, undef, 'cancellationdate gets set to the passed value' ); >- is( $hold->priority, 0, 'priority gets set to 0' ); >+ is( $hold->priority, 0, 'priority gets set to 0' ); > is( $hold->cancellation_reason, 'Some reason', 'cancellation_reason is set to the passed value' ); > > $hold = $builder->build_object( >@@ -1152,11 +1155,11 @@ subtest 'cancel() tests' => sub { > ); > > $get_prepared_letter_called = 0; >- $hold->cancel({ cancellation_reason => 'Some reason', notify_patron => 1 }); >+ $hold->cancel( { cancellation_reason => 'Some reason', notify_patron => 1 } ); > ok( $get_prepared_letter_called, 'GetPreparedLetter called if notify_patron and cancellation_reason passed' ); > > isnt( $hold->cancellationdate, undef, 'cancellationdate gets set to the passed value' ); >- is( $hold->priority, 0, 'priority gets set to 0' ); >+ is( $hold->priority, 0, 'priority gets set to 0' ); > is( $hold->cancellation_reason, 'Some reason', 'cancellation_reason is set to the passed value' ); > > $hold = $builder->build_object( >@@ -1171,9 +1174,9 @@ subtest 'cancel() tests' => sub { > ); > > $get_prepared_letter_called = 0; >- $hold->cancel({ notify_patron => 1 }); >+ $hold->cancel( { notify_patron => 1 } ); > isnt( $hold->cancellationdate, undef, 'cancellationdate gets set to the passed value' ); >- is( $hold->priority, 0, 'priority gets set to 0' ); >+ is( $hold->priority, 0, 'priority gets set to 0' ); > is( $hold->cancellation_reason, undef, 'cancellation_reason not passed' ); > > $schema->storage->txn_rollback; >-- >2.39.3 (Apple Git-146)
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 26282
:
109286
|
113960
|
113991
|
114007
|
114008
|
114009
|
114010
|
114011
|
114012
|
114013
|
114014
|
114015
|
114016
|
114028
|
114030
|
114031
|
114032
|
114033
|
114034
|
114035
|
114247
|
114248
|
114249
|
114250
|
114251
|
114252
|
114253
|
114254
|
114255
|
114259
|
115193
|
115194
|
115195
|
115196
|
115197
|
115198
|
115199
|
115200
|
115201
|
122448
|
122449
|
122450
|
122451
|
122452
|
122453
|
122454
|
122455
|
122456
|
122550
|
138407
|
138408
|
138409
|
138410
|
138411
|
138412
|
138413
|
138414
|
138415
|
138416
|
138417
|
138418
|
138419
|
138469
|
141210
|
171577
|
171578
|
171579
|
171580
|
171581
|
171582
|
171583
|
171584
|
171585
|
171586
|
171587
|
171588
|
171589
|
171590
|
171592
|
171593