Bug 23781: SMS notices and messaging preferences for recalls

This patch adds recalls notices (pick up a waiting recall or return a
requested recall) to the messaging preferences.

To test:
1) Apply Bug 19532
2) Apply this bug
3) Update database, restart services
4) Ensure UseRecalls syspref is enabled and values have been set in the
circulation rules for recalls
5) Go to a borrower (Person A) account page in the Intranet or the OPAC
6) Go to messaging preferences
7) Notice there are now preferences for two recalls notices
8) Select email as a preference
9) Find a different borrower (Person B) and set their messaging
preferences to SMS
10) Check out any item to Person B
11) Go to the OPAC logged in as Person A and find that item
12) Recall the item
13) In the terminal, look at the message_queue in the database. There
should be a 'RETURN_RECALLED_ITEM' recall notice sent to Person B via SMS
14) Go back to the Intranet and check in the item. Confirm the recall
when checking in
15) Look at the message_queue in the database again. There should be a
'PICKUP_RECALLED_ITEM' recall notice sent to Person A via email.
16) Confirm tests pass
t/db_dependent/Koha/Recall.t
t/db_dependent/Koha/Recalls.t
17) Confirm that 'Unknown' doesn't show in the the staff and OPAC messaging preferences tables when UseRecalls syspref is disabled

Sponsored-by: Toi Ohomai Institute of Technology
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Aleisha Amohia 2024-04-21 23:13:33 +00:00 committed by Martin Renvoize
parent 227c38a3c9
commit 3b51ae67db
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
4 changed files with 17 additions and 2 deletions

View file

@ -358,7 +358,11 @@ sub set_waiting {
},
);
C4::Message->enqueue($letter, $self->patron, 'email');
my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences(
{ borrowernumber => $self->patron_id, message_name => 'Recall_Waiting' } );
while ( my ( $transport, $letter_code ) = each %{ $messaging_preferences->{transports} } ) {
C4::Message->enqueue( $letter, $self->patron, $transport );
}
return $self;
}

View file

@ -167,7 +167,12 @@ sub add_recall {
},
);
C4::Message->enqueue( $letter, $checkout->patron, 'email' );
my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences(
{ borrowernumber => $checkout->borrowernumber, message_name => 'Recall_Requested' } );
while ( my ( $transport, $letter_code ) = each %{ $messaging_preferences->{transports} } ) {
C4::Message->enqueue( $letter, $checkout->patron, $transport );
}
$item = Koha::Items->find( $itemnumber );
# add to statistics table

View file

@ -18,6 +18,7 @@
[% FOREACH messaging_preference IN messaging_preferences %]
[% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %]
[% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %]
[% NEXT IF !Koha.Preference('UseRecalls') && messaging_preference.message_name.match('^Recall_') %]
<tr id="[% messaging_preference.message_name _ "_message" | lower | html %]">
<td>[% IF ( messaging_preference.Item_Due ) %]<span>Item due</span>
[% ELSIF ( messaging_preference.Advance_Notice ) %]<span>Advance notice</span>
@ -34,6 +35,8 @@
[% ELSIF ( messaging_preference.Ill_unavailable ) %]<span>Interlibrary loan unavailable</span>
[% ELSIF ( messaging_preference.Ill_update ) %]<span>Interlibrary loan updated</span>
[% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
[% ELSIF ( messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
[% ELSIF ( messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
[% ELSE %]<span>Unknown</span>
[% END %]
</td>

View file

@ -60,6 +60,7 @@
[% FOREACH messaging_preference IN messaging_preferences %]
[% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %]
[% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %]
[% NEXT IF !Koha.Preference('UseRecalls') && messaging_preference.message_name.match('^Recall_') %]
<tr id="[% messaging_preference.message_name _ "_message" | lower | html %]">
<td>[% IF ( messaging_preference.Item_Due ) %]<span>Item due</span>
[% ELSIF ( messaging_preference.Advance_Notice ) %]<span>Advance notice</span>
@ -76,6 +77,8 @@
[% ELSIF ( messaging_preference.Ill_unavailable ) %]<span>Interlibrary loan unavailable</span>
[% ELSIF ( messaging_preference.Ill_update ) %]<span>Interlibrary loan updated</span>
[% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
[% ELSIF ( messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
[% ELSIF ( messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
[% ELSE %]<span>Unknown</span> [% END %]</td>
[% IF ( messaging_preference.takes_days ) %]
<td><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS" aria-label="Choose how many days in advance you wish to receive the message">