View | Details | Raw Unified | Return to bug 23051
Collapse All | Expand All

(-)a/C4/SIP/ILS.pm (-2 / +6 lines)
Lines 271-280 sub pay_fee { Link Here
271
        $trans->screen_msg('Invalid patron barcode.');
271
        $trans->screen_msg('Invalid patron barcode.');
272
        return $trans;
272
        return $trans;
273
    }
273
    }
274
    my $ok = $trans->pay( $patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff, $disallow_overpayment );
274
    my $trans_result = $trans->pay( $patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff, $disallow_overpayment );
275
    my $ok = $trans_result->{ok};
275
    $trans->ok($ok);
276
    $trans->ok($ok);
276
277
277
    return $trans;
278
    return {
279
        status       => $trans,
280
        pay_response => $trans_result->{pay_response}
281
    };
278
}
282
}
279
283
280
sub add_hold {
284
sub add_hold {
(-)a/C4/SIP/ILS/Transaction/FeePayment.pm (-6 / +14 lines)
Lines 57-69 sub pay { Link Here
57
    my $account = Koha::Account->new( { patron_id => $borrowernumber } );
57
    my $account = Koha::Account->new( { patron_id => $borrowernumber } );
58
58
59
    if ($disallow_overpayment) {
59
    if ($disallow_overpayment) {
60
        return 0 if $account->balance < $amt;
60
        return { ok => 0 } if $account->balance < $amt;
61
    }
61
    }
62
62
63
    if ($fee_id) {
63
    if ($fee_id) {
64
        my $fee = Koha::Account::Lines->find($fee_id);
64
        my $fee = Koha::Account::Lines->find($fee_id);
65
        if ( $fee ) {
65
        if ( $fee ) {
66
            $account->pay(
66
            my $pay_response = $account->pay(
67
                {
67
                {
68
                    amount       => $amt,
68
                    amount       => $amt,
69
                    type         => $type,
69
                    type         => $type,
Lines 72-85 sub pay { Link Here
72
                    interface    => C4::Context->interface
72
                    interface    => C4::Context->interface
73
                }
73
                }
74
            );
74
            );
75
            return 1;
75
            return {
76
                ok           => 1,
77
                pay_response => $pay_response
78
            };
76
        }
79
        }
77
        else {
80
        else {
78
            return 0;
81
            return { 
82
                ok => 0
83
            };
79
        }
84
        }
80
    }
85
    }
81
    else {
86
    else {
82
        $account->pay(
87
        my $pay_response = $account->pay(
83
            {
88
            {
84
                amount       => $amt,
89
                amount       => $amt,
85
                type         => $type,
90
                type         => $type,
Lines 87-93 sub pay { Link Here
87
                interface    => C4::Context->interface
92
                interface    => C4::Context->interface
88
            }
93
            }
89
        );
94
        );
90
        return 1;
95
        return {
96
            ok           => 1,
97
            pay_response => $pay_response
98
        };
91
    }
99
    }
92
}
100
}
93
101
(-)a/C4/SIP/Sip/MsgType.pm (-2 / +41 lines)
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
- 

Return to bug 23051