From 492280102fdc61568e1c7fbf9f464a852ac12c2c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 7 Nov 2016 15:53:25 +0000 Subject: [PATCH] Bug 17578: GetMemberDetails - Remove BlockExpiredPatronOpacActions 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 Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall --- C4/Members.pm | 7 ------- opac/opac-renew.pl | 4 +++- opac/opac-reserve.pl | 3 ++- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 674342f64b..141a20c7be 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -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}) && diff --git a/opac/opac-renew.pl b/opac/opac-renew.pl index 9da82e54f0..b1dcf572d6 100755 --- a/opac/opac-renew.pl +++ b/opac/opac-renew.pl @@ -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'; diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index d02e96c4bd..42ee5983e7 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -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'} ) { -- 2.39.5