From 2fd69e2ced19997dbaf6ede671340ec9a3ddba7f 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 --- 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 9b44b32..526a3d0 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -168,7 +168,6 @@ sub GetMemberDetails { SELECT borrowers.*, category_type, categories.description, - categories.BlockExpiredPatronOpacActions, reservefee, enrolmentperiod FROM borrowers @@ -182,7 +181,6 @@ sub GetMemberDetails { SELECT borrowers.*, category_type, categories.description, - categories.BlockExpiredPatronOpacActions, reservefee, enrolmentperiod FROM borrowers @@ -212,11 +210,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 9da82e5..b1dcf57 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 d02e96c..42ee598 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.1.4