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

(-)a/C4/SIP/ILS.pm (-2 / +2 lines)
Lines 247-253 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, $is_writeoff) = @_;
250
    my ($self, $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff, $disallow_overpayment ) = @_;
251
251
252
    my $trans = C4::SIP::ILS::Transaction::FeePayment->new();
252
    my $trans = C4::SIP::ILS::Transaction::FeePayment->new();
253
253
Lines 258-264 sub pay_fee { Link Here
258
        $trans->screen_msg('Invalid patron barcode.');
258
        $trans->screen_msg('Invalid patron barcode.');
259
        return $trans;
259
        return $trans;
260
    }
260
    }
261
    my $ok = $trans->pay( $patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff );
261
    my $ok = $trans->pay( $patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff, $disallow_overpayment );
262
    $trans->ok($ok);
262
    $trans->ok($ok);
263
263
264
    return $trans;
264
    return $trans;
(-)a/C4/SIP/ILS/Transaction/FeePayment.pm (-6 / +12 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
        my $balance = $patron->account_balance();
61
        return 0 if $account->balance < $amt;
62
    }
63
58
    if ($fee_id) {
64
    if ($fee_id) {
59
        my $fee = Koha::Account::Lines->find($fee_id);
65
        my $fee = Koha::Account::Lines->find($fee_id);
60
        if ( $fee && $fee->amountoutstanding == $amt ) {
66
        if ( $fee && $fee->amountoutstanding == $amt ) {
(-)a/C4/SIP/Sip/MsgType.pm (-1 / +2 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 $disallow_overpayment = $server->{account}->{disallow_overpayment};
1071
    my $payment_type_writeoff = $server->{account}->{payment_type_writeoff};
1072
    my $payment_type_writeoff = $server->{account}->{payment_type_writeoff};
1072
    my $is_writeoff = $pay_type eq $payment_type_writeoff;
1073
    my $is_writeoff = $pay_type eq $payment_type_writeoff;
1073
1074
Lines 1080-1086 sub handle_fee_paid { Link Here
1080
1081
1081
    $ils->check_inst_id( $inst_id, "handle_fee_paid" );
1082
    $ils->check_inst_id( $inst_id, "handle_fee_paid" );
1082
1083
1083
    $status = $ils->pay_fee( $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff );
1084
    $status = $ils->pay_fee( $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff, $disallow_overpayment );
1084
1085
1085
    $resp .= ( $status->ok ? 'Y' : 'N' ) . timestamp;
1086
    $resp .= ( $status->ok ? 'Y' : 'N' ) . timestamp;
1086
    $resp .= add_field( FID_INST_ID,   $inst_id );
1087
    $resp .= add_field( FID_INST_ID,   $inst_id );
(-)a/Koha/Account/Lines.pm (+10 lines)
Lines 36-41 Koha::Account::Lines - Koha Account Line Object set class Link Here
36
36
37
=cut
37
=cut
38
38
39
=head3 amount_outstanding
40
41
=cut
42
43
sub amount_outstanding {
44
    my ( $self ) = @_;
45
46
    return $self->_resultset()->get_column('amountoutstanding')->sum();
47
}
48
39
=head3 type
49
=head3 type
40
50
41
=cut
51
=cut
(-)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