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

(-)a/C4/Accounts.pm (-7 / +13 lines)
Lines 68-78 patron. Link Here
68
68
69
=head2 recordpayment
69
=head2 recordpayment
70
70
71
  &recordpayment($borrowernumber, $payment);
71
  &recordpayment($borrowernumber, $payment, $sip_paytype);
72
72
73
Record payment by a patron. C<$borrowernumber> is the patron's
73
Record payment by a patron. C<$borrowernumber> is the patron's
74
borrower number. C<$payment> is a floating-point number, giving the
74
borrower number. C<$payment> is a floating-point number, giving the
75
amount that was paid. 
75
amount that was paid. C<$sip_paytype> is an optional flag to indicate this
76
payment was made over a SIP2 interface, rather than the staff client. The
77
value passed is the SIP2 payment type value (message 37, characters 21-22)
76
78
77
Amounts owed are paid off oldest first. That is, if the patron has a
79
Amounts owed are paid off oldest first. That is, if the patron has a
78
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment
80
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment
Lines 85-91 will be credited to the next one. Link Here
85
sub recordpayment {
87
sub recordpayment {
86
88
87
    #here we update the account lines
89
    #here we update the account lines
88
    my ( $borrowernumber, $data ) = @_;
90
    my ( $borrowernumber, $data, $sip_paytype ) = @_;
89
    my $dbh        = C4::Context->dbh;
91
    my $dbh        = C4::Context->dbh;
90
    my $newamtos   = 0;
92
    my $newamtos   = 0;
91
    my $accdata    = "";
93
    my $accdata    = "";
Lines 135-144 sub recordpayment { Link Here
135
    # create new line
137
    # create new line
136
    my $usth = $dbh->prepare(
138
    my $usth = $dbh->prepare(
137
        "INSERT INTO accountlines
139
        "INSERT INTO accountlines
138
  (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id)
140
  (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding, manager_id)
139
  VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)"
141
  VALUES (?,?,now(),?,?,?,?,?)"
140
    );
142
    );
141
    $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id );
143
    my $payment_description = "Payment, thanks";
144
    $payment_description .= " (via SIP2)" if defined $sip_paytype;
145
    my $paytype = "Pay";
146
    $paytype .= "-$sip_paytype" if defined $sip_paytype;
147
    $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $payment_description, $paytype, 0 - $amountleft, $manager_id );
142
    $usth->finish;
148
    $usth->finish;
143
    UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno );
149
    UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno );
144
    $sth->finish;
150
    $sth->finish;
Lines 614-620 sub getcredits { Link Here
614
	my $dbh = C4::Context->dbh;
620
	my $dbh = C4::Context->dbh;
615
	my $sth = $dbh->prepare(
621
	my $sth = $dbh->prepare(
616
			        "SELECT * FROM accountlines,borrowers
622
			        "SELECT * FROM accountlines,borrowers
617
      WHERE amount < 0 AND accounttype <> 'Pay' AND accountlines.borrowernumber = borrowers.borrowernumber
623
      WHERE amount < 0 AND accounttype not like 'Pay%' AND accountlines.borrowernumber = borrowers.borrowernumber
618
	  AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)"
624
	  AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)"
619
      );  
625
      );  
620
626
(-)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