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

(-)a/C4/Accounts.pm (-5 / +8 lines)
Lines 70-76 patron. Link Here
70
70
71
=head2 recordpayment
71
=head2 recordpayment
72
72
73
  &recordpayment($borrowernumber, $payment, $sip_paytype);
73
  &recordpayment($borrowernumber, $payment, $sip_paytype, $note);
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
Lines 89-95 will be credited to the next one. Link Here
89
sub recordpayment {
89
sub recordpayment {
90
90
91
    #here we update the account lines
91
    #here we update the account lines
92
    my ( $borrowernumber, $data, $sip_paytype ) = @_;
92
    my ( $borrowernumber, $data, $sip_paytype, $payment_note ) = @_;
93
    my $dbh        = C4::Context->dbh;
93
    my $dbh        = C4::Context->dbh;
94
    my $newamtos   = 0;
94
    my $newamtos   = 0;
95
    my $accdata    = "";
95
    my $accdata    = "";
Lines 98-103 sub recordpayment { Link Here
98
    my $manager_id = 0;
98
    my $manager_id = 0;
99
    $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
99
    $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
100
100
101
    $payment_note //= "";
102
101
    # begin transaction
103
    # begin transaction
102
    my $nextaccntno = getnextacctno($borrowernumber);
104
    my $nextaccntno = getnextacctno($borrowernumber);
103
105
Lines 138-143 sub recordpayment { Link Here
138
                accountlines_id       => $accdata->{'accountlines_id'},
140
                accountlines_id       => $accdata->{'accountlines_id'},
139
                accountno             => $accdata->{'accountno'},
141
                accountno             => $accdata->{'accountno'},
140
                manager_id            => $manager_id,
142
                manager_id            => $manager_id,
143
                note                  => $payment_note,
141
            }));
144
            }));
142
            push( @ids, $accdata->{'accountlines_id'} );
145
            push( @ids, $accdata->{'accountlines_id'} );
143
        }
146
        }
Lines 146-158 sub recordpayment { Link Here
146
    # create new line
149
    # create new line
147
    my $usth = $dbh->prepare(
150
    my $usth = $dbh->prepare(
148
        "INSERT INTO accountlines
151
        "INSERT INTO accountlines
149
  (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id)
152
  (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id, note)
150
  VALUES (?,?,now(),?,'',?,?,?)"
153
  VALUES (?,?,now(),?,'',?,?,?,?)"
151
    );
154
    );
152
155
153
    my $paytype = "Pay";
156
    my $paytype = "Pay";
154
    $paytype .= $sip_paytype if defined $sip_paytype;
157
    $paytype .= $sip_paytype if defined $sip_paytype;
155
    $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $paytype, 0 - $amountleft, $manager_id );
158
    $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $paytype, 0 - $amountleft, $manager_id, $payment_note );
156
    $usth->finish;
159
    $usth->finish;
157
160
158
    UpdateStats({
161
    UpdateStats({
(-)a/members/paycollect.pl (-2 / +2 lines)
Lines 126-132 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
126
                my $note = $input->param('selected_accts_notes');
126
                my $note = $input->param('selected_accts_notes');
127
                recordpayment_selectaccts( $borrowernumber, $total_paid, \@acc, $note );
127
                recordpayment_selectaccts( $borrowernumber, $total_paid, \@acc, $note );
128
            } else {
128
            } else {
129
                recordpayment( $borrowernumber, $total_paid );
129
                my $note = $input->param('selected_accts_notes');
130
                recordpayment( $borrowernumber, $total_paid, '', $note );
130
            }
131
            }
131
132
132
# recordpayment does not return success or failure so lets redisplay the boraccount
133
# recordpayment does not return success or failure so lets redisplay the boraccount
133
- 

Return to bug 12865