Bugzilla – Attachment 144806 Details for
Bug 32518
Add reason option to cancel_unfilled_holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32518: Add reason option to cancel_unfilled_holds cronjob
Bug-32518-Add-reason-option-to-cancelunfilledholds.patch (text/plain), 2.80 KB, created by
Nick Clemens (kidclamp)
on 2022-12-22 21:14:52 UTC
(
hide
)
Description:
Bug 32518: Add reason option to cancel_unfilled_holds cronjob
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-12-22 21:14:52 UTC
Size:
2.80 KB
patch
obsolete
>From 284e6cc4b934fe6202a62b301f399d235b4d59e4 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 22 Dec 2022 21:02:56 +0000 >Subject: [PATCH] Bug 32518: Add reason option to cancel_unfilled_holds cronjob > >This adds a reaosn parameter and passes it into the cancellation if supplied > >To test: >1 - Place a hold for a patron in your system >2 - Run script with --days 0 -v >3 - verify that it would cancel the reserves (and that you are okay with cancelling the ones it found) >4 - Make sure you have a notice in the holds module with code 'HOLD_CANCELLATION' >5 - Set content of the notice like: >[% IF hold.cancellation_reason=='too_old' %] >Canceled old >[% END %] >6 - Run script with --days 0 -v --reason too_bad -c >7 - Confirm hold cancelled, no notice sent to patron >8 - Place another hold >9 - Run script with --days 0 -v --reason too_old -c >10 - Confirm hold cancelled, notice sent to patron >--- > misc/cronjobs/holds/cancel_unfilled_holds.pl | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > >diff --git a/misc/cronjobs/holds/cancel_unfilled_holds.pl b/misc/cronjobs/holds/cancel_unfilled_holds.pl >index 82e2b18516..9d51b43ef7 100755 >--- a/misc/cronjobs/holds/cancel_unfilled_holds.pl >+++ b/misc/cronjobs/holds/cancel_unfilled_holds.pl >@@ -37,7 +37,7 @@ number of days. > > =head1 SYNOPSIS > >- cancel_unfilled_holds.pl [--days][--library][--holidays][--confirm][--verbose] >+ cancel_unfilled_holds.pl [--days][--library][--holidays][--confirm][--verbose][--reason] > > =head1 OPTIONS > >@@ -69,6 +69,10 @@ would have done if it were not running in test mode. > > More verbose output. > >+=item B<--reason> >+ >+Optionally adds a reason for cancellation (which will trigger a notice to be sent to the patron) >+ > =back > > =cut >@@ -79,6 +83,7 @@ my @branchcodes; > my $use_calendar = 0; > my $verbose = 0; > my $confirm = 0; >+my $reason; > > my $command_line_options = join(" ",@ARGV); > >@@ -89,6 +94,7 @@ GetOptions( > 'holidays' => \$use_calendar, > 'v|verbose' => \$verbose, > 'confirm' => \$confirm, >+ 'reason=s' => \$reason > ) or pod2usage(1); > pod2usage(1) if $help; > >@@ -111,6 +117,9 @@ $verbose and warn "Looking for unfilled holds placed $days or more days ago\n"; > @branchcodes = Koha::Libraries->search->get_column('branchcode') if !@branchcodes; > $verbose and warn "Running for branch(es): " . join( "|", @branchcodes ) . "\n"; > >+my $cancellation_params = {}; >+$cancellation_params->{cancellation_reason} = $reason if $reason; >+ > foreach my $branch (@branchcodes) { > > my $holds = >@@ -135,7 +144,7 @@ foreach my $branch (@branchcodes) { > . $hold->borrowernumber > . " on biblio: " > . $hold->biblionumber . "\n"; >- $hold->cancel if $confirm; >+ $hold->cancel( $cancellation_params ); if $confirm; > } > > } >-- >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 32518
:
144806
|
144820
|
145755
|
147424
|
147425