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

(-)a/C4/Accounts.pm (-6 / +12 lines)
Lines 60-70 patron. Link Here
60
60
61
=head2 recordpayment
61
=head2 recordpayment
62
62
63
  &recordpayment($borrowernumber, $payment);
63
  &recordpayment($borrowernumber, $payment, $sip_paytype);
64
64
65
Record payment by a patron. C<$borrowernumber> is the patron's
65
Record payment by a patron. C<$borrowernumber> is the patron's
66
borrower number. C<$payment> is a floating-point number, giving the
66
borrower number. C<$payment> is a floating-point number, giving the
67
amount that was paid. 
67
amount that was paid. C<$sip_paytype> is an optional flag to indicate this
68
payment was made over a SIP2 interface, rather than the staff client. The
69
value passed is the SIP2 payment type value (message 37, characters 21-22)
68
70
69
Amounts owed are paid off oldest first. That is, if the patron has a
71
Amounts owed are paid off oldest first. That is, if the patron has a
70
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment
72
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment
Lines 77-83 will be credited to the next one. Link Here
77
sub recordpayment {
79
sub recordpayment {
78
80
79
    #here we update the account lines
81
    #here we update the account lines
80
    my ( $borrowernumber, $data ) = @_;
82
    my ( $borrowernumber, $data, $sip_paytype ) = @_;
81
    my $dbh        = C4::Context->dbh;
83
    my $dbh        = C4::Context->dbh;
82
    my $newamtos   = 0;
84
    my $newamtos   = 0;
83
    my $accdata    = "";
85
    my $accdata    = "";
Lines 126-134 sub recordpayment { Link Here
126
    my $usth = $dbh->prepare(
128
    my $usth = $dbh->prepare(
127
        "INSERT INTO accountlines
129
        "INSERT INTO accountlines
128
  (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding)
130
  (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding)
129
  VALUES (?,?,now(),?,'Payment,thanks','Pay',?)"
131
  VALUES (?,?,now(),?,?,?,?)"
130
    );
132
    );
131
    $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft );
133
    my $payment_description = "Payment, thanks";
134
    $payment_description .= " (via SIP2)" if defined $sip_paytype;
135
    my $paytype = "Pay";
136
    $paytype .= "-$sip_paytype" if defined $sip_paytype;
137
    $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $payment_description, $paytype, 0 - $amountleft );
132
    $usth->finish;
138
    $usth->finish;
133
    UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno );
139
    UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno );
134
    $sth->finish;
140
    $sth->finish;
Lines 602-608 sub getcredits { Link Here
602
	my $dbh = C4::Context->dbh;
608
	my $dbh = C4::Context->dbh;
603
	my $sth = $dbh->prepare(
609
	my $sth = $dbh->prepare(
604
			        "SELECT * FROM accountlines,borrowers
610
			        "SELECT * FROM accountlines,borrowers
605
      WHERE amount < 0 AND accounttype <> 'Pay' AND accountlines.borrowernumber = borrowers.borrowernumber
611
      WHERE amount < 0 AND accounttype not like 'Pay%' AND accountlines.borrowernumber = borrowers.borrowernumber
606
	  AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)"
612
	  AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)"
607
      );  
613
      );  
608
614
(-)a/C4/SIP/ILS.pm (-1 / +1 lines)
Lines 229-235 sub pay_fee { Link Here
229
        $trans->screen_msg('Invalid patron barcode.');
229
        $trans->screen_msg('Invalid patron barcode.');
230
        return $trans;
230
        return $trans;
231
    }
231
    }
232
    $trans->pay($patron->{borrowernumber},$fee_amt);
232
    $trans->pay($patron->{borrowernumber},$fee_amt, $pay_type);
233
    $trans->ok(1);
233
    $trans->ok(1);
234
234
235
    return $trans;
235
    return $trans;
(-)a/C4/SIP/ILS/Transaction/FeePayment.pm (-1 / +2 lines)
Lines 47-54 sub pay { Link Here
47
    my $self           = shift;
47
    my $self           = shift;
48
    my $borrowernumber = shift;
48
    my $borrowernumber = shift;
49
    my $amt            = shift;
49
    my $amt            = shift;
50
    my $type           = shift;
50
    warn("RECORD:$borrowernumber::$amt");
51
    warn("RECORD:$borrowernumber::$amt");
51
    recordpayment( $borrowernumber, $amt );
52
    recordpayment( $borrowernumber, $amt,$type );
52
}
53
}
53
54
54
#sub DESTROY {
55
#sub DESTROY {
(-)a/members/boraccount.pl (-1 / +1 lines)
Lines 84-90 foreach my $accountline ( @{$accts}) { Link Here
84
    $accountline->{date} = format_date($accountline->{date});
84
    $accountline->{date} = format_date($accountline->{date});
85
    $accountline->{amount} = sprintf '%.2f', $accountline->{amount};
85
    $accountline->{amount} = sprintf '%.2f', $accountline->{amount};
86
    $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding};
86
    $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding};
87
    if ($accountline->{accounttype} eq 'Pay') {
87
    if ($accountline->{accounttype} =~ /^Pay/) {
88
        $accountline->{payment} = 1;
88
        $accountline->{payment} = 1;
89
        $reverse_col = 1;
89
        $reverse_col = 1;
90
    }
90
    }
(-)a/members/printfeercpt.pl (-1 / +1 lines)
Lines 99-105 for (my $i=0;$i<$numaccts;$i++){ Link Here
99
                'amount'            => sprintf("%.2f",$accts->[$i]{'amount'}),
99
                'amount'            => sprintf("%.2f",$accts->[$i]{'amount'}),
100
                'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}),
100
                'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}),
101
                'accountno' => $accts->[$i]{'accountno'},
101
                'accountno' => $accts->[$i]{'accountno'},
102
                'payment' => ( $accts->[$i]{'accounttype'} eq 'Pay' ),
102
                'payment' => ( $accts->[$i]{'accounttype'} =~ /^Pay/ ),
103
103
104
                );
104
                );
105
105
(-)a/members/printinvoice.pl (-2 / +1 lines)
Lines 98-104 for (my $i=0;$i<$numaccts;$i++){ Link Here
98
                'amount'            => sprintf("%.2f",$accts->[$i]{'amount'}),
98
                'amount'            => sprintf("%.2f",$accts->[$i]{'amount'}),
99
                'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}),
99
                'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}),
100
                'accountno' => $accts->[$i]{'accountno'},
100
                'accountno' => $accts->[$i]{'accountno'},
101
                'payment' => ( $accts->[$i]{'accounttype'} eq 'Pay' ),
101
                'payment' => ( $accts->[$i]{'accounttype'} =~ /^Pay/ ),
102
102
103
                );
103
                );
104
104
105
- 

Return to bug 6273