Bugzilla – Attachment 64336 Details for
Bug 18812
SIP Patron status does not respect OverduesBlockCirc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18812 - SIP Patron status does not respect OverduesBlockCirc
Bug-18812---SIP-Patron-status-does-not-respect-Ove.patch (text/plain), 4.32 KB, created by
Nick Clemens
on 2017-06-15 15:11:13 UTC
(
hide
)
Description:
Bug 18812 - SIP Patron status does not respect OverduesBlockCirc
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2017-06-15 15:11:13 UTC
Size:
4.32 KB
patch
obsolete
>From 2a0b426b453451378698edd7485ce987c7c58e4f Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 15 Jun 2017 11:07:03 -0400 >Subject: [PATCH] Bug 18812 - SIP Patron status does not respect > OverduesBlockCirc > >To test: >1 - Set 'OverduesBlockCirc' to block >2 - Find or create a patron with overdues >3 - Perform a SIP patron lookup on that patron >misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1 -l CPL >--patron {userid or cardnumber} --password {pass} -m patron_information >4 - Note the first character of response is a ' ' >5 - Apply patch >6 - Perform SIP patron lookup >7 - Note the first character of response is 'Y' >8 - prove t/db_dependent/SIP/Patron.t >9 - Test should return green >--- > C4/SIP/ILS/Patron.pm | 3 ++- > t/db_dependent/SIP/Patron.t | 34 +++++++++++++++++++++++++++++++++- > 2 files changed, 35 insertions(+), 2 deletions(-) > >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index 0012776..f406f83 100644 >--- a/C4/SIP/ILS/Patron.pm >+++ b/C4/SIP/ILS/Patron.pm >@@ -62,6 +62,7 @@ sub new { > $fines_amount = ($fines_amount and $fines_amount > 0) ? $fines_amount : 0; > my $fee_limit = _fee_limit(); > my $fine_blocked = $fines_amount > $fee_limit; >+ my $circ_blocked =( C4::Context->preference('OverduesBlockCirc') ne "noblock" && defined $flags->{ODUES}->{itemlist} ) ? 1 : 0; > { > no warnings; # any of these $kp->{fields} being concat'd could be undef > %ilspatron = ( >@@ -80,7 +81,7 @@ sub new { > address => $adr, > home_phone => $kp->{phone}, > email_addr => $kp->{email}, >- charge_ok => ( !$debarred && !$expired && !$fine_blocked), >+ charge_ok => ( !$debarred && !$expired && !$fine_blocked && !$circ_blocked), > renew_ok => ( !$debarred && !$expired && !$fine_blocked), > recall_ok => ( !$debarred && !$expired && !$fine_blocked), > hold_ok => ( !$debarred && !$expired && !$fine_blocked), >diff --git a/t/db_dependent/SIP/Patron.t b/t/db_dependent/SIP/Patron.t >index b089ca0..28009df 100755 >--- a/t/db_dependent/SIP/Patron.t >+++ b/t/db_dependent/SIP/Patron.t >@@ -4,10 +4,11 @@ > # This needs to be extended! Your help is appreciated.. > > use Modern::Perl; >-use Test::More tests => 2; >+use Test::More tests => 3; > > use Koha::Database; > use t::lib::TestBuilder; >+use t::lib::Mocks; > use C4::SIP::ILS::Patron; > > my $schema = Koha::Database->new->schema; >@@ -26,4 +27,35 @@ $schema->resultset('Borrower')->search({ cardnumber => $card })->delete; > my $sip_patron2 = C4::SIP::ILS::Patron->new( $card ); > is( $sip_patron2, undef, "Patron is not valid (anymore)" ); > >+subtest "OverduesBlockCirc tests" => sub { >+ >+ plan tests => 6; >+ >+ my $odue_patron = $builder->build({ source => 'Borrower' }); >+ my $good_patron = $builder->build({ source => 'Borrower' }); >+ my $odue = $builder->build({ source => 'Issue', value => { >+ borrowernumber => $odue_patron->{borrowernumber}, >+ date_due => '2017-01-01', >+ } >+ }); >+ t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'noblock' ); >+ my $odue_sip_patron = C4::SIP::ILS::Patron->new( $odue_patron->{cardnumber} ); >+ is( $odue_sip_patron->{charge_ok}, 1, "Not blocked with overdues when set to 'Don't block'"); >+ $odue_sip_patron = C4::SIP::ILS::Patron->new( $good_patron->{cardnumber} ); >+ is( $odue_sip_patron->{charge_ok}, 1, "Not blocked without overdues when set to 'Don't block'"); >+ >+ t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'confirmation' ); >+ $odue_sip_patron = C4::SIP::ILS::Patron->new( $odue_patron->{cardnumber} ); >+ is( $odue_sip_patron->{charge_ok}, '', "Blocked with overdues when set to 'Ask for confirmation'"); >+ $odue_sip_patron = C4::SIP::ILS::Patron->new( $good_patron->{cardnumber} ); >+ is( $odue_sip_patron->{charge_ok}, 1, "Not blocked without overdues when set to 'confirmation'"); >+ >+ t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'block' ); >+ $odue_sip_patron = C4::SIP::ILS::Patron->new( $odue_patron->{cardnumber} ); >+ is( $odue_sip_patron->{charge_ok}, '', "Blocked with overdues when set to 'Block'"); >+ $odue_sip_patron = C4::SIP::ILS::Patron->new( $good_patron->{cardnumber} ); >+ is( $odue_sip_patron->{charge_ok}, 1, "Not blocked without overdues when set to 'Block'"); >+ >+}; >+ > $schema->storage->txn_rollback; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18812
:
64336
|
64420
|
66697