|
Lines 194-227
sub manualinvoice {
Link Here
|
| 194 |
my $manager_id = 0; |
194 |
my $manager_id = 0; |
| 195 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
195 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
| 196 |
my $dbh = C4::Context->dbh; |
196 |
my $dbh = C4::Context->dbh; |
| 197 |
my $notifyid = 0; |
|
|
| 198 |
my $insert; |
197 |
my $insert; |
| 199 |
my $accountno = getnextacctno($borrowernumber); |
198 |
my $accountno = getnextacctno($borrowernumber); |
| 200 |
my $amountleft = $amount; |
199 |
my $amountleft = $amount; |
| 201 |
|
200 |
|
| 202 |
if ( ( $type eq 'L' ) |
|
|
| 203 |
or ( $type eq 'F' ) |
| 204 |
or ( $type eq 'A' ) |
| 205 |
or ( $type eq 'N' ) |
| 206 |
or ( $type eq 'M' ) ) |
| 207 |
{ |
| 208 |
$notifyid = 1; |
| 209 |
} |
| 210 |
|
| 211 |
if ( $itemnum ) { |
201 |
if ( $itemnum ) { |
| 212 |
$desc .= ' ' . $itemnum; |
202 |
$desc .= ' ' . $itemnum; |
| 213 |
my $sth = $dbh->prepare( |
203 |
my $sth = $dbh->prepare( |
| 214 |
'INSERT INTO accountlines |
204 |
'INSERT INTO accountlines |
| 215 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id) |
205 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber, note, manager_id) |
| 216 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?)'); |
206 |
VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?)'); |
| 217 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id) || return $sth->errstr; |
207 |
$sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum, $note, $manager_id) || return $sth->errstr; |
| 218 |
} else { |
208 |
} else { |
| 219 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
209 |
my $sth=$dbh->prepare("INSERT INTO accountlines |
| 220 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id) |
210 |
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, note, manager_id) |
| 221 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?)" |
211 |
VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?)" |
| 222 |
); |
212 |
); |
| 223 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
213 |
$sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, |
| 224 |
$amountleft, $notifyid, $note, $manager_id ); |
214 |
$amountleft, $note, $manager_id ); |
| 225 |
} |
215 |
} |
| 226 |
|
216 |
|
| 227 |
if ( C4::Context->preference("FinesLog") ) { |
217 |
if ( C4::Context->preference("FinesLog") ) { |
|
Lines 233-239
sub manualinvoice {
Link Here
|
| 233 |
description => $desc, |
223 |
description => $desc, |
| 234 |
accounttype => $type, |
224 |
accounttype => $type, |
| 235 |
amountoutstanding => $amountleft, |
225 |
amountoutstanding => $amountleft, |
| 236 |
notify_id => $notifyid, |
|
|
| 237 |
note => $note, |
226 |
note => $note, |
| 238 |
itemnumber => $itemnum, |
227 |
itemnumber => $itemnum, |
| 239 |
manager_id => $manager_id, |
228 |
manager_id => $manager_id, |