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

(-)a/C4/SIP/ILS.pm (-4 / +3 lines)
Lines 247-256 sub end_patron_session { Link Here
247
}
247
}
248
248
249
sub pay_fee {
249
sub pay_fee {
250
    my ($self, $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency) = @_;
250
    my ($self, $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff) = @_;
251
    my $trans;
252
251
253
    $trans = C4::SIP::ILS::Transaction::FeePayment->new();
252
    my $trans = C4::SIP::ILS::Transaction::FeePayment->new();
254
253
255
    $trans->transaction_id($trans_id);
254
    $trans->transaction_id($trans_id);
256
    my $patron;
255
    my $patron;
Lines 259-265 sub pay_fee { Link Here
259
        $trans->screen_msg('Invalid patron barcode.');
258
        $trans->screen_msg('Invalid patron barcode.');
260
        return $trans;
259
        return $trans;
261
    }
260
    }
262
    my $ok =$trans->pay($patron->{borrowernumber},$fee_amt, $pay_type, $fee_id);
261
    my $ok = $trans->pay( $patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff );
263
    $trans->ok($ok);
262
    $trans->ok($ok);
264
263
265
    return $trans;
264
    return $trans;
(-)a/C4/SIP/ILS/Transaction/FeePayment.pm (-3 / +19 lines)
Lines 45-52 sub pay { Link Here
45
    my $self           = shift;
45
    my $self           = shift;
46
    my $borrowernumber = shift;
46
    my $borrowernumber = shift;
47
    my $amt            = shift;
47
    my $amt            = shift;
48
    my $type           = shift;
48
    my $sip_type       = shift;
49
    my $fee_id         = shift;
49
    my $fee_id         = shift;
50
    my $is_writeoff    = shift;
51
52
    my $type = $is_writeoff ? 'writeoff' : undef;
50
53
51
    warn("RECORD:$borrowernumber::$amt");
54
    warn("RECORD:$borrowernumber::$amt");
52
55
Lines 55-61 sub pay { Link Here
55
    if ($fee_id) {
58
    if ($fee_id) {
56
        my $fee = Koha::Account::Lines->find($fee_id);
59
        my $fee = Koha::Account::Lines->find($fee_id);
57
        if ( $fee && $fee->amountoutstanding == $amt ) {
60
        if ( $fee && $fee->amountoutstanding == $amt ) {
58
            $account->pay( { amount => $amt, sip => $type, lines => [$fee] } );
61
            $account->pay(
62
                {
63
                    amount => $amt,
64
                    sip    => $sip_type,
65
                    type   => $type,
66
                    lines  => [$fee],
67
                }
68
            );
59
            return 1;
69
            return 1;
60
        }
70
        }
61
        else {
71
        else {
Lines 63-69 sub pay { Link Here
63
        }
73
        }
64
    }
74
    }
65
    else {
75
    else {
66
        $account->pay( { amount => $amt, sip => $type } );
76
        $account->pay(
77
            {
78
                amount => $amt,
79
                sip    => $sip_type,
80
                type   => $type,
81
            }
82
        );
67
        return 1;
83
        return 1;
68
    }
84
    }
69
}
85
}
(-)a/C4/SIP/Sip/MsgType.pm (-1 / +4 lines)
Lines 1068-1073 sub handle_fee_paid { Link Here
1068
    my $status;
1068
    my $status;
1069
    my $resp = FEE_PAID_RESP;
1069
    my $resp = FEE_PAID_RESP;
1070
1070
1071
    my $payment_type_writeoff = $server->{account}->{payment_type_writeoff};
1072
    my $is_writeoff = $pay_type eq $payment_type_writeoff;
1073
1071
    $fee_amt    = $fields->{ (FID_FEE_AMT) };
1074
    $fee_amt    = $fields->{ (FID_FEE_AMT) };
1072
    $inst_id    = $fields->{ (FID_INST_ID) };
1075
    $inst_id    = $fields->{ (FID_INST_ID) };
1073
    $patron_id  = $fields->{ (FID_PATRON_ID) };
1076
    $patron_id  = $fields->{ (FID_PATRON_ID) };
Lines 1077-1083 sub handle_fee_paid { Link Here
1077
1080
1078
    $ils->check_inst_id( $inst_id, "handle_fee_paid" );
1081
    $ils->check_inst_id( $inst_id, "handle_fee_paid" );
1079
1082
1080
    $status = $ils->pay_fee( $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency );
1083
    $status = $ils->pay_fee( $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff );
1081
1084
1082
    $resp .= ( $status->ok ? 'Y' : 'N' ) . timestamp;
1085
    $resp .= ( $status->ok ? 'Y' : 'N' ) . timestamp;
1083
    $resp .= add_field( FID_INST_ID,   $inst_id );
1086
    $resp .= add_field( FID_INST_ID,   $inst_id );
(-)a/etc/SIPconfig.xml (-2 / +1 lines)
Lines 44-50 Link Here
44
  </listeners>
44
  </listeners>
45
45
46
  <accounts>
46
  <accounts>
47
      <login id="term1"  password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="ascii" checked_in_ok="1" />
47
      <login id="term1"  password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="ascii" checked_in_ok="1" payment_type_writeoff="06" />
48
      <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="utf8" />
48
      <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="utf8" />
49
      <login id="koha2"  password="koha" institution="kohalibrary2" terminator="CR" />
49
      <login id="koha2"  password="koha" institution="kohalibrary2" terminator="CR" />
50
      <login id="lpl-sc" password="1234" institution="LPL" />
50
      <login id="lpl-sc" password="1234" institution="LPL" />
51
- 

Return to bug 16895