|
Lines 174-179
foreach my $item (@items){
Link Here
|
| 174 |
$item->{status_advisory} = 1; |
174 |
$item->{status_advisory} = 1; |
| 175 |
} |
175 |
} |
| 176 |
|
176 |
|
|
|
177 |
# Add paidfor info |
| 178 |
if ( $item->{itemlost} ) { |
| 179 |
my $accountlines = Koha::Account::Lines->search( |
| 180 |
{ |
| 181 |
itemnumber => $item->{itemnumber}, |
| 182 |
accounttype => 'LOST', |
| 183 |
status => [ undef, { '<>' => 'RETURNED' } ], |
| 184 |
amountoutstanding => 0 |
| 185 |
}, |
| 186 |
{ |
| 187 |
order_by => { '-desc' => 'date' }, |
| 188 |
rows => 1 |
| 189 |
} |
| 190 |
); |
| 191 |
|
| 192 |
if ( my $accountline = $accountlines->next ) { |
| 193 |
my $payment_offsets = Koha::Account::Offsets->search( |
| 194 |
{ |
| 195 |
debit_id => $accountline->id, |
| 196 |
credit_id => { '!=' => undef }, # it is not the debit itself |
| 197 |
type => { '!=' => [ 'Writeoff', 'Forgiven' ] }, |
| 198 |
amount => { '<' => 0 } # credits are negative on the DB |
| 199 |
}, |
| 200 |
{ order_by => { '-desc' => 'created_on' } } |
| 201 |
); |
| 202 |
|
| 203 |
if ($payment_offsets->count) { |
| 204 |
my $patron = $accountline->patron; |
| 205 |
my $payment_offset = $payment_offsets->next; |
| 206 |
$item->{paidfor} = |
| 207 |
$patron->firstname . " " |
| 208 |
. $patron->surname . " " |
| 209 |
. $patron->cardnumber . " " |
| 210 |
. $payment_offset->created_on; |
| 211 |
} |
| 212 |
} |
| 213 |
} |
| 214 |
|
| 177 |
if (C4::Context->preference("IndependentBranches")) { |
215 |
if (C4::Context->preference("IndependentBranches")) { |
| 178 |
#verifying rights |
216 |
#verifying rights |
| 179 |
my $userenv = C4::Context->userenv(); |
217 |
my $userenv = C4::Context->userenv(); |