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 |
$sth2->execute($borrowernumber,$accountno,$amount, |
|
|
361 |
<<<<<<< HEAD |
360 |
$description,$amount,$itemnumber,$manager_id); |
362 |
$description,$amount,$itemnumber,$manager_id); |
|
|
363 |
======= |
364 |
$description,$amount,$itemnumber,$manager_id,C4::Context->userenv->{'branch'}); |
365 |
$sth2->finish; |
366 |
>>>>>>> Bug 7595 - Add branchcode to accountlines |
361 |
|
367 |
|
362 |
if ( C4::Context->preference("FinesLog") ) { |
368 |
if ( C4::Context->preference("FinesLog") ) { |
363 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
369 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
Lines 406-411
sub manualinvoice {
Link Here
|
406 |
my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_; |
412 |
my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_; |
407 |
my $manager_id = 0; |
413 |
my $manager_id = 0; |
408 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
414 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
|
|
415 |
my $branchcode = C4::Context->userenv->{'branch'}; |
409 |
my $dbh = C4::Context->dbh; |
416 |
my $dbh = C4::Context->dbh; |
410 |
my $notifyid = 0; |
417 |
my $notifyid = 0; |
411 |
my $insert; |
418 |
my $insert; |
Lines 442-457
sub manualinvoice {
Link Here
|
442 |
$desc .= ' ' . $itemnum; |
449 |
$desc .= ' ' . $itemnum; |
443 |
my $sth = $dbh->prepare( |
450 |
my $sth = $dbh->prepare( |
444 |
'INSERT INTO accountlines |
451 |
'INSERT INTO accountlines |
445 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id) |
452 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id, branchcode) |
446 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?)'); |
453 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?,?)'); |
447 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id) || return $sth->errstr; |
454 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id, $branchcode) || return $sth->errstr; |
448 |
} else { |
455 |
} else { |
449 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
456 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
450 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id) |
457 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id, branchcode) |
451 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?)" |
458 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?,?)" |
452 |
); |
459 |
); |
453 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
460 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
454 |
$amountleft, $notifyid, $note, $manager_id ); |
461 |
$amountleft, $notifyid, $note, $manager_id, $branchcode ); |
455 |
} |
462 |
} |
456 |
|
463 |
|
457 |
if ( C4::Context->preference("FinesLog") ) { |
464 |
if ( C4::Context->preference("FinesLog") ) { |
Lines 655-664
sub recordpayment_selectaccts {
Link Here
|
655 |
} |
662 |
} |
656 |
|
663 |
|
657 |
# create new line |
664 |
# create new line |
658 |
$sql = 'INSERT INTO accountlines ' . |
665 |
$sql = q{ |
659 |
'(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,note) ' . |
666 |
INSERT INTO accountlines ( |
660 |
q|VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?,?)|; |
667 |
borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, manager_id, note, branchcode |
661 |
$dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id, $note ); |
668 |
) VALUES ( |
|
|
669 |
?, ?, NOW(), ?, 'Payment,thanks', 'Pay', ?, ?, ?, ? |
670 |
) |
671 |
}; |
672 |
$dbh->do( |
673 |
$sql, {}, $borrowernumber, |
674 |
$nextaccntno, 0 - $amount, 0 - $amountleft, |
675 |
$manager_id, $note, $branch |
676 |
); |
677 |
|
662 |
UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno ); |
678 |
UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno ); |
663 |
|
679 |
|
664 |
if ( C4::Context->preference("FinesLog") ) { |
680 |
if ( C4::Context->preference("FinesLog") ) { |
Lines 696-702
sub makepartialpayment {
Link Here
|
696 |
'SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); |
712 |
'SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); |
697 |
my $new_outstanding = $data->{amountoutstanding} - $amount; |
713 |
my $new_outstanding = $data->{amountoutstanding} - $amount; |
698 |
|
714 |
|
699 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
715 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
700 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
716 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
701 |
|
717 |
|
702 |
if ( C4::Context->preference("FinesLog") ) { |
718 |
if ( C4::Context->preference("FinesLog") ) { |
Lines 713-724
sub makepartialpayment {
Link Here
|
713 |
} |
729 |
} |
714 |
|
730 |
|
715 |
# create new line |
731 |
# create new line |
716 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
732 |
my $insert = q{ |
717 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id, note) ' |
733 |
INSERT INTO accountlines ( |
718 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)'; |
734 |
borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber, manager_id, note, branchcode |
719 |
|
735 |
) VALUES ( |
720 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
736 |
?, ?, NOW(), ?, ?, ?, 0, ?, ?, ?, ? |
721 |
"Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note); |
737 |
) |
|
|
738 |
}; |
739 |
|
740 |
$dbh->do( |
741 |
$insert, undef, |
742 |
$borrowernumber, $nextaccntno, |
743 |
$amount, "Payment, thanks - $user", |
744 |
'Pay', $data->{'itemnumber'}, |
745 |
$manager_id, $payment_note, |
746 |
C4::Context->userenv->{'branch'} |
747 |
); |
722 |
|
748 |
|
723 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
749 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
724 |
|
750 |
|