|
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(),?,'','Pay',?,?)" |
148 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?,?)" |
| 149 |
); |
149 |
); |
| 150 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id ); |
150 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id, $branch ); |
| 151 |
|
151 |
|
| 152 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
152 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
| 153 |
|
153 |
|
|
Lines 229-238
sub makepayment {
Link Here
|
| 229 |
my $ins = |
229 |
my $ins = |
| 230 |
$dbh->prepare( |
230 |
$dbh->prepare( |
| 231 |
"INSERT |
231 |
"INSERT |
| 232 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note) |
232 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note, branchcode) |
| 233 |
VALUES ( ?, ?, now(), ?, ?, '', 'Pay', 0, ?, ?)" |
233 |
VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?, ?, ?)" |
| 234 |
); |
234 |
); |
| 235 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note); |
235 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note, C4::Context->userenv->{'branch'}); |
| 236 |
} |
236 |
} |
| 237 |
|
237 |
|
| 238 |
if ( C4::Context->preference("FinesLog") ) { |
238 |
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. |
354 |
# process (or person) to update it, since we don't handle any defaults for replacement prices. |
| 355 |
my $accountno = getnextacctno($borrowernumber); |
355 |
my $accountno = getnextacctno($borrowernumber); |
| 356 |
my $sth2=$dbh->prepare("INSERT INTO accountlines |
356 |
my $sth2=$dbh->prepare("INSERT INTO accountlines |
| 357 |
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber,manager_id) |
357 |
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber,manager_id,branchcode) |
| 358 |
VALUES (?,?,now(),?,?,'L',?,?,?)"); |
358 |
VALUES (?,?,now(),?,?,'L',?,?,?,?)"); |
| 359 |
$sth2->execute($borrowernumber,$accountno,$amount, |
359 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
| 360 |
$description,$amount,$itemnumber,$manager_id); |
360 |
$sth2->execute( $borrowernumber, $accountno, $amount, $description, |
|
|
361 |
$amount, $itemnumber, $manager_id, $branchcode ); |
| 361 |
|
362 |
|
| 362 |
if ( C4::Context->preference("FinesLog") ) { |
363 |
if ( C4::Context->preference("FinesLog") ) { |
| 363 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
364 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
|
Lines 406-411
sub manualinvoice {
Link Here
|
| 406 |
my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_; |
407 |
my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_; |
| 407 |
my $manager_id = 0; |
408 |
my $manager_id = 0; |
| 408 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
409 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
|
|
410 |
my $branchcode = C4::Context->userenv->{'branch'}; |
| 409 |
my $dbh = C4::Context->dbh; |
411 |
my $dbh = C4::Context->dbh; |
| 410 |
my $notifyid = 0; |
412 |
my $notifyid = 0; |
| 411 |
my $insert; |
413 |
my $insert; |
|
Lines 425-440
sub manualinvoice {
Link Here
|
| 425 |
$desc .= ' ' . $itemnum; |
427 |
$desc .= ' ' . $itemnum; |
| 426 |
my $sth = $dbh->prepare( |
428 |
my $sth = $dbh->prepare( |
| 427 |
'INSERT INTO accountlines |
429 |
'INSERT INTO accountlines |
| 428 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id) |
430 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id, branchcode) |
| 429 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?)'); |
431 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?,?)'); |
| 430 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id) || return $sth->errstr; |
432 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id, $branchcode) || return $sth->errstr; |
| 431 |
} else { |
433 |
} else { |
| 432 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
434 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
| 433 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id) |
435 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id, branchcode) |
| 434 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?)" |
436 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?,?)" |
| 435 |
); |
437 |
); |
| 436 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
438 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
| 437 |
$amountleft, $notifyid, $note, $manager_id ); |
439 |
$amountleft, $notifyid, $note, $manager_id, $branchcode ); |
| 438 |
} |
440 |
} |
| 439 |
|
441 |
|
| 440 |
if ( C4::Context->preference("FinesLog") ) { |
442 |
if ( C4::Context->preference("FinesLog") ) { |
|
Lines 638-647
sub recordpayment_selectaccts {
Link Here
|
| 638 |
} |
640 |
} |
| 639 |
|
641 |
|
| 640 |
# create new line |
642 |
# create new line |
| 641 |
$sql = 'INSERT INTO accountlines ' . |
643 |
$sql = q{ |
| 642 |
'(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,note) ' . |
644 |
INSERT INTO accountlines ( |
| 643 |
q|VALUES (?,?,now(),?,'','Pay',?,?,?)|; |
645 |
borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, manager_id, note, branchcode |
| 644 |
$dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id, $note ); |
646 |
) VALUES ( |
|
|
647 |
?, ?, NOW(), ?, 'Payment,thanks', 'Pay', ?, ?, ?, ? |
| 648 |
) |
| 649 |
}; |
| 650 |
$dbh->do( |
| 651 |
$sql, {}, $borrowernumber, |
| 652 |
$nextaccntno, 0 - $amount, 0 - $amountleft, |
| 653 |
$manager_id, $note, $branch |
| 654 |
); |
| 655 |
|
| 645 |
UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno ); |
656 |
UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno ); |
| 646 |
|
657 |
|
| 647 |
if ( C4::Context->preference("FinesLog") ) { |
658 |
if ( C4::Context->preference("FinesLog") ) { |
|
Lines 679-685
sub makepartialpayment {
Link Here
|
| 679 |
'SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); |
690 |
'SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); |
| 680 |
my $new_outstanding = $data->{amountoutstanding} - $amount; |
691 |
my $new_outstanding = $data->{amountoutstanding} - $amount; |
| 681 |
|
692 |
|
| 682 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
693 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
| 683 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
694 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
| 684 |
|
695 |
|
| 685 |
if ( C4::Context->preference("FinesLog") ) { |
696 |
if ( C4::Context->preference("FinesLog") ) { |
|
Lines 696-707
sub makepartialpayment {
Link Here
|
| 696 |
} |
707 |
} |
| 697 |
|
708 |
|
| 698 |
# create new line |
709 |
# create new line |
| 699 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
710 |
my $insert = q{ |
| 700 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id, note) ' |
711 |
INSERT INTO accountlines ( |
| 701 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)'; |
712 |
borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber, manager_id, note, branchcode |
| 702 |
|
713 |
) VALUES ( |
| 703 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
714 |
?, ?, NOW(), ?, ?, ?, 0, ?, ?, ?, ? |
| 704 |
"Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note); |
715 |
) |
|
|
716 |
}; |
| 717 |
|
| 718 |
$dbh->do( |
| 719 |
$insert, undef, |
| 720 |
$borrowernumber, $nextaccntno, |
| 721 |
$amount, "Payment, thanks - $user", |
| 722 |
'Pay', $data->{'itemnumber'}, |
| 723 |
$manager_id, $payment_note, |
| 724 |
C4::Context->userenv->{'branch'} |
| 725 |
); |
| 705 |
|
726 |
|
| 706 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
727 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
| 707 |
|
728 |
|