From d726789fee9eb8e26ae375ede7fea0341e252db3 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Tue, 11 Oct 2011 18:22:27 +0200 Subject: [PATCH] Bug 6328 follow-up for QA comments * fixed documentation in C4/Auth_with_ldap.pm * updated ILSDI/Utility.pm to work with debarred being a date * updated Members.pm/patronflags to work with debarred being a date (copy/paste of BibLibre code that had not been backported) * fixed opac-reserve to check correctly for debarred status I also have removed a duplicate line on circulation.pl when the patron was restricted = the information was displayed twice --- C4/Auth_with_ldap.pm | 3 ++- C4/ILSDI/Utility.pm | 2 +- C4/Members.pm | 18 ++++++++++-------- .../prog/en/modules/circ/circulation.tt | 4 ---- opac/opac-reserve.pl | 3 ++- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index 5baa07f..80bbc14 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -356,7 +356,8 @@ C4::Auth - Authenticates Koha users | dateexpiry | date | YES | | NULL | | | gonenoaddress | tinyint(1) | YES | | NULL | | | lost | tinyint(1) | YES | | NULL | | - | debarred | tinyint(1) | YES | | NULL | | + | debarred | date | YES | | NULL | | + | debarredcomment | varchar(255) | YES | | NULL | | | contactname | mediumtext | YES | | NULL | | | contactfirstname | text | YES | | NULL | | | contacttitle | text | YES | | NULL | | diff --git a/C4/ILSDI/Utility.pm b/C4/ILSDI/Utility.pm index 8ee1224..bacabac 100644 --- a/C4/ILSDI/Utility.pm +++ b/C4/ILSDI/Utility.pm @@ -94,7 +94,7 @@ sub CanBookBeReserved { if ( $borrower->{lost} eq 1 ) { $out = undef; } - if ( $borrower->{debarred} eq 1 ) { + if ( $borrower->{debarred} ) { $out = undef; } my @reserves = GetReservesFromBorrowernumber( $borrower->{'borrowernumber'} ); diff --git a/C4/Members.pm b/C4/Members.pm index d5ac9dc..b72086d 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -25,7 +25,7 @@ use strict; use C4::Context; use C4::Dates qw(format_date_in_iso); use Digest::MD5 qw(md5_base64); -use Date::Calc qw/Today Add_Delta_YM/; +use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/; use C4::Log; # logaction use C4::Overdues; use C4::Reserves; @@ -489,13 +489,15 @@ sub patronflags { $flaginfo{'noissues'} = 1; $flags{'LOST'} = \%flaginfo; } - if ( $patroninformation->{'debarred'} - && $patroninformation->{'debarred'} == 1 ) - { - my %flaginfo; - $flaginfo{'message'} = 'Borrower is Debarred.'; - $flaginfo{'noissues'} = 1; - $flags{'DBARRED'} = \%flaginfo; + if ( $patroninformation->{'debarred'} && check_date( split( /-/, $patroninformation->{'debarred'} ) ) ) { + if ( Date_to_Days(Date::Calc::Today) < Date_to_Days( split( /-/, $patroninformation->{'debarred'} ) ) ) { + my %flaginfo; + $flaginfo{'debarredcomment'} = $patroninformation->{'debarredcomment'}; + $flaginfo{'message'} = $patroninformation->{'debarredcomment'}; + $flaginfo{'noissues'} = 1; + $flaginfo{'dateend'} = $patroninformation->{'debarred'}; + $flags{'DBARRED'} = \%flaginfo; + } } if ( $patroninformation->{'borrowernotes'} && $patroninformation->{'borrowernotes'} ) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index b2c9d1c..b16fb44 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -573,10 +573,6 @@ No patron matched [% message %] [% END %] - [% IF ( dbarred ) %]
  • - Restricted: Patron's account is restricted Lift restriction -
  • [% END %] - [% IF ( odues ) %]
  • [% IF ( nonreturns ) %]Overdues: Patron has ITEMS OVERDUE. See highlighted items below[% END %]
  • [% END %] diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 9b9301e..a9d3fd4 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -29,6 +29,7 @@ use C4::Dates qw/format_date/; use C4::Context; use C4::Members; use C4::Branch; # GetBranches +use C4::Overdues; use C4::Debug; # use Data::Dumper; @@ -256,7 +257,7 @@ if ( $borr->{lost} && ($borr->{lost} eq 1) ) { lost => 1 ); } -if ( $borr->{debarred} && ($borr->{debarred} eq 1) ) { +if ( CheckBorrowerDebarred($borrowernumber) ) { $noreserves = 1; $template->param( message => 1, -- 1.7.4.1