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

(-)a/C4/SIP/ILS.pm (-2 / +2 lines)
Lines 250-256 sub end_patron_session { Link Here
250
}
250
}
251
251
252
sub pay_fee {
252
sub pay_fee {
253
    my ($self, $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff) = @_;
253
    my ($self, $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff, $disallow_overpayment ) = @_;
254
254
255
    my $trans = C4::SIP::ILS::Transaction::FeePayment->new();
255
    my $trans = C4::SIP::ILS::Transaction::FeePayment->new();
256
256
Lines 261-267 sub pay_fee { Link Here
261
        $trans->screen_msg('Invalid patron barcode.');
261
        $trans->screen_msg('Invalid patron barcode.');
262
        return $trans;
262
        return $trans;
263
    }
263
    }
264
    my $ok = $trans->pay( $patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff );
264
    my $ok = $trans->pay( $patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff, $disallow_overpayment );
265
    $trans->ok($ok);
265
    $trans->ok($ok);
266
266
267
    return $trans;
267
    return $trans;
(-)a/C4/SIP/ILS/Transaction/FeePayment.pm (-6 / +11 lines)
Lines 42-53 sub new { Link Here
42
}
42
}
43
43
44
sub pay {
44
sub pay {
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 $sip_type       = shift;
48
    my $sip_type             = shift;
49
    my $fee_id         = shift;
49
    my $fee_id               = shift;
50
    my $is_writeoff    = shift;
50
    my $is_writeoff          = shift;
51
    my $disallow_overpayment = shift;
51
52
52
    my $type = $is_writeoff ? 'writeoff' : undef;
53
    my $type = $is_writeoff ? 'writeoff' : undef;
53
54
Lines 55-60 sub pay { Link Here
55
56
56
    my $account = Koha::Account->new( { patron_id => $borrowernumber } );
57
    my $account = Koha::Account->new( { patron_id => $borrowernumber } );
57
58
59
    if ($disallow_overpayment) {
60
        return 0 if $account->balance < $amt;
61
    }
62
58
    if ($fee_id) {
63
    if ($fee_id) {
59
        my $fee = Koha::Account::Lines->find($fee_id);
64
        my $fee = Koha::Account::Lines->find($fee_id);
60
        if ( $fee ) {
65
        if ( $fee ) {
(-)a/C4/SIP/Sip/MsgType.pm (-1 / +3 lines)
Lines 1063-1069 sub handle_fee_paid { Link Here
1063
    my $status;
1063
    my $status;
1064
    my $resp = FEE_PAID_RESP;
1064
    my $resp = FEE_PAID_RESP;
1065
1065
1066
    my $disallow_overpayment  = $server->{account}->{disallow_overpayment};
1066
    my $payment_type_writeoff = $server->{account}->{payment_type_writeoff} || q{};
1067
    my $payment_type_writeoff = $server->{account}->{payment_type_writeoff} || q{};
1068
1067
    my $is_writeoff = $pay_type eq $payment_type_writeoff;
1069
    my $is_writeoff = $pay_type eq $payment_type_writeoff;
1068
1070
1069
    $fee_amt    = $fields->{ (FID_FEE_AMT) };
1071
    $fee_amt    = $fields->{ (FID_FEE_AMT) };
Lines 1075-1081 sub handle_fee_paid { Link Here
1075
1077
1076
    $ils->check_inst_id( $inst_id, "handle_fee_paid" );
1078
    $ils->check_inst_id( $inst_id, "handle_fee_paid" );
1077
1079
1078
    $status = $ils->pay_fee( $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff );
1080
    $status = $ils->pay_fee( $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff, $disallow_overpayment );
1079
1081
1080
    $resp .= ( $status->ok ? 'Y' : 'N' ) . timestamp;
1082
    $resp .= ( $status->ok ? 'Y' : 'N' ) . timestamp;
1081
    $resp .= add_field( FID_INST_ID,   $inst_id );
1083
    $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" payment_type_writeoff="06" />
47
      <login id="staff"  password="staff" delimiter="|" error-detect="enabled" institution="CPL" encoding="ascii" checked_in_ok="1" payment_type_writeoff="06" disallow_overpayment="1" />
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 16899