Bugzilla – Attachment 106057 Details for
Bug 25813
Enhance patron expiration in SIP display
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25813: Enhance patron expiration in SIP display
Bug-25813-Enhance-patron-expiration-in-SIP-display.patch (text/plain), 3.33 KB, created by
Matthias Meusburger
on 2020-06-19 09:08:06 UTC
(
hide
)
Description:
Bug 25813: Enhance patron expiration in SIP display
Filename:
MIME Type:
Creator:
Matthias Meusburger
Created:
2020-06-19 09:08:06 UTC
Size:
3.33 KB
patch
obsolete
>From 31a5d0b4a5078ec223bca430673a8674a1b7f7ee Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Tue, 10 Sep 2019 16:59:30 +0200 >Subject: [PATCH] Bug 25813: Enhance patron expiration in SIP display > > Currently, the patron information returned by SIP only shows > "PATRON EXPIRED" when the patron card has expired. > > This patch makes the display more consistant with the Opac display > and also complies with the NotifyBorrowerDeparture system preference. > > Test plan: > > - apply the patch > > - set NotifyBorrowerDeparture to 0 > > - check that nothing is ever displayed about the card expiration > > - set NotifyBorrowerDeparture to a value greater than 0 > > - check that the following message will be displayed for a card that will > expire within NotifyBorrowerDeparture days: > "Your card will expire on {correctly formatted date}" > > - check that the following message will be displayed for a card that has > expired: > "Your account has expired as of {correctly formatted date}" > > You can use src/C4/SIP/interactive_patron_dump.pl for easier testing. >--- > C4/SIP/ILS/Patron.pm | 30 +++++++++++++++++++++++------- > 1 file changed, 23 insertions(+), 7 deletions(-) > >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index 6969c115ed..465f5591b6 100644 >--- a/C4/SIP/ILS/Patron.pm >+++ b/C4/SIP/ILS/Patron.pm >@@ -27,6 +27,9 @@ use C4::Auth qw(checkpw); > use Koha::Items; > use Koha::Libraries; > use Koha::Patrons; >+use Date::Calc qw/Today Date_to_Days/; >+use Koha::DateUtils; >+ > > our $kp; # koha patron > >@@ -49,15 +52,28 @@ sub new { > my $pw = $kp->{password}; > my $flags = C4::Members::patronflags( $kp ); > my $debarred = $patron->is_debarred; >+ my $expired = 0; > $debug and warn sprintf("Debarred = %s : ", ($debarred||'undef')); # Do we need more debug info here? >- my ($day, $month, $year) = (localtime)[3,4,5]; >- my $today = sprintf '%04d-%02d-%02d', $year+1900, $month+1, $day; >- my $expired = ($today gt $kp->{dateexpiry}) ? 1 : 0; >- if ($expired) { >- if ($kp->{opacnote} ) { >- $kp->{opacnote} .= q{ }; >+ if ( $kp->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ) { >+ 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}); >+ if ( $days_to_expiry < 0 ) { >+ #borrower card has expired, warn the borrower >+ if ($kp->{opacnote} ) { >+ $kp->{opacnote} .= q{ }; >+ } >+ $kp->{opacnote} .= "Your account has expired as of $dateexpiry"; >+ $expired = 1; >+ } elsif ( $days_to_expiry < C4::Context->preference('NotifyBorrowerDeparture') ) { >+ # borrower card soon to expire, warn the borrower >+ if ($kp->{opacnote} ) { >+ $kp->{opacnote} .= q{ }; >+ } >+ $kp->{opacnote} .= "Your card will expire on $dateexpiry"; > } >- $kp->{opacnote} .= 'PATRON EXPIRED'; > } > my %ilspatron; > my $adr = _get_address($kp); >-- >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 25813
:
106057
|
154697
|
160730
|
160794
|
161084