Bug 17578: GetMemberDetails - Remove BlockExpiredPatronOpacActions
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 7 Nov 2016 15:53:25 +0000 (15:53 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 16 Dec 2016 13:12:40 +0000 (13:12 +0000)
The correct way to get the value of BlockExpiredPatronOpacActions from a
patron object is to get the patron category then call the
effective_BlockExpiredPatronOpacActions:
  $patron->category->effective_BlockExpiredPatronOpacActions

So this patch applies this change and remove this value from the
GetMemberDetails subroutine.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/Members.pm
opac/opac-renew.pl
opac/opac-reserve.pl

index 674342f..141a20c 100644 (file)
@@ -164,7 +164,6 @@ sub GetMemberDetails {
             SELECT borrowers.*,
                    category_type,
                    categories.description,
-                   categories.BlockExpiredPatronOpacActions,
                    reservefee,
                    enrolmentperiod
             FROM borrowers
@@ -178,7 +177,6 @@ sub GetMemberDetails {
             SELECT borrowers.*,
                    category_type,
                    categories.description,
-                   categories.BlockExpiredPatronOpacActions,
                    reservefee,
                    enrolmentperiod
             FROM borrowers
@@ -208,11 +206,6 @@ sub GetMemberDetails {
     $borrower->{'flags'}     = $flags;
     $borrower->{'authflags'} = $accessflagshash;
 
-    # Handle setting the true behavior for BlockExpiredPatronOpacActions
-    $borrower->{'BlockExpiredPatronOpacActions'} =
-      C4::Context->preference('BlockExpiredPatronOpacActions')
-      if ( $borrower->{'BlockExpiredPatronOpacActions'} == -1 );
-
     $borrower->{'is_expired'} = 0;
     $borrower->{'is_expired'} = 1 if
       defined($borrower->{dateexpiry}) &&
index 9da82e5..b1dcf57 100755 (executable)
@@ -30,6 +30,7 @@ use C4::Auth;
 use C4::Context;
 use C4::Items;
 use C4::Members;
+use Koha::Patrons;
 use Date::Calc qw( Today Date_to_Days );
 my $query = new CGI;
 
@@ -49,9 +50,10 @@ my $opacrenew = C4::Context->preference("OpacRenewalAllowed");
 my $errorstring = q{};
 my $renewed     = q{};
 
+my $patron = Koha::Patrons->find( $borrowernumber );
 my $member_details = GetMemberDetails($borrowernumber);
 
-if (   $member_details->{'BlockExpiredPatronOpacActions'}
+if (   $patron->category->effective_BlockExpiredPatronOpacActions
     && $member_details->{'is_expired'} )
 {
     $errorstring = 'card_expired';
index d02e96c..42ee598 100755 (executable)
@@ -71,9 +71,10 @@ sub get_out {
 
 # get borrower information ....
 my ( $borr ) = GetMemberDetails( $borrowernumber );
+my $patron = Koha::Patrons->find( $borrowernumber );
 
 # check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block
-if ( $borr->{'BlockExpiredPatronOpacActions'} ) {
+if ( $patron->category->effective_BlockExpiredPatronOpacActions ) {
 
     if ( $borr->{'is_expired'} ) {