Lines 202-208
sub makepayment {
Link Here
|
202 |
my $sth = $dbh->prepare("SELECT * FROM accountlines WHERE accountlines_id=?"); |
202 |
my $sth = $dbh->prepare("SELECT * FROM accountlines WHERE accountlines_id=?"); |
203 |
$sth->execute( $accountlines_id ); |
203 |
$sth->execute( $accountlines_id ); |
204 |
my $data = $sth->fetchrow_hashref; |
204 |
my $data = $sth->fetchrow_hashref; |
205 |
$sth->finish; |
|
|
206 |
|
205 |
|
207 |
my $payment; |
206 |
my $payment; |
208 |
if ( $data->{'accounttype'} eq "Pay" ){ |
207 |
if ( $data->{'accounttype'} eq "Pay" ){ |
Lines 214-220
sub makepayment {
Link Here
|
214 |
" |
213 |
" |
215 |
); |
214 |
); |
216 |
$udp->execute($accountlines_id); |
215 |
$udp->execute($accountlines_id); |
217 |
$udp->finish; |
|
|
218 |
}else{ |
216 |
}else{ |
219 |
my $udp = |
217 |
my $udp = |
220 |
$dbh->prepare( |
218 |
$dbh->prepare( |
Lines 224-230
sub makepayment {
Link Here
|
224 |
" |
222 |
" |
225 |
); |
223 |
); |
226 |
$udp->execute($accountlines_id); |
224 |
$udp->execute($accountlines_id); |
227 |
$udp->finish; |
|
|
228 |
|
225 |
|
229 |
# create new line |
226 |
# create new line |
230 |
my $payment = 0 - $amount; |
227 |
my $payment = 0 - $amount; |
Lines 237-243
sub makepayment {
Link Here
|
237 |
VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?, ?)" |
234 |
VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?, ?)" |
238 |
); |
235 |
); |
239 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note); |
236 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note); |
240 |
$ins->finish; |
|
|
241 |
} |
237 |
} |
242 |
|
238 |
|
243 |
if ( C4::Context->preference("FinesLog") ) { |
239 |
if ( C4::Context->preference("FinesLog") ) { |
Lines 279-285
sub makepayment {
Link Here
|
279 |
my $sthr = $dbh->prepare("SELECT max(accountlines_id) AS lastinsertid FROM accountlines"); |
275 |
my $sthr = $dbh->prepare("SELECT max(accountlines_id) AS lastinsertid FROM accountlines"); |
280 |
$sthr->execute(); |
276 |
$sthr->execute(); |
281 |
my $datalastinsertid = $sthr->fetchrow_hashref; |
277 |
my $datalastinsertid = $sthr->fetchrow_hashref; |
282 |
$sthr->finish; |
|
|
283 |
return $datalastinsertid->{'lastinsertid'}; |
278 |
return $datalastinsertid->{'lastinsertid'}; |
284 |
} |
279 |
} |
285 |
|
280 |
|
Lines 364-370
sub chargelostitem{
Link Here
|
364 |
VALUES (?,?,now(),?,?,'L',?,?,?)"); |
359 |
VALUES (?,?,now(),?,?,'L',?,?,?)"); |
365 |
$sth2->execute($borrowernumber,$accountno,$amount, |
360 |
$sth2->execute($borrowernumber,$accountno,$amount, |
366 |
$description,$amount,$itemnumber,$manager_id); |
361 |
$description,$amount,$itemnumber,$manager_id); |
367 |
$sth2->finish; |
|
|
368 |
|
362 |
|
369 |
if ( C4::Context->preference("FinesLog") ) { |
363 |
if ( C4::Context->preference("FinesLog") ) { |
370 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
364 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
Lines 532-538
sub fixcredit {
Link Here
|
532 |
my $sth = $dbh->prepare($query); |
526 |
my $sth = $dbh->prepare($query); |
533 |
$sth->execute( $borrowernumber, $item->{'itemnumber'} ); |
527 |
$sth->execute( $borrowernumber, $item->{'itemnumber'} ); |
534 |
$accdata = $sth->fetchrow_hashref; |
528 |
$accdata = $sth->fetchrow_hashref; |
535 |
$sth->finish; |
|
|
536 |
if ( $accdata->{'amountoutstanding'} < $amountleft ) { |
529 |
if ( $accdata->{'amountoutstanding'} < $amountleft ) { |
537 |
$newamtos = 0; |
530 |
$newamtos = 0; |
538 |
$amountleft -= $accdata->{'amountoutstanding'}; |
531 |
$amountleft -= $accdata->{'amountoutstanding'}; |
Lines 547-553
sub fixcredit {
Link Here
|
547 |
WHERE (accountlines_id = ?)" |
540 |
WHERE (accountlines_id = ?)" |
548 |
); |
541 |
); |
549 |
$usth->execute( $newamtos, $thisacct ); |
542 |
$usth->execute( $newamtos, $thisacct ); |
550 |
$usth->finish; |
|
|
551 |
$usth = $dbh->prepare( |
543 |
$usth = $dbh->prepare( |
552 |
"INSERT INTO accountoffsets |
544 |
"INSERT INTO accountoffsets |
553 |
(borrowernumber, accountno, offsetaccount, offsetamount) |
545 |
(borrowernumber, accountno, offsetaccount, offsetamount) |
Lines 555-561
sub fixcredit {
Link Here
|
555 |
); |
547 |
); |
556 |
$usth->execute( $borrowernumber, $accdata->{'accountno'}, |
548 |
$usth->execute( $borrowernumber, $accdata->{'accountno'}, |
557 |
$nextaccntno, $newamtos ); |
549 |
$nextaccntno, $newamtos ); |
558 |
$usth->finish; |
|
|
559 |
} |
550 |
} |
560 |
|
551 |
|
561 |
# begin transaction |
552 |
# begin transaction |
Lines 586-592
sub fixcredit {
Link Here
|
586 |
WHERE (accountlines_id = ?)" |
577 |
WHERE (accountlines_id = ?)" |
587 |
); |
578 |
); |
588 |
$usth->execute( $newamtos, $thisacct ); |
579 |
$usth->execute( $newamtos, $thisacct ); |
589 |
$usth->finish; |
|
|
590 |
$usth = $dbh->prepare( |
580 |
$usth = $dbh->prepare( |
591 |
"INSERT INTO accountoffsets |
581 |
"INSERT INTO accountoffsets |
592 |
(borrowernumber, accountno, offsetaccount, offsetamount) |
582 |
(borrowernumber, accountno, offsetaccount, offsetamount) |
Lines 594-602
sub fixcredit {
Link Here
|
594 |
); |
584 |
); |
595 |
$usth->execute( $borrowernumber, $accdata->{'accountno'}, |
585 |
$usth->execute( $borrowernumber, $accdata->{'accountno'}, |
596 |
$nextaccntno, $newamtos ); |
586 |
$nextaccntno, $newamtos ); |
597 |
$usth->finish; |
|
|
598 |
} |
587 |
} |
599 |
$sth->finish; |
|
|
600 |
$type = "Credit " . $type; |
588 |
$type = "Credit " . $type; |
601 |
UpdateStats( $user, $type, $data, $user, '', '', $borrowernumber ); |
589 |
UpdateStats( $user, $type, $data, $user, '', '', $borrowernumber ); |
602 |
$amountleft *= -1; |
590 |
$amountleft *= -1; |
Lines 652-658
sub refund {
Link Here
|
652 |
WHERE (accountlines_id = ?)" |
640 |
WHERE (accountlines_id = ?)" |
653 |
); |
641 |
); |
654 |
$usth->execute( $newamtos, $thisacct ); |
642 |
$usth->execute( $newamtos, $thisacct ); |
655 |
$usth->finish; |
|
|
656 |
$usth = $dbh->prepare( |
643 |
$usth = $dbh->prepare( |
657 |
"INSERT INTO accountoffsets |
644 |
"INSERT INTO accountoffsets |
658 |
(borrowernumber, accountno, offsetaccount, offsetamount) |
645 |
(borrowernumber, accountno, offsetaccount, offsetamount) |
Lines 660-668
sub refund {
Link Here
|
660 |
); |
647 |
); |
661 |
$usth->execute( $borrowernumber, $accdata->{'accountno'}, |
648 |
$usth->execute( $borrowernumber, $accdata->{'accountno'}, |
662 |
$nextaccntno, $newamtos ); |
649 |
$nextaccntno, $newamtos ); |
663 |
$usth->finish; |
|
|
664 |
} |
650 |
} |
665 |
$sth->finish; |
|
|
666 |
return ($amountleft); |
651 |
return ($amountleft); |
667 |
} |
652 |
} |
668 |
|
653 |
|
669 |
- |
|
|