Lines 20-25
use CGI qw ( -utf8 );
Link Here
|
20 |
use C4::Auth qw(&check_api_auth); |
20 |
use C4::Auth qw(&check_api_auth); |
21 |
|
21 |
|
22 |
use Koha::Patron::Attributes; |
22 |
use Koha::Patron::Attributes; |
|
|
23 |
use Koha::Items; |
23 |
|
24 |
|
24 |
use UNIVERSAL::can; |
25 |
use UNIVERSAL::can; |
25 |
|
26 |
|
Lines 1103-1109
sub handle_fee_paid {
Link Here
|
1103 |
|
1104 |
|
1104 |
$ils->check_inst_id( $inst_id, "handle_fee_paid" ); |
1105 |
$ils->check_inst_id( $inst_id, "handle_fee_paid" ); |
1105 |
|
1106 |
|
1106 |
$status = $ils->pay_fee( $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff, $disallow_overpayment ); |
1107 |
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 ); |
|
|
1108 |
$status = $pay_result->{status}; |
1109 |
my $pay_response = $pay_result->{pay_response}; |
1110 |
|
1111 |
my $failmap = { |
1112 |
"no_item" => "No matching item could be found", |
1113 |
"no_checkout" => "Item is not checked out", |
1114 |
"too_soon" => "Cannot yet be renewed", |
1115 |
"too_many" => "Renewed the maximum number of times", |
1116 |
"auto_too_soon" => "Scheduled for automatic renewal and cannot yet be renewed", |
1117 |
"auto_too_late" => "Scheduled for automatic renewal and cannot yet be any more", |
1118 |
"auto_account_expired" => "Scheduled for automatic renewal and cannot be renewed because the patron's account has expired", |
1119 |
"auto_renew" => "Scheduled for automatic renewal", |
1120 |
"auto_too_much_oweing" => "Scheduled for automatic renewal", |
1121 |
"on_reserve" => "On hold for another patron", |
1122 |
"patron_restricted" => "Patron is currently restricted", |
1123 |
"item_denied_renewal" => "Item is not allowed renewal", |
1124 |
"onsite_checkout" => "Item is an onsite checkout" |
1125 |
}; |
1126 |
my @success = (); |
1127 |
my @fail = (); |
1128 |
foreach my $result( @{$pay_response->{renew_result}} ) { |
1129 |
my $item = Koha::Items->find({ itemnumber => $result->{itemnumber} }); |
1130 |
if ($result->{success}) { |
1131 |
push @success, '"' . $item->biblio->title . '"'; |
1132 |
} else { |
1133 |
push @fail, '"' . $item->biblio->title . '" : ' . $failmap->{$result->{error}}; |
1134 |
} |
1135 |
} |
1136 |
|
1137 |
my $msg = ""; |
1138 |
if (scalar @success > 0) { |
1139 |
$msg.="The following items were renewed: " . join(", ", @success) . ". "; |
1140 |
} |
1141 |
if (scalar @fail > 0) { |
1142 |
$msg.="The following items were not renewed: " . join(", ", @fail) . "."; |
1143 |
} |
1144 |
if (length $msg > 0) { |
1145 |
$status->screen_msg($status->screen_msg . " $msg"); |
1146 |
} |
1107 |
|
1147 |
|
1108 |
$resp .= ( $status->ok ? 'Y' : 'N' ) . timestamp; |
1148 |
$resp .= ( $status->ok ? 'Y' : 'N' ) . timestamp; |
1109 |
$resp .= add_field( FID_INST_ID, $inst_id, $server ); |
1149 |
$resp .= add_field( FID_INST_ID, $inst_id, $server ); |
1110 |
- |
|
|