Bugzilla – Attachment 175954 Details for
Bug 38658
SIP not marking patrons expired unless NotifyBorrowerDeparture has a positive value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38658: Display message for expired patrons in SIP when NotifyBorrowerDeparture is disabled
Bug-38658-Display-message-for-expired-patrons-in-S.patch (text/plain), 4.26 KB, created by
Matthias Meusburger
on 2024-12-27 13:54:56 UTC
(
hide
)
Description:
Bug 38658: Display message for expired patrons in SIP when NotifyBorrowerDeparture is disabled
Filename:
MIME Type:
Creator:
Matthias Meusburger
Created:
2024-12-27 13:54:56 UTC
Size:
4.26 KB
patch
obsolete
>From f264c3fd54feb16fe5047e59bf1141bcb6e5c772 Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Fri, 27 Dec 2024 13:37:19 +0000 >Subject: [PATCH] Bug 38658: Display message for expired patrons in SIP when > NotifyBorrowerDeparture is disabled > >This patch restores the behavior that existed in SIP before Bug 25813 - Enhance patron expiration in SIP display: >Always consider an expired patron as expired, even if NotifyBorrowerDeparture is set to 0 (disabled) or unset. > >Test plan: > > - Set NotifyBorrowerDeparture to 0 > > - Set a patron's expiry date to be in the past > > - Use misc/sip_cli_emulator.pl to display patron information: > perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -t CR --patron <cardnumber> -m patron_information > > - Check that you have the following message (AF field): > "Greetings from Koha. Your account has expired as of <expired date>" >--- > C4/SIP/ILS/Patron.pm | 9 +++++---- > t/db_dependent/SIP/Patron.t | 15 ++++++++++++--- > 2 files changed, 17 insertions(+), 7 deletions(-) > >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index 19412ebac1e..aeef6372319 100644 >--- a/C4/SIP/ILS/Patron.pm >+++ b/C4/SIP/ILS/Patron.pm >@@ -67,13 +67,14 @@ sub new { > my $debarred = $patron->is_debarred; > siplog( "LOG_DEBUG", "Debarred = %s : ", ( $debarred || 'undef' ) ); # Do we need more debug info here? > my $expired = 0; >- if ( $kp->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ) { >+ if ( $kp->{'dateexpiry'} ) { > my ( $today_year, $today_month, $today_day ) = Today(); > my ( $warning_year, $warning_month, $warning_day ) = split /-/, $kp->{'dateexpiry'}; > my $days_to_expiry = Date_to_Days( $warning_year, $warning_month, $warning_day ) - > Date_to_Days( $today_year, $today_month, $today_day ); >- my $dt = dt_from_string( $kp->{'dateexpiry'}, 'iso' ); >- my $dateexpiry = output_pref( { dt => $dt, dateonly => 1 } ); >+ my $dt = dt_from_string( $kp->{'dateexpiry'}, 'iso' ); >+ my $dateexpiry = output_pref( { dt => $dt, dateonly => 1 } ); >+ my $notifyBorrowerDeparture = C4::Context->preference('NotifyBorrowerDeparture') // 0; > if ( $days_to_expiry < 0 ) { > > #borrower card has expired, warn the borrower >@@ -82,7 +83,7 @@ sub new { > } > $kp->{opacnote} .= "Your account has expired as of $dateexpiry"; > $expired = 1; >- } elsif ( $days_to_expiry < C4::Context->preference('NotifyBorrowerDeparture') ) { >+ } elsif ( $days_to_expiry < $notifyBorrowerDeparture ) { > > # borrower card soon to expire, warn the borrower > if ( $kp->{opacnote} ) { >diff --git a/t/db_dependent/SIP/Patron.t b/t/db_dependent/SIP/Patron.t >index 2c95245ed21..106bdf93582 100755 >--- a/t/db_dependent/SIP/Patron.t >+++ b/t/db_dependent/SIP/Patron.t >@@ -254,7 +254,7 @@ $schema->storage->txn_rollback; > > subtest "Patron expiration tests" => sub { > >- plan tests => 4; >+ plan tests => 5; > > $schema->storage->txn_begin; > my $patron = $builder->build_object( >@@ -297,13 +297,22 @@ subtest "Patron expiration tests" => sub { > "A message is displayed when the card has expired and NotifyBorrowerDeparture is not disabled" > ); > >+ # Bug 38658 - SIP not marking patrons expired unless NotifyBorrowerDeparture has a positive value > t::lib::Mocks::mock_preference( 'NotifyBorrowerDeparture', 0 ); > $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); > like( >- $sip_patron->screen_msg, qr/^Greetings from Koha. $/, >- "No message is displayed when the card has expired and NotifyBorrowerDeparture is disabled" >+ $sip_patron->screen_msg, qr/Your account has expired as of/, >+ "A message is displayed when the card has expired and NotifyBorrowerDeparture has a value of 0" > ); > >+ t::lib::Mocks::mock_preference( 'NotifyBorrowerDeparture', undef ); >+ $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); >+ like( >+ $sip_patron->screen_msg, qr/Your account has expired as of/, >+ "A message is displayed when the card has expired and NotifyBorrowerDeparture has no value" >+ ); >+ >+ > $schema->storage->txn_rollback; > > }; >-- >2.39.5
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 38658
:
175954
|
176099