Bugzilla – Attachment 144474 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]
Bug 32408: Allow SIP to override a fine on checkout if a librarian can
Bug-32408-Allow-SIP-to-override-a-fine-on-checkout.patch (text/plain), 7.52 KB, created by
Martin Renvoize (ashimema)
on 2022-12-07 16:19:15 UTC
(
hide
)
Description:
Bug 32408: Allow SIP to override a fine on checkout if a librarian can
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-12-07 16:19:15 UTC
Size:
7.52 KB
patch
obsolete
>From daab9f032979f266152ce740158539fee70e84f8 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 to override a fine on checkout if a > librarian can > >Test plan: > > - Set up a patron with an outstanding amount under the noissuescharge syspref > > - Check that you can override the fine on checkout in Koha > > - Do a SIP checkout, and check that it is blocked > > - Apply the patch, and check that override_fine_on_checkout is > disabled in SIPconfig.xml > > - Do a SIP checkout, and check that it is still blocked > > - Enable override_fine_on_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. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/SIP/ILS/Transaction/Checkout.pm | 22 +++++++- > etc/SIPconfig.xml | 2 + > t/db_dependent/SIP/Transaction.t | 89 +++++++++++++++++++++++++++++- > 3 files changed, 109 insertions(+), 4 deletions(-) > >diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm >index d9056f1c824..4ba30dbd16a 100644 >--- a/C4/SIP/ILS/Transaction/Checkout.pm >+++ b/C4/SIP/ILS/Transaction/Checkout.pm >@@ -18,6 +18,8 @@ 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 +91,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->{override_fine_on_checkout}) { >+ $message = "You have outstanding fines"; >+ } else { >+ $message = 'Outstanding fines block issue'; >+ $noerror = 0; >+ } >+ >+ 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->{override_fine_on_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 8e0dcbef852..fdc465671c9 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" >+ override_fine_on_checkout="0" >+ 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 e1e15ccb95e..f1bdf5eb4d9 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_with_fine_override => 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}->{override_fine_on_checkout} = 0; >+ $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 override_fine_on_checkout is disabled" ); >+ >+ $server->{account}->{override_fine_on_checkout} = 0; >+ $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 override_fine_on_checkout is disabled" ); >+ >+ $server->{account}->{override_fine_on_checkout} = 1; >+ $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 override_fine_on_checkout is enabled" ); >+ >+ $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode ); >+ >+ $server->{account}->{override_fine_on_checkout} = 1; >+ $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 override_fine_on_checkout is enabled" ); >+ >+ $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}->{override_fine_on_checkout} = 1; >+ $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 override_fine_on_checkout is enabled" ); >+}; >+ > subtest do_checkout_with_patron_blocked => sub { > plan tests => 4; > >-- >2.38.1
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