|
Lines 87-95
sub chargelostitem {
Link Here
|
| 87 |
my $issue_id = $checkout ? $checkout->issue_id : undef; |
87 |
my $issue_id = $checkout ? $checkout->issue_id : undef; |
| 88 |
|
88 |
|
| 89 |
my $account = Koha::Account->new({ patron_id => $borrowernumber }); |
89 |
my $account = Koha::Account->new({ patron_id => $borrowernumber }); |
| 90 |
# first make sure the borrower hasn't already been charged for this item |
90 |
# first make sure the borrower hasn't already been charged for this item (for this issuance) |
| 91 |
# FIXME this should be more exact |
|
|
| 92 |
# there is no reason a user can't lose an item, find and return it, and lost it again |
| 93 |
my $existing_charges = $account->lines->search( |
91 |
my $existing_charges = $account->lines->search( |
| 94 |
{ |
92 |
{ |
| 95 |
itemnumber => $itemnumber, |
93 |
itemnumber => $itemnumber, |
|
Lines 156-161
sub manualinvoice {
Link Here
|
| 156 |
|
154 |
|
| 157 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
155 |
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; |
| 158 |
|
156 |
|
|
|
157 |
my $issue_id; |
| 158 |
if ( $type eq 'LOST' && $itemnum ) { |
| 159 |
my $checkouts = Koha::Checkouts->search( |
| 160 |
{ itemnumber => $itemnum, borrowernumber => $borrowernumber } ); |
| 161 |
my $checkout = |
| 162 |
$checkouts->count |
| 163 |
? $checkouts->next |
| 164 |
: Koha::Old::Checkouts->search( |
| 165 |
{ itemnumber => $itemnum, borrowernumber => $borrowernumber }, |
| 166 |
{ order_by => { 'DESC' => 'returndate' }, rows => 1 } |
| 167 |
)->next; |
| 168 |
$issue_id = $checkout ? $checkout->issue_id : undef; |
| 169 |
} |
| 170 |
|
| 159 |
my $accountline = Koha::Account::Line->new( |
171 |
my $accountline = Koha::Account::Line->new( |
| 160 |
{ |
172 |
{ |
| 161 |
borrowernumber => $borrowernumber, |
173 |
borrowernumber => $borrowernumber, |
|
Lines 165-170
sub manualinvoice {
Link Here
|
| 165 |
accounttype => $type, |
177 |
accounttype => $type, |
| 166 |
amountoutstanding => $amountleft, |
178 |
amountoutstanding => $amountleft, |
| 167 |
itemnumber => $itemnum || undef, |
179 |
itemnumber => $itemnum || undef, |
|
|
180 |
issue_id => $issue_id, |
| 168 |
note => $note, |
181 |
note => $note, |
| 169 |
manager_id => $manager_id, |
182 |
manager_id => $manager_id, |
| 170 |
interface => C4::Context->interface, |
183 |
interface => C4::Context->interface, |