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 <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-11-07 15:53:25 +00:00 committed by Kyle M Hall
parent ca5fb69362
commit 492280102f
3 changed files with 5 additions and 9 deletions

View 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}) &&

View file

@ -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';

View file

@ -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'} ) {