Bugzilla – Attachment 133924 Details for
Bug 14364
Allow automatically canceled expired waiting holds to fill the next hold
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14364: (QA follow-up) Generate message for transfers as well
Bug-14364-QA-follow-up-Generate-message-for-transf.patch (text/plain), 4.59 KB, created by
Katrin Fischer
on 2022-04-26 14:55:45 UTC
(
hide
)
Description:
Bug 14364: (QA follow-up) Generate message for transfers as well
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-04-26 14:55:45 UTC
Size:
4.59 KB
patch
obsolete
>From 496a3cc0618f82b322f343c6854e74b0a6af4f1e Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 13 May 2021 12:04:41 -0400 >Subject: [PATCH] Bug 14364: (QA follow-up) Generate message for transfers as > well > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Reserves.pm | 49 ++++++++++++++++++- > t/db_dependent/Holds/ExpireReservesAutoFill.t | 16 +++--- > 2 files changed, 56 insertions(+), 9 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 33864fa254..61a543ce65 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1191,12 +1191,14 @@ sub ModReserveAffect { > $hold->set_processing(); > } else { > $hold->set_waiting($desk_id); >- _koha_notify_reserve( $hold->reserve_id, $notify_library ) unless $already_on_shelf; >+ _koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf; > # Complete transfer if one exists > my $transfer = $hold->item->get_transfer; > $transfer->receive if $transfer; > } > >+ _koha_notify_hold_changed( $hold ) if $notify_library; >+ > _FixPriority( { biblionumber => $biblionumber } ); > my $item = Koha::Items->find($itemnumber); > if ( $item->location && $item->location eq 'CART' >@@ -1918,6 +1920,51 @@ sub _koha_notify_reserve { > } > } > >+=head2 _koha_notify_hold_changed >+ >+ _koha_notify_hold_changed( $hold_object ); >+ >+=cut >+ >+sub _koha_notify_hold_changed { >+ my $hold = shift; >+ >+ my $patron = $hold->patron; >+ my $library = $hold->branch; >+ >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'reserves', >+ letter_code => 'HOLD_CHANGED', >+ branchcode => $hold->branchcode, >+ substitute => { today => output_pref( dt_from_string ) }, >+ tables => { >+ 'branches' => $library->unblessed, >+ 'borrowers' => $patron->unblessed, >+ 'biblio' => $hold->biblionumber, >+ 'biblioitems' => $hold->biblionumber, >+ 'reserves' => $hold->unblessed, >+ 'items' => $hold->itemnumber, >+ }, >+ ); >+ >+ return unless $letter; >+ >+ my $email = >+ C4::Context->preference('ExpireReservesAutoFillEmail') >+ || $library->branchemail >+ || C4::Context->preference('KohaAdminEmailAddress'); >+ >+ C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $patron->id, >+ message_transport_type => 'email', >+ from_address => $email, >+ to_address => $email, >+ } >+ ); >+} >+ > =head2 _ShiftPriorityByDateAndPriority > > $new_priority = _ShiftPriorityByDateAndPriority( $biblionumber, $reservedate, $priority ); >diff --git a/t/db_dependent/Holds/ExpireReservesAutoFill.t b/t/db_dependent/Holds/ExpireReservesAutoFill.t >index 610e3ba747..d805c50029 100755 >--- a/t/db_dependent/Holds/ExpireReservesAutoFill.t >+++ b/t/db_dependent/Holds/ExpireReservesAutoFill.t >@@ -100,11 +100,11 @@ subtest 'Test automatically canceled expired waiting holds to fill the next hold > > CancelExpiredReserves(); > >- my @holds = Koha::Holds->search( {}, { order_by => 'priority' } ); >- $hold_2 = $holds[0]; >- $hold_3 = $holds[1]; >+ my $holds = Koha::Holds->search( {}, { order_by => 'priority' } ); >+ $hold_2 = $holds->next; >+ $hold_3 = $holds->next; > >- is( @holds, 2, 'Found 2 holds' ); >+ is( $holds->count, 2, 'Found 2 holds' ); > is( $hold_2->priority, 0, 'Next hold in line now has priority of 0' ); > is( $hold_2->found, 'W', 'Next hold in line is now set to waiting' ); > >@@ -117,10 +117,10 @@ subtest 'Test automatically canceled expired waiting holds to fill the next hold > > CancelExpiredReserves(); > >- @holds = Koha::Holds->search( {}, { order_by => 'priority' } ); >- $hold_3 = $holds[0]; >+ $holds = Koha::Holds->search( {}, { order_by => 'priority' } ); >+ $hold_3 = $holds->next; > >- is( @holds, 1, 'Found 1 hold' ); >+ is( $holds->count, 1, 'Found 1 hold' ); > is( $hold_3->priority, 0, 'Next hold in line now has priority of 0' ); > is( $hold_3->found, 'W', 'Next hold in line is now set to waiting' ); > >@@ -186,5 +186,5 @@ subtest 'Test automatically canceled expired waiting holds to fill the next hold > > my @messages = $schema->resultset('MessageQueue') > ->search( { letter_code => 'HOLD_CHANGED' } ); >- is( @messages, 0, 'No messages in the message queue when generating transfer' ); >+ is( @messages, 1, 'Nessage is generated in the message queue when generating transfer' ); > }; >-- >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 14364
:
39998
|
41236
|
45149
|
49699
|
49700
|
49822
|
52310
|
52311
|
52312
|
71148
|
80126
|
103297
|
105015
|
115427
|
115466
|
120494
|
120941
|
120942
|
128757
|
128758
|
128759
|
132019
|
132020
|
132021
|
133812
|
133923
|
133924
|
133925
|
133926
|
133927
|
133928
|
137927
|
137928
|
137929
|
137930
|
137931
|
137932