Lines 146-158
sub recordpayment {
Link Here
|
146 |
# create new line |
146 |
# create new line |
147 |
my $usth = $dbh->prepare( |
147 |
my $usth = $dbh->prepare( |
148 |
"INSERT INTO accountlines |
148 |
"INSERT INTO accountlines |
149 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) |
149 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,branchcode) |
150 |
VALUES (?,?,now(),?,'',?,?,?)" |
150 |
VALUES (?,?,now(),?,'',?,?,?)" |
151 |
); |
151 |
); |
152 |
|
152 |
|
153 |
my $paytype = "Pay"; |
153 |
my $paytype = "Pay"; |
154 |
$paytype .= $sip_paytype if defined $sip_paytype; |
154 |
$paytype .= $sip_paytype if defined $sip_paytype; |
155 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $paytype, 0 - $amountleft, $manager_id ); |
155 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $paytype, 0 - $amountleft, $manager_id, $branch ); |
156 |
$usth->finish; |
156 |
$usth->finish; |
157 |
|
157 |
|
158 |
UpdateStats({ |
158 |
UpdateStats({ |
Lines 241-250
sub makepayment {
Link Here
|
241 |
my $ins = |
241 |
my $ins = |
242 |
$dbh->prepare( |
242 |
$dbh->prepare( |
243 |
"INSERT |
243 |
"INSERT |
244 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note) |
244 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note, branchcode) |
245 |
VALUES ( ?, ?, now(), ?, ?, '', 'Pay', 0, ?, ?)" |
245 |
VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?, ?, ?)" |
246 |
); |
246 |
); |
247 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note); |
247 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note, C4::Context->userenv->{'branch'}); |
248 |
} |
248 |
} |
249 |
|
249 |
|
250 |
if ( C4::Context->preference("FinesLog") ) { |
250 |
if ( C4::Context->preference("FinesLog") ) { |
Lines 367-376
sub chargelostitem{
Link Here
|
367 |
# process (or person) to update it, since we don't handle any defaults for replacement prices. |
367 |
# process (or person) to update it, since we don't handle any defaults for replacement prices. |
368 |
my $accountno = getnextacctno($borrowernumber); |
368 |
my $accountno = getnextacctno($borrowernumber); |
369 |
my $sth2=$dbh->prepare("INSERT INTO accountlines |
369 |
my $sth2=$dbh->prepare("INSERT INTO accountlines |
370 |
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber,manager_id) |
370 |
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber,manager_id,branchcode) |
371 |
VALUES (?,?,now(),?,?,'L',?,?,?)"); |
371 |
VALUES (?,?,now(),?,?,'L',?,?,?,?)"); |
372 |
$sth2->execute($borrowernumber,$accountno,$amount, |
372 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
373 |
$description,$amount,$itemnumber,$manager_id); |
373 |
$sth2->execute( $borrowernumber, $accountno, $amount, $description, |
|
|
374 |
$amount, $itemnumber, $manager_id, $branchcode ); |
374 |
|
375 |
|
375 |
if ( C4::Context->preference("FinesLog") ) { |
376 |
if ( C4::Context->preference("FinesLog") ) { |
376 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
377 |
logaction("FINES", 'CREATE', $borrowernumber, Dumper({ |
Lines 419-424
sub manualinvoice {
Link Here
|
419 |
my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_; |
420 |
my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_; |
420 |
my $manager_id = 0; |
421 |
my $manager_id = 0; |
421 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
422 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
|
|
423 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
422 |
my $dbh = C4::Context->dbh; |
424 |
my $dbh = C4::Context->dbh; |
423 |
my $notifyid = 0; |
425 |
my $notifyid = 0; |
424 |
my $insert; |
426 |
my $insert; |
Lines 438-453
sub manualinvoice {
Link Here
|
438 |
$desc .= ' ' . $itemnum; |
440 |
$desc .= ' ' . $itemnum; |
439 |
my $sth = $dbh->prepare( |
441 |
my $sth = $dbh->prepare( |
440 |
'INSERT INTO accountlines |
442 |
'INSERT INTO accountlines |
441 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id) |
443 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id, branchcode) |
442 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?)'); |
444 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?,?)'); |
443 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id) || return $sth->errstr; |
445 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id, $branchcode) || return $sth->errstr; |
444 |
} else { |
446 |
} else { |
445 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
447 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
446 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id) |
448 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id, branchcode) |
447 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?)" |
449 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?,?)" |
448 |
); |
450 |
); |
449 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
451 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
450 |
$amountleft, $notifyid, $note, $manager_id ); |
452 |
$amountleft, $notifyid, $note, $manager_id, $branchcode ); |
451 |
} |
453 |
} |
452 |
|
454 |
|
453 |
if ( C4::Context->preference("FinesLog") ) { |
455 |
if ( C4::Context->preference("FinesLog") ) { |
Lines 651-656
sub recordpayment_selectaccts {
Link Here
|
651 |
} |
653 |
} |
652 |
|
654 |
|
653 |
# create new line |
655 |
# create new line |
|
|
656 |
<<<<<<< HEAD |
654 |
$sql = 'INSERT INTO accountlines ' . |
657 |
$sql = 'INSERT INTO accountlines ' . |
655 |
'(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,note) ' . |
658 |
'(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,note) ' . |
656 |
q|VALUES (?,?,now(),?,'','Pay',?,?,?)|; |
659 |
q|VALUES (?,?,now(),?,'','Pay',?,?,?)|; |
Lines 662-667
sub recordpayment_selectaccts {
Link Here
|
662 |
borrowernumber => $borrowernumber, |
665 |
borrowernumber => $borrowernumber, |
663 |
accountno => $nextaccntno} |
666 |
accountno => $nextaccntno} |
664 |
); |
667 |
); |
|
|
668 |
======= |
669 |
$sql = q{ |
670 |
INSERT INTO accountlines ( |
671 |
borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, manager_id, note, branchcode |
672 |
) VALUES ( |
673 |
?, ?, NOW(), ?, 'Payment,thanks', 'Pay', ?, ?, ?, ? |
674 |
) |
675 |
}; |
676 |
$dbh->do( |
677 |
$sql, {}, $borrowernumber, |
678 |
$nextaccntno, 0 - $amount, 0 - $amountleft, |
679 |
$manager_id, $note, $branch |
680 |
); |
681 |
|
682 |
UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno ); |
683 |
>>>>>>> Bug 7595 - Add branchcode to accountlines |
665 |
|
684 |
|
666 |
if ( C4::Context->preference("FinesLog") ) { |
685 |
if ( C4::Context->preference("FinesLog") ) { |
667 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
686 |
logaction("FINES", 'CREATE',$borrowernumber,Dumper({ |
Lines 698-704
sub makepartialpayment {
Link Here
|
698 |
'SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); |
717 |
'SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); |
699 |
my $new_outstanding = $data->{amountoutstanding} - $amount; |
718 |
my $new_outstanding = $data->{amountoutstanding} - $amount; |
700 |
|
719 |
|
701 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
720 |
my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; |
702 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
721 |
$dbh->do( $update, undef, $new_outstanding, $accountlines_id); |
703 |
|
722 |
|
704 |
if ( C4::Context->preference("FinesLog") ) { |
723 |
if ( C4::Context->preference("FinesLog") ) { |
Lines 715-726
sub makepartialpayment {
Link Here
|
715 |
} |
734 |
} |
716 |
|
735 |
|
717 |
# create new line |
736 |
# create new line |
718 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
737 |
my $insert = q{ |
719 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id, note) ' |
738 |
INSERT INTO accountlines ( |
720 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)'; |
739 |
borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber, manager_id, note, branchcode |
721 |
|
740 |
) VALUES ( |
722 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
741 |
?, ?, NOW(), ?, ?, ?, 0, ?, ?, ?, ? |
723 |
"Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note); |
742 |
) |
|
|
743 |
}; |
744 |
|
745 |
$dbh->do( |
746 |
$insert, undef, |
747 |
$borrowernumber, $nextaccntno, |
748 |
$amount, "Payment, thanks - $user", |
749 |
'Pay', $data->{'itemnumber'}, |
750 |
$manager_id, $payment_note, |
751 |
C4::Context->userenv->{'branch'} |
752 |
); |
724 |
|
753 |
|
725 |
UpdateStats({ |
754 |
UpdateStats({ |
726 |
branch => $user, |
755 |
branch => $user, |