Bugzilla – Attachment 144447 Details for
Bug 32408
If a fine can be overridden on checkout in Koha, what should the SIP client do?
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Subject: [PATCH] Bug 32408: Allow SIP checkout when the outstanding amount is under noissuescharge
0001-Bug-32408-Allow-SIP-checkout-when-the-outstanding-am.patch (text/plain), 7.56 KB, created by
Matthias Meusburger
on 2022-12-06 13:48:23 UTC
(
hide
)
Description:
Subject: [PATCH] Bug 32408: Allow SIP checkout when the outstanding amount is under noissuescharge
Filename:
MIME Type:
Creator:
Matthias Meusburger
Created:
2022-12-06 13:48:23 UTC
Size:
7.56 KB
patch
obsolete
>From 83b103e92ba872a3488fc1dd803d6f7ed6668708 Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Tue, 6 Dec 2022 13:26:54 +0000 >Subject: [PATCH] Bug 32408: Allow SIP checkout when the outstanding amount is > under noissuescharge > >Test plan: > > - Set up a patron with an outstanding amount under the noissuescharge syspref > > - Do a SIP checkout, and check that it is blocked > > - Apply the patch, and check that under_noissuescharge_block_checkout is > enabled in SIPconfig.xml > > - Do a SIP checkout, and check that it is still blocked > > - Disable under_noissuescharge_block_checkout in SIPconfig.xml > > - Do a SIP checkout, and check that is allowed > > - Prove t/db_dependent/SIP/Transaction.t > >Additionaly, you can enable show_outstanding_amount in SIPconfig.xml to have >the outstanding amount displayed on SIP checkout. >--- > C4/SIP/ILS/Transaction/Checkout.pm | 23 +++++++- > etc/SIPconfig.xml | 2 + > t/db_dependent/SIP/Transaction.t | 89 +++++++++++++++++++++++++++++- > 3 files changed, 110 insertions(+), 4 deletions(-) > >diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm >index d9056f1c82..489f758233 100644 >--- a/C4/SIP/ILS/Transaction/Checkout.pm >+++ b/C4/SIP/ILS/Transaction/Checkout.pm >@@ -18,6 +18,9 @@ use C4::Context; > use C4::Circulation qw( AddIssue GetIssuingCharges CanBookBeIssued ProcessOfflineIssue ); > use C4::Members; > use Koha::DateUtils qw( dt_from_string ); >+use Koha::Number::Price; >+use Koha::Account; >+ > > use parent qw(C4::SIP::ILS::Transaction); > >@@ -89,9 +92,23 @@ sub do_checkout { > $noerror = 0; > last; > } elsif ($confirmation eq 'DEBT') { >- $self->screen_msg('Outstanding Fines block issue'); >- $noerror = 0; >- last; >+ my $message = ""; >+ if ($account->{under_noissuescharge_block_checkout}) { >+ $message = 'Outstanding Fines block issue'; >+ $noerror = 0; >+ } else { >+ $message = "You have outstanding fines"; >+ } >+ >+ if ($account->{show_outstanding_amount}) { >+ my $patron_account = Koha::Account->new( { patron_id => $patron->borrowernumber }); >+ my $balance = $patron_account->balance; >+ if ($balance) { >+ $message .= (" - You owe " . Koha::Number::Price->new( $balance )->format({ with_symbol => 1}) . "."); >+ } >+ } >+ $self->screen_msg($message); >+ last if ($account->{under_noissuescharge_block_checkout}); > } elsif ($confirmation eq 'HIGHHOLDS') { > $overridden_duedate = $needsconfirmation->{$confirmation}->{returndate}; > $self->screen_msg('Loan period reduced for high-demand item'); >diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml >index 8e0dcbef85..2475f34eaf 100644 >--- a/etc/SIPconfig.xml >+++ b/etc/SIPconfig.xml >@@ -74,6 +74,8 @@ > holds_get_captured="1" > prevcheckout_block_checkout="0" > overdues_block_checkout="1" >+ under_noissuescharge_block_checkout="1" >+ show_outstanding_amount="1" > format_due_date="0" > inhouse_item_types="" > inhouse_patron_categories=""> >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index e1e15ccb95..f474edbbb6 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -4,7 +4,7 @@ > # Current state is very rudimentary. Please help to extend it! > > use Modern::Perl; >-use Test::More tests => 16; >+use Test::More tests => 17; > > use Koha::Database; > use t::lib::TestBuilder; >@@ -439,6 +439,93 @@ subtest do_checkin => sub { > }; > }; > >+subtest do_checkout_under_noissuecharge => sub { >+ plan tests => 5; >+ >+ my $mockILS = Test::MockObject->new; >+ my $server = { ils => $mockILS }; >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $institution = { >+ id => $library->id, >+ implementation => "ILS", >+ policy => { >+ checkin => "true", >+ renewal => "true", >+ checkout => "true", >+ timeout => 100, >+ retries => 5, >+ } >+ }; >+ my $ils = C4::SIP::ILS->new($institution); >+ my $item = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ } >+ ); >+ >+ my $fines_patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $library->branchcode, >+ } >+ } >+ ); >+ my $fee1 = $builder->build( >+ { >+ source => 'Accountline', >+ value => { >+ borrowernumber => $fines_patron->borrowernumber, >+ amountoutstanding => 4, >+ } >+ } >+ ); >+ >+ $server->{account}->{under_noissuescharge_block_checkout} = 1; >+ $server->{account}->{show_outstanding_amount} = 0; >+ my $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account}); >+ is( $circ->{screen_msg}, 'Outstanding Fines block issue', >+ "Checkout is blocked when the amount is under noissuecharge and under_noissuescharge_block_checkout is enabled" ); >+ >+ $server->{account}->{under_noissuescharge_block_checkout} = 1; >+ $server->{account}->{show_outstanding_amount} = 1; >+ $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account}); >+ is( $circ->{screen_msg}, 'Outstanding Fines block issue - You owe $4.00.', >+ "Checkout is blocked and the amount is displayed when it is under noissuecharge and under_noissuescharge_block_checkout is enabled" ); >+ >+ $server->{account}->{under_noissuescharge_block_checkout} = 0; >+ $server->{account}->{show_outstanding_amount} = 0; >+ $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account}); >+ is( $circ->{screen_msg}, 'You have outstanding fines', >+ "Checkout is allowed when the amount is under noissuecharge and under_noissuescharge_block_checkout is disabled" ); >+ >+ $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode ); >+ >+ $server->{account}->{under_noissuescharge_block_checkout} = 0; >+ $server->{account}->{show_outstanding_amount} = 1; >+ $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account}); >+ is( $circ->{screen_msg}, 'You have outstanding fines - You owe $4.00.', >+ "Checkout is allowed and the amount is displayed when it is under noissuecharge and under_noissuescharge_block_checkout is disabled" ); >+ >+ $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode ); >+ >+ $fee1 = $builder->build( >+ { >+ source => 'Accountline', >+ value => { >+ borrowernumber => $fines_patron->borrowernumber, >+ amountoutstanding => 4, >+ } >+ } >+ ); >+ >+ $server->{account}->{under_noissuescharge_block_checkout} = 0; >+ $server->{account}->{show_outstanding_amount} = 0; >+ $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account}); >+ is( $circ->{screen_msg}, 'Patron has fines', >+ "Checkout is blocked when amount is over noissuecharge and under_noissuescharge_block_checkout is disabled" ); >+}; >+ > subtest do_checkout_with_patron_blocked => sub { > plan tests => 4; > >-- >2.30.2 >
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 32408
:
144447
|
144469
|
144473
|
144474
|
144496