|
Lines 144-153
sub recordpayment {
Link Here
|
| 144 |
# create new line |
144 |
# create new line |
| 145 |
my $usth = $dbh->prepare( |
145 |
my $usth = $dbh->prepare( |
| 146 |
"INSERT INTO accountlines |
146 |
"INSERT INTO accountlines |
| 147 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) |
147 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,branchcode) |
| 148 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)" |
148 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?,?)" |
| 149 |
); |
149 |
); |
| 150 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id ); |
150 |
|
|
|
151 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id, $branch ); |
| 151 |
|
152 |
|
| 152 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
153 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
| 153 |
|
154 |
|
|
Lines 229-238
sub makepayment {
Link Here
|
| 229 |
my $ins = |
230 |
my $ins = |
| 230 |
$dbh->prepare( |
231 |
$dbh->prepare( |
| 231 |
"INSERT |
232 |
"INSERT |
| 232 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note) |
233 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note, branchcode) |
| 233 |
VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?, ?)" |
234 |
VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?, ?, ?)" |
| 234 |
); |
235 |
); |
| 235 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note); |
236 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note, C4::Context->userenv->{'branch'}); |
| 236 |
} |
237 |
} |
| 237 |
|
238 |
|
| 238 |
if ( C4::Context->preference("FinesLog") ) { |
239 |
if ( C4::Context->preference("FinesLog") ) { |
|
Lines 354-363
sub chargelostitem{
Link Here
|
| 354 |
# process (or person) to update it, since we don't handle any defaults for replacement prices. |
355 |
# process (or person) to update it, since we don't handle any defaults for replacement prices. |
| 355 |
my $accountno = getnextacctno($borrowernumber); |
356 |
my $accountno = getnextacctno($borrowernumber); |
| 356 |
my $sth2=$dbh->prepare("INSERT INTO accountlines |
357 |
my $sth2=$dbh->prepare("INSERT INTO accountlines |
| 357 |
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber,manager_id) |
358 |
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber,manager_id,branchcode) |
| 358 |
VALUES (?,?,now(),?,?,'L',?,?,?)"); |
359 |
VALUES (?,?,now(),?,?,'L',?,?,?,?)"); |
| 359 |
$sth2->execute($borrowernumber,$accountno,$amount, |
360 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
| 360 |
$description,$amount,$itemnumber,$manager_id); |
361 |
$sth2->execute( $borrowernumber, $accountno, $amount, $description, |
|
|
362 |
$amount, $itemnumber, $manager_id, $branchcode ); |
| 361 |
|
363 |
|
| 362 |
if ( C4::Context->preference("FinesLog") ) { |
364 |
if ( C4::Context->preference("FinesLog") ) { |
| 363 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
365 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
|
Lines 406-411
sub manualinvoice {
Link Here
|
| 406 |
my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_; |
408 |
my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_; |
| 407 |
my $manager_id = 0; |
409 |
my $manager_id = 0; |
| 408 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
410 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
|
|
411 |
my $branchcode = C4::Context->userenv->{'branch'}; |
| 409 |
my $dbh = C4::Context->dbh; |
412 |
my $dbh = C4::Context->dbh; |
| 410 |
my $notifyid = 0; |
413 |
my $notifyid = 0; |
| 411 |
my $insert; |
414 |
my $insert; |
|
Lines 442-457
sub manualinvoice {
Link Here
|
| 442 |
$desc .= ' ' . $itemnum; |
445 |
$desc .= ' ' . $itemnum; |
| 443 |
my $sth = $dbh->prepare( |
446 |
my $sth = $dbh->prepare( |
| 444 |
'INSERT INTO accountlines |
447 |
'INSERT INTO accountlines |
| 445 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id) |
448 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id, branchcode) |
| 446 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?)'); |
449 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?,?)'); |
| 447 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id) || return $sth->errstr; |
450 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id, $branchcode) || return $sth->errstr; |
| 448 |
} else { |
451 |
} else { |
| 449 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
452 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
| 450 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id) |
453 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id, branchcode) |
| 451 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?)" |
454 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?,?)" |
| 452 |
); |
455 |
); |
| 453 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
456 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
| 454 |
$amountleft, $notifyid, $note, $manager_id ); |
457 |
$amountleft, $notifyid, $note, $manager_id, $branchcode ); |
| 455 |
} |
458 |
} |
| 456 |
|
459 |
|
| 457 |
if ( C4::Context->preference("FinesLog") ) { |
460 |
if ( C4::Context->preference("FinesLog") ) { |
|
Lines 655-664
sub recordpayment_selectaccts {
Link Here
|
| 655 |
} |
658 |
} |
| 656 |
|
659 |
|
| 657 |
# create new line |
660 |
# create new line |
| 658 |
$sql = 'INSERT INTO accountlines ' . |
661 |
$sql = q{ |
| 659 |
'(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,note) ' . |
662 |
INSERT INTO accountlines ( |
| 660 |
q|VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?,?)|; |
663 |
borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, manager_id, note, branchcode |
| 661 |
$dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id, $note ); |
664 |
) VALUES ( |
|
|
665 |
?, ?, NOW(), ?, 'Payment,thanks', 'Pay', ?, ?, ?, ? |
| 666 |
) |
| 667 |
}; |
| 668 |
$dbh->do( |
| 669 |
$sql, {}, $borrowernumber, |
| 670 |
$nextaccntno, 0 - $amount, 0 - $amountleft, |
| 671 |
$manager_id, $note, $branch |
| 672 |
); |
| 673 |
|
| 662 |
UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno ); |
674 |
UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno ); |
| 663 |
|
675 |
|
| 664 |
if ( C4::Context->preference("FinesLog") ) { |
676 |
if ( C4::Context->preference("FinesLog") ) { |
|
Lines 696-702
sub makepartialpayment {
Link Here
|
| 696 |
'SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); |
708 |
'SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); |
| 697 |
my $new_outstanding = $data->{amountoutstanding} - $amount; |
709 |
my $new_outstanding = $data->{amountoutstanding} - $amount; |
| 698 |
|
710 |
|
| 699 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
711 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
| 700 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
712 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
| 701 |
|
713 |
|
| 702 |
if ( C4::Context->preference("FinesLog") ) { |
714 |
if ( C4::Context->preference("FinesLog") ) { |
|
Lines 713-724
sub makepartialpayment {
Link Here
|
| 713 |
} |
725 |
} |
| 714 |
|
726 |
|
| 715 |
# create new line |
727 |
# create new line |
| 716 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
728 |
my $insert = q{ |
| 717 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id, note) ' |
729 |
INSERT INTO accountlines ( |
| 718 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)'; |
730 |
borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber, manager_id, note, branchcode |
| 719 |
|
731 |
) VALUES ( |
| 720 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
732 |
?, ?, NOW(), ?, ?, ?, 0, ?, ?, ?, ? |
| 721 |
"Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note); |
733 |
) |
|
|
734 |
}; |
| 735 |
|
| 736 |
$dbh->do( |
| 737 |
$insert, undef, |
| 738 |
$borrowernumber, $nextaccntno, |
| 739 |
$amount, "Payment, thanks - $user", |
| 740 |
'Pay', $data->{'itemnumber'}, |
| 741 |
$manager_id, $payment_note, |
| 742 |
C4::Context->userenv->{'branch'} |
| 743 |
); |
| 722 |
|
744 |
|
| 723 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
745 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
| 724 |
|
746 |
|