Bugzilla – Attachment 94629 Details for
Bug 23051
Add ability to optionally renew fine accruing items when all fines on item are paid off
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23051: (follow-up) Add SIP summary
Bug-23051-follow-up-Add-SIP-summary.patch (text/plain), 5.41 KB, created by
Andrew Isherwood
on 2019-10-23 14:20:54 UTC
(
hide
)
Description:
Bug 23051: (follow-up) Add SIP summary
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2019-10-23 14:20:54 UTC
Size:
5.41 KB
patch
obsolete
>From 34265cf0408d65c47931635d7484f6437e290be9 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Wed, 23 Oct 2019 15:19:08 +0100 >Subject: [PATCH] Bug 23051: (follow-up) Add SIP summary > >This follow up patch addresses the following parts of Nick's feedback in >comment #35: > >- Ideally SIP would get feedback in a screen message >--- > C4/SIP/ILS.pm | 8 +++++-- > C4/SIP/ILS/Transaction/FeePayment.pm | 20 +++++++++++------ > C4/SIP/Sip/MsgType.pm | 42 +++++++++++++++++++++++++++++++++++- > 3 files changed, 61 insertions(+), 9 deletions(-) > >diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm >index b543539dd0..e938f24d4d 100644 >--- a/C4/SIP/ILS.pm >+++ b/C4/SIP/ILS.pm >@@ -271,10 +271,14 @@ sub pay_fee { > $trans->screen_msg('Invalid patron barcode.'); > return $trans; > } >- my $ok = $trans->pay( $patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff, $disallow_overpayment ); >+ my $trans_result = $trans->pay( $patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff, $disallow_overpayment ); >+ my $ok = $trans_result->{ok}; > $trans->ok($ok); > >- return $trans; >+ return { >+ status => $trans, >+ pay_response => $trans_result->{pay_response} >+ }; > } > > sub add_hold { >diff --git a/C4/SIP/ILS/Transaction/FeePayment.pm b/C4/SIP/ILS/Transaction/FeePayment.pm >index 943176456d..1038d0d982 100644 >--- a/C4/SIP/ILS/Transaction/FeePayment.pm >+++ b/C4/SIP/ILS/Transaction/FeePayment.pm >@@ -57,13 +57,13 @@ sub pay { > my $account = Koha::Account->new( { patron_id => $borrowernumber } ); > > if ($disallow_overpayment) { >- return 0 if $account->balance < $amt; >+ return { ok => 0 } if $account->balance < $amt; > } > > if ($fee_id) { > my $fee = Koha::Account::Lines->find($fee_id); > if ( $fee ) { >- $account->pay( >+ my $pay_response = $account->pay( > { > amount => $amt, > type => $type, >@@ -72,14 +72,19 @@ sub pay { > interface => C4::Context->interface > } > ); >- return 1; >+ return { >+ ok => 1, >+ pay_response => $pay_response >+ }; > } > else { >- return 0; >+ return { >+ ok => 0 >+ }; > } > } > else { >- $account->pay( >+ my $pay_response = $account->pay( > { > amount => $amt, > type => $type, >@@ -87,7 +92,10 @@ sub pay { > interface => C4::Context->interface > } > ); >- return 1; >+ return { >+ ok => 1, >+ pay_response => $pay_response >+ }; > } > } > >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index 425ff76552..c5123081f1 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -20,6 +20,7 @@ use CGI qw ( -utf8 ); > use C4::Auth qw(&check_api_auth); > > use Koha::Patron::Attributes; >+use Koha::Items; > > use UNIVERSAL::can; > >@@ -1103,7 +1104,46 @@ sub handle_fee_paid { > > $ils->check_inst_id( $inst_id, "handle_fee_paid" ); > >- $status = $ils->pay_fee( $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff, $disallow_overpayment ); >+ my $pay_result = $ils->pay_fee( $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff, $disallow_overpayment ); >+ $status = $pay_result->{status}; >+ my $pay_response = $pay_result->{pay_response}; >+ >+ my $failmap = { >+ "no_item" => "No matching item could be found", >+ "no_checkout" => "Item is not checked out", >+ "too_soon" => "Cannot yet be renewed", >+ "too_many" => "Renewed the maximum number of times", >+ "auto_too_soon" => "Scheduled for automatic renewal and cannot yet be renewed", >+ "auto_too_late" => "Scheduled for automatic renewal and cannot yet be any more", >+ "auto_account_expired" => "Scheduled for automatic renewal and cannot be renewed because the patron's account has expired", >+ "auto_renew" => "Scheduled for automatic renewal", >+ "auto_too_much_oweing" => "Scheduled for automatic renewal", >+ "on_reserve" => "On hold for another patron", >+ "patron_restricted" => "Patron is currently restricted", >+ "item_denied_renewal" => "Item is not allowed renewal", >+ "onsite_checkout" => "Item is an onsite checkout" >+ }; >+ my @success = (); >+ my @fail = (); >+ foreach my $result( @{$pay_response->{renew_result}} ) { >+ my $item = Koha::Items->find({ itemnumber => $result->{itemnumber} }); >+ if ($result->{success}) { >+ push @success, '"' . $item->biblio->title . '"'; >+ } else { >+ push @fail, '"' . $item->biblio->title . '" : ' . $failmap->{$result->{error}}; >+ } >+ } >+ >+ my $msg = ""; >+ if (scalar @success > 0) { >+ $msg.="The following items were renewed: " . join(", ", @success) . ". "; >+ } >+ if (scalar @fail > 0) { >+ $msg.="The following items were not renewed: " . join(", ", @fail) . "."; >+ } >+ if (length $msg > 0) { >+ $status->screen_msg($status->screen_msg . " $msg"); >+ } > > $resp .= ( $status->ok ? 'Y' : 'N' ) . timestamp; > $resp .= add_field( FID_INST_ID, $inst_id, $server ); >-- >2.11.0
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 23051
:
90559
|
90560
|
90561
|
91058
|
91059
|
91060
|
91792
|
91793
|
91794
|
91795
|
92684
|
92685
|
92686
|
92687
|
92688
|
92689
|
93922
|
93923
|
93924
|
93925
|
94020
|
94021
|
94022
|
94023
|
94024
|
94402
|
94434
|
94453
|
94525
|
94604
|
94605
|
94606
|
94607
|
94608
|
94609
|
94610
|
94611
|
94629
|
94649
|
95557
|
95558
|
95559
|
95560
|
100127
|
100128
|
100129
|
100130
|
100131
|
100132
|
100133
|
100134
|
100135
|
100138
|
100172
|
100182
|
100183
|
100184
|
100185
|
100186
|
100187
|
100188
|
100271