Bugzilla – Attachment 119327 Details for
Bug 15986
Add a script for sending hold waiting reminder notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15986: (follow-up) Add all holds per patron
Bug-15986-follow-up-Add-all-holds-per-patron.patch (text/plain), 2.77 KB, created by
Nick Clemens (kidclamp)
on 2021-04-08 14:56:19 UTC
(
hide
)
Description:
Bug 15986: (follow-up) Add all holds per patron
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-04-08 14:56:19 UTC
Size:
2.77 KB
patch
obsolete
>From 6c305a3d2604facacb14efc4801d6393f4104d93 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 8 Apr 2021 13:43:40 +0000 >Subject: [PATCH] Bug 15986: (follow-up) Add all holds per patron > >This changes the code to loop through all the holds and group by patron, >we then send the holds to the letter using the 'loops' option >--- > misc/cronjobs/holds_reminder.pl | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) > >diff --git a/misc/cronjobs/holds_reminder.pl b/misc/cronjobs/holds_reminder.pl >index 7b3012550c..f938d0b108 100755 >--- a/misc/cronjobs/holds_reminder.pl >+++ b/misc/cronjobs/holds_reminder.pl >@@ -246,8 +246,8 @@ foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP > my $waiting_since = $dtf->format_date( $waiting_date ); > my $reserves = Koha::Holds->search({ > waitingdate => {'<=' => $waiting_since }, >- branchcode => $branchcode, >- }); >+ 'me.branchcode' => $branchcode, >+ },{ prefetch => 'patron' }); > > $verbose and warn "No reserves found for $branchcode\n" unless $reserves->count; > next unless $reserves->count; >@@ -261,12 +261,16 @@ foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP > my $sending_params = @mtts ? { message_transports => \@mtts } : { message_name => "Hold_Filled" }; > > >+ my %patrons; > while ( my $reserve = $reserves->next ) { >+ $patrons{$reserve->borrowernumber}->{patron} = $reserve->patron unless exists $patrons{$reserve->borrowernumber}; >+ push @{$patrons{$reserve->borrowernumber}->{reserves}}, $reserve->reserve_id; >+ } > >- my $patron = $reserve->borrower; >- # Skip if we already dealt with this borrower >- next if ( $done{$patron->borrowernumber} ); >- $verbose and print " borrower " . $patron->surname . ", " . $patron->firstname . " has holds triggering notice.\n"; >+ foreach my $borrowernumber (keys %patrons){ >+ >+ my $patron = $patrons{$borrowernumber}->{patron}; >+ $verbose and print " borrower " . $patron->surname . ", " . $patron->firstname . " has " . scalar @{$patrons{$borrowernumber}->{reserves}} . " holds triggering notice.\n"; > > # Setup the notice information > my $letter_params = { >@@ -276,8 +280,10 @@ foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP > branchcode => $branchcode, > tables => { > borrowers => $patron->borrowernumber, >- branches => $reserve->branchcode, >- reserves => $reserve->unblessed >+ branches => $branchcode, >+ }, >+ loops => { >+ reserves => $patrons{$borrowernumber}->{reserves} > }, > }; > $sending_params->{letter_params} = $letter_params; >-- >2.11.0
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 15986
:
53323
|
53354
|
53594
|
55723
|
91767
|
91768
|
99919
|
102723
|
102926
|
106962
|
106963
|
106964
|
112999
|
113000
|
113001
|
118733
|
118734
|
118735
|
118736
|
118737
|
119277
|
119308
| 119327 |
119328
|
119329
|
119383
|
119384
|
119386
|
119624
|
119725
|
119748
|
120224