Bugzilla – Attachment 144476 Details for
Bug 25812
Fines can be displayed on SIP checkin/checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25812: Fines can be displayed on SIP checkin/checkout
Bug-25812-Fines-can-be-displayed-on-SIP-checkinche.patch (text/plain), 8.39 KB, created by
Kyle M Hall (khall)
on 2022-12-07 17:17:31 UTC
(
hide
)
Description:
Bug 25812: Fines can be displayed on SIP checkin/checkout
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-12-07 17:17:31 UTC
Size:
8.39 KB
patch
obsolete
>From 36165717756a1351ca1661f962cf52a53d2a454b Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Wed, 25 Sep 2019 15:30:51 +0200 >Subject: [PATCH] Bug 25812: Fines can be displayed on SIP checkin/checkout > >Test plan: > > - Enable show_outstanding_amount in SIPconfig.xml > > - Check that the total outstanding amout for the patron is displayed on SIP > checkout (if it exists), for example: > Patron has fines - You owe $10.00. > > - Check that the outstanding amout for a given item is displayed on SIP > checkin (if it exists), for example: > "You owe $10.00 for this item." > > - Check that it is not displayed when show_outstanding_amount is disabled. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/SIP/ILS.pm | 27 +++++++++- > etc/SIPconfig.xml | 1 + > t/db_dependent/SIP/Transaction.t | 93 ++++++++++++++++++++++++++++++-- > 3 files changed, 117 insertions(+), 4 deletions(-) > >diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm >index ff9ee74067..766b815716 100644 >--- a/C4/SIP/ILS.pm >+++ b/C4/SIP/ILS.pm >@@ -139,7 +139,15 @@ sub checkout { > } elsif ($patron->expired) { > $circ->screen_msg("Patron expired"); > } elsif ($patron->fine_blocked) { >- $circ->screen_msg("Patron has fines"); >+ my $message = "Patron has 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}) . "."); >+ } >+ } >+ $circ->screen_msg($message); > } else { > $circ->screen_msg("Patron blocked"); > } >@@ -246,6 +254,23 @@ sub checkin { > delete $item->{borrowernumber}; > delete $item->{due_date}; > $patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ]; >+ # Check for overdue fines to display >+ if ($account->{show_outstanding_amount}) { >+ my $kohaitem = Koha::Items->find( { barcode => $item_id } ); >+ if ($kohaitem) { >+ my $charges = Koha::Account::Lines->search( >+ { >+ borrowernumber => $patron->{borrowernumber}, >+ amountoutstanding => { '>' => 0 }, >+ debit_type_code => [ 'OVERDUE' ], >+ itemnumber => $kohaitem->itemnumber >+ }, >+ ); >+ if ($charges) { >+ $circ->screen_msg("You owe " . Koha::Number::Price->new( $charges->total_outstanding )->format({ with_symbol => 1}) . " for this item."); >+ } >+ } >+ } > } else { > # Checkin failed: Wrongbranch or withdrawn? > # Bug 10748 with pref BlockReturnOfLostItems adds another case to come >diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml >index 8e0dcbef85..58d9b1054a 100644 >--- a/etc/SIPconfig.xml >+++ b/etc/SIPconfig.xml >@@ -74,6 +74,7 @@ > holds_get_captured="1" > prevcheckout_block_checkout="0" > overdues_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..17e0b98e42 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -334,8 +334,10 @@ subtest "Placing holds via SIP check CanItemBeReserved" => sub { > }; > > subtest do_checkin => sub { >- plan tests => 12; >+ plan tests => 13; > >+ my $mockILS = Test::MockObject->new; >+ my $server = { ils => $mockILS }; > my $library = $builder->build_object( { class => 'Koha::Libraries' } ); > my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); > my $patron = $builder->build_object( >@@ -437,11 +439,92 @@ subtest do_checkin => sub { > is( $hold->itemnumber, $item->itemnumber, ); > is( Koha::Checkouts->search({itemnumber => $item->itemnumber})->count, 0, ); > }; >+ >+ subtest 'Checkin with fines' => sub { >+ plan tests => 2; >+ >+ 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, >+ } >+ ); >+ >+ # show_outstanding_amount disabled >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $library->branchcode, >+ } >+ } >+ ); >+ my $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); >+ my $fee1 = $builder->build( >+ { >+ source => 'Accountline', >+ value => { >+ borrowernumber => $patron->borrowernumber, >+ amountoutstanding => 12, >+ debit_type_code => 'OVERDUE', >+ itemnumber => $item->itemnumber >+ } >+ } >+ ); >+ $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} ); >+ is( $circ->{screen_msg}, '', "The fine is not displayed on checkin when show_outstanding_amount is disabled" ); >+ >+ # show_outstanding_amount enabled >+ $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $library->branchcode, >+ } >+ } >+ ); >+ $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); >+ >+ $fee1 = $builder->build( >+ { >+ source => 'Accountline', >+ value => { >+ borrowernumber => $patron->borrowernumber, >+ amountoutstanding => 12, >+ debit_type_code => 'OVERDUE', >+ itemnumber => $item->itemnumber >+ } >+ } >+ ); >+ >+ $server->{account}->{show_outstanding_amount} = 1; >+ $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); >+ >+ $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} ); >+ is( $circ->{screen_msg}, 'You owe $12.00 for this item.', "The fine is displayed on checkin when show_outstanding_amount is enabled" ); >+ >+ }; > }; > > subtest do_checkout_with_patron_blocked => sub { >- plan tests => 4; >+ 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, >@@ -492,9 +575,13 @@ subtest do_checkout_with_patron_blocked => sub { > ); > > my $fines_sip_patron = C4::SIP::ILS::Patron->new( $fines_patron->cardnumber ); >- $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode); >+ >+ $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account}); > is( $circ->{screen_msg}, 'Patron has fines', "Got correct fines screen message" ); > >+ $server->{account}->{show_outstanding_amount} = 1; >+ $circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account}); >+ is( $circ->{screen_msg}, 'Patron has fines - You owe $10.00.', "Got correct fines with amount screen message" ); > my $debarred_patron = $builder->build_object( > { > class => 'Koha::Patrons', >-- >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 25812
:
106056
|
106340
|
139690
|
144217
| 144476