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

(-)a/C4/Accounts.pm (-6 / +14 lines)
Lines 70-80 patron. Link Here
70
70
71
=head2 recordpayment
71
=head2 recordpayment
72
72
73
  &recordpayment($borrowernumber, $payment);
73
  &recordpayment($borrowernumber, $payment, $sip_paytype);
74
74
75
Record payment by a patron. C<$borrowernumber> is the patron's
75
Record payment by a patron. C<$borrowernumber> is the patron's
76
borrower number. C<$payment> is a floating-point number, giving the
76
borrower number. C<$payment> is a floating-point number, giving the
77
amount that was paid.
77
amount that was paid. C<$sip_paytype> is an optional flag to indicate this
78
payment was made over a SIP2 interface, rather than the staff client. The
79
value passed is the SIP2 payment type value (message 37, characters 21-22)
78
80
79
Amounts owed are paid off oldest first. That is, if the patron has a
81
Amounts owed are paid off oldest first. That is, if the patron has a
80
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment
82
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment
Lines 87-93 will be credited to the next one. Link Here
87
sub recordpayment {
89
sub recordpayment {
88
90
89
    #here we update the account lines
91
    #here we update the account lines
90
    my ( $borrowernumber, $data ) = @_;
92
    my ( $borrowernumber, $data, $sip_paytype ) = @_;
91
    my $dbh        = C4::Context->dbh;
93
    my $dbh        = C4::Context->dbh;
92
    my $newamtos   = 0;
94
    my $newamtos   = 0;
93
    my $accdata    = "";
95
    my $accdata    = "";
Lines 145-153 sub recordpayment { Link Here
145
    my $usth = $dbh->prepare(
147
    my $usth = $dbh->prepare(
146
        "INSERT INTO accountlines
148
        "INSERT INTO accountlines
147
  (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id)
149
  (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id)
148
  VALUES (?,?,now(),?,'','Pay',?,?)"
150
  VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)"
149
    );
151
    );
150
    $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id );
152
153
    my $payment_description = "Payment, thanks";
154
    $payment_description .= " (via SIP2)" if defined $sip_paytype;
155
    my $paytype = "Pay";
156
    $paytype .= "-$sip_paytype" if defined $sip_paytype;
157
    $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $payment_description, $paytype, 0 - $amountleft, $manager_id );
158
    $usth->finish;
151
159
152
    UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno );
160
    UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno );
153
161
Lines 485-491 sub getcredits { Link Here
485
	my $dbh = C4::Context->dbh;
493
	my $dbh = C4::Context->dbh;
486
	my $sth = $dbh->prepare(
494
	my $sth = $dbh->prepare(
487
			        "SELECT * FROM accountlines,borrowers
495
			        "SELECT * FROM accountlines,borrowers
488
      WHERE amount < 0 AND accounttype <> 'Pay' AND accountlines.borrowernumber = borrowers.borrowernumber
496
      WHERE amount < 0 AND accounttype not like 'Pay%' AND accountlines.borrowernumber = borrowers.borrowernumber
489
	  AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)"
497
	  AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)"
490
      );  
498
      );  
491
499
(-)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 46-53 sub pay { Link Here
46
    my $self           = shift;
46
    my $self           = shift;
47
    my $borrowernumber = shift;
47
    my $borrowernumber = shift;
48
    my $amt            = shift;
48
    my $amt            = shift;
49
    my $type           = shift;
49
    warn("RECORD:$borrowernumber::$amt");
50
    warn("RECORD:$borrowernumber::$amt");
50
    recordpayment( $borrowernumber, $amt );
51
    recordpayment( $borrowernumber, $amt,$type );
51
}
52
}
52
53
53
#sub DESTROY {
54
#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 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
    if ( $accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU' ) {
105
    if ( $accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU' ) {
106
- 

Return to bug 6273