Bug 6328 follow-up for QA comments
authorPaul Poulain <paul.poulain@biblibre.com>
Tue, 11 Oct 2011 16:22:27 +0000 (18:22 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 25 Nov 2011 13:00:47 +0000 (14:00 +0100)
* 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
C4/ILSDI/Utility.pm
C4/Members.pm
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
opac/opac-reserve.pl

index 7f56d9c..a2e346c 100644 (file)
@@ -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    |                |
index 8ee1224..bacabac 100644 (file)
@@ -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'} );
index 27b6b0e..8bd7b47 100644 (file)
@@ -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;
@@ -451,13 +451,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'} )
index 5fadb18..5627109 100644 (file)
@@ -574,10 +574,6 @@ No patron matched <span class="ex">[% message %]</span>
                </form>
                        </li>[% END %]
 
-            [% IF ( dbarred ) %]<li class="blocker">
-               <span class="circ-hlt"> Restricted:</span> Patron's account is restricted <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;cardnumber=[% cardnumber %]&amp;destination=circ&amp;status=0">Lift restriction</a>
-</li>[% END %]
-
                [% IF ( odues ) %]<li>[% IF ( nonreturns ) %]<span class="circ-hlt">Overdues:</span> Patron has <span class="circ-hlt">ITEMS OVERDUE</span>. See highlighted items <a href="#checkouts">below</a>[% END %]</li>
             [% END %]
 
index 2713cf3..b2144a9 100755 (executable)
@@ -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;
 
@@ -278,7 +279,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,