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

(-)a/C4/Accounts.pm (-26 / +35 lines)
Lines 169-199 sub makepayment { Link Here
169
    my $data = $sth->fetchrow_hashref;
169
    my $data = $sth->fetchrow_hashref;
170
    $sth->finish;
170
    $sth->finish;
171
171
172
    $dbh->do(
172
	if($data->{'accounttype'} eq "Pay"){
173
        "UPDATE  accountlines
173
		my $udp = 		
174
        SET     amountoutstanding = 0
174
			$dbh->prepare(
175
        WHERE   borrowernumber = $borrowernumber
175
				"UPDATE accountlines
176
          AND   accountno = $accountno
176
			   		SET amountoutstanding = 0, description = 'Payment,thanks'
177
        "
177
					WHERE borrowernumber = ?
178
    );
178
				  	AND accountno = ?
179
179
				"
180
    #  print $updquery;
180
			);
181
#    $dbh->do( "
181
		$udp->execute($borrowernumber, $accountno );
182
#        INSERT INTO     accountoffsets
182
		$udp->finish;
183
#                        (borrowernumber, accountno, offsetaccount,
183
	}else{
184
#                         offsetamount)
184
		my $udp = 		
185
#        VALUES          ($borrowernumber, $accountno, $nextaccntno, $newamtos)
185
			$dbh->prepare(
186
#        " );
186
				"UPDATE accountlines
187
187
			   		SET amountoutstanding = 0
188
    # create new line
188
					WHERE borrowernumber = ?
189
    my $payment = 0 - $amount;
189
				  	AND accountno = ?
190
    $dbh->do( "
190
				"
191
        INSERT INTO     accountlines
191
			);
192
                        (borrowernumber, accountno, date, amount,
192
		$udp->execute($borrowernumber, $accountno );
193
                         description, accounttype, amountoutstanding)
193
		$udp->finish;
194
        VALUES          ($borrowernumber, $nextaccntno, now(), $payment,
194
195
                        'Payment,thanks - $user', 'Pay', 0)
195
		 # create new line
196
        " );
196
		my $payment = 0 - $amount;
197
		
198
		my $ins = 
199
			$dbh->prepare( 
200
				"INSERT 
201
					INTO accountlines (borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding)
202
					VALUES ( ?, ?, now(), ?, 'Payment,thanks', 'Pay', 0)"
203
			);
204
		$ins->execute($borrowernumber, $nextaccntno, $payment);
205
		$ins->finish;
206
	}
197
207
198
    # FIXME - The second argument to &UpdateStats is supposed to be the
208
    # FIXME - The second argument to &UpdateStats is supposed to be the
199
    # branch code.
209
    # branch code.
200
- 

Return to bug 5713