Bugzilla – Attachment 99545 Details for
Bug 24718
Introduce hour-based holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24718: Send notice when cancelling a hold from intranet
Bug-24718-Send-notice-when-cancelling-a-hold-from-.patch (text/plain), 6.93 KB, created by
Aleisha Amohia
on 2020-02-24 21:39:30 UTC
(
hide
)
Description:
Bug 24718: Send notice when cancelling a hold from intranet
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2020-02-24 21:39:30 UTC
Size:
6.93 KB
patch
obsolete
>From 3571aca4cc42f04b1b288da76c7cbdab109d516e Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 4 Feb 2020 03:30:30 +0000 >Subject: [PATCH] Bug 24718: Send notice when cancelling a hold from intranet > >Sponsored-by: Waikato Institute of Technology >--- > C4/Reserves.pm | 42 +++++++++++++++++++++++++++++++++++++++--- > circ/pendingreserves.pl | 36 +++++++++++++++++++++++++++++++++++- > reserve/request.pl | 18 ++++++++++++++++++ > 3 files changed, 92 insertions(+), 4 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 6b3bcc3..576c75e 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -998,9 +998,26 @@ sub ModReserve { > $hold ||= Koha::Holds->find($reserve_id); > > if ( $rank eq "del" ) { >+ my $hold_branchcode = $hold->branchcode; >+ my $hold_biblionumber = $hold->biblionumber; >+ my $hold_borrowernumber = $hold->borrowernumber; >+ my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber ); > $hold->cancel; >- } >- elsif ($rank =~ /^\d+/ and $rank > 0) { >+ >+ if ( C4::Context->preference('HourBasedHolds') ){ >+ # send notice to user that their hold has been cancelled >+ my $letter = C4::Letters::GetPreparedLetter ( >+ module => 'reserves', >+ letter_code => 'HOLD_MANUAL_CANCEL', >+ branchcode => $hold_branchcode, >+ tables => { >+ 'biblio', $hold_biblionumber, >+ 'borrowers', $hold_borrowernumber >+ } >+ ); >+ C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email'); >+ } >+ } elsif ($rank =~ /^\d+/ and $rank > 0) { > logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) ) > if C4::Context->preference('HoldsLog'); > >@@ -1182,7 +1199,26 @@ sub ModReserveCancelAll { > #step 1 : cancel the reservation > my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber }); > return unless $holds->count; >- $holds->next->cancel; >+ my $hold = $holds->next; >+ my $hold_branchcode = $hold->branchcode; >+ my $hold_biblionumber = $hold->biblionumber; >+ my $hold_borrowernumber = $hold->borrowernumber; >+ my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber ); >+ $hold->cancel; >+ >+ if ( C4::Context->preference('HourBasedHolds') ){ >+ # send notice to user that their hold has been cancelled >+ my $letter = C4::Letters::GetPreparedLetter ( >+ module => 'reserves', >+ letter_code => 'HOLD_MANUAL_CANCEL', >+ branchcode => $hold_branchcode, >+ tables => { >+ 'biblio', $hold_biblionumber, >+ 'borrowers', $hold_borrowernumber >+ } >+ ); >+ C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email'); >+ } > > #step 2 launch the subroutine of the others reserves > ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber); >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index 9f62b28..52d000d 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -56,15 +56,36 @@ my @messages; > if ( $op eq 'cancel_reserve' and $reserve_id ) { > my $hold = Koha::Holds->find( $reserve_id ); > if ( $hold ) { >+ my $hold_branchcode = $hold->branchcode; >+ my $hold_biblionumber = $hold->biblionumber; >+ my $hold_borrowernumber = $hold->borrowernumber; >+ my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber ); > $hold->cancel; > push @messages, { type => 'message', code => 'hold_cancelled' }; >+ >+ if ( C4::Context->preference('HourBasedHolds') ){ >+ # send notice to user that their hold has been cancelled >+ my $letter = C4::Letters::GetPreparedLetter ( >+ module => 'reserves', >+ letter_code => 'HOLD_MANUAL_CANCEL', >+ branchcode => $hold_branchcode, >+ tables => { >+ 'biblio', $hold_biblionumber, >+ 'borrowers', $hold_borrowernumber >+ } >+ ); >+ C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email'); >+ } > } > } elsif ( $op =~ m|^mark_as_lost| ) { > my $hold = Koha::Holds->find( $reserve_id ); >+ my $hold_branchcode = $hold->branchcode; >+ my $hold_biblionumber = $hold->biblionumber; >+ my $hold_borrowernumber = $hold->borrowernumber; >+ my $patron = $hold->borrower; > die "wrong reserve_id" unless $hold; # This is a bit rude, but we are not supposed to get a wrong reserve_id > my $item = $hold->item; > if ( $item and C4::Context->preference('CanMarkHoldsToPullAsLost') =~ m|^allow| ) { >- my $patron = $hold->borrower; > C4::Circulation::LostItem( $item->itemnumber, "pendingreserves" ); > if ( $op eq 'mark_as_lost_and_notify' and C4::Context->preference('CanMarkHoldsToPullAsLost') eq 'allow_and_notify' ) { > my $library = $hold->branch; >@@ -120,6 +141,19 @@ if ( $op eq 'cancel_reserve' and $reserve_id ) { > } > } > >+ if ( C4::Context->preference('HourBasedHolds') ){ >+ # send notice to user that their hold has been cancelled >+ my $letter = C4::Letters::GetPreparedLetter ( >+ module => 'reserves', >+ letter_code => 'HOLD_MANUAL_CANCEL', >+ branchcode => $hold_branchcode, >+ tables => { >+ 'biblio', $hold_biblionumber, >+ 'borrowers', $hold_borrowernumber >+ } >+ ); >+ C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email'); >+ } > } elsif ( not $item ) { > push @messages, { type => 'alert', code => 'hold_placed_at_biblio_level'}; > } # else the url parameters have been modified and the user is not allowed to continue >diff --git a/reserve/request.pl b/reserve/request.pl >index 5864b3d..21dad18 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -107,7 +107,25 @@ if ( $action eq 'move' ) { > } elsif ( $action eq 'cancel' ) { > my $reserve_id = $input->param('reserve_id'); > my $hold = Koha::Holds->find( $reserve_id ); >+ my $hold_branchcode = $hold->branchcode; >+ my $hold_biblionumber = $hold->biblionumber; >+ my $hold_borrowernumber = $hold->borrowernumber; >+ my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber ); > $hold->cancel if $hold; >+ >+ if ( C4::Context->preference('HourBasedHolds') ){ >+ # send notice to user that their hold has been cancelled >+ my $letter = C4::Letters::GetPreparedLetter ( >+ module => 'reserves', >+ letter_code => 'HOLD_MANUAL_CANCEL', >+ branchcode => $hold_branchcode, >+ tables => { >+ 'biblio', $hold_biblionumber, >+ 'borrowers', $hold_borrowernumber >+ } >+ ); >+ C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email'); >+ } > } elsif ( $action eq 'setLowestPriority' ) { > my $reserve_id = $input->param('reserve_id'); > ToggleLowestPriority( $reserve_id ); >-- >2.1.4
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 24718
:
99540
|
99541
|
99542
|
99543
|
99544
|
99545
|
99548
|
103521
|
103522
|
103549
|
103550
|
103551
|
103552
|
103553
|
103554
|
103555
|
106270
|
106271
|
106272
|
106273
|
106274
|
106275
|
110084
|
110085
|
110086
|
110087
|
110088
|
110089
|
110090
|
110091
|
110098
|
110137
|
110161
|
110303
|
126559
|
126560
|
126561
|
126562
|
126563
|
126564
|
148293
|
148294
|
148295
|
148296
|
148297
|
148298
|
162474
|
162475
|
162476
|
162477
|
162478
|
162479