Lines 51-56
use C4::Reserves;
Link Here
|
51 |
use C4::Branch; # GetBranchName |
51 |
use C4::Branch; # GetBranchName |
52 |
use C4::Form::MessagingPreferences; |
52 |
use C4::Form::MessagingPreferences; |
53 |
use C4::NewsChannels; #get slip news |
53 |
use C4::NewsChannels; #get slip news |
|
|
54 |
use List::MoreUtils qw/uniq/; |
54 |
|
55 |
|
55 |
#use Smart::Comments; |
56 |
#use Smart::Comments; |
56 |
#use Data::Dumper; |
57 |
#use Data::Dumper; |
Lines 239-311
if ( C4::Context->preference('OPACPrivacy') ) {
Link Here
|
239 |
|
240 |
|
240 |
# current issues |
241 |
# current issues |
241 |
# |
242 |
# |
242 |
my $issue = GetPendingIssues($borrowernumber); |
243 |
my @borrowernumbers = GetMemberRelatives($borrowernumber); |
|
|
244 |
my $issue = GetPendingIssues($borrowernumber); |
245 |
my $relissue = GetPendingIssues(@borrowernumbers); |
243 |
my $issuecount = scalar(@$issue); |
246 |
my $issuecount = scalar(@$issue); |
|
|
247 |
my $relissuecount = scalar(@$relissue); |
244 |
my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} ); |
248 |
my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} ); |
245 |
my $today = POSIX::strftime("%Y-%m-%d", localtime); # iso format |
249 |
my $today = POSIX::strftime("%Y-%m-%d", localtime); # iso format |
246 |
my @issuedata; |
250 |
my @issuedata; |
|
|
251 |
my @borrowers_with_issues; |
247 |
my $overdues_exist = 0; |
252 |
my $overdues_exist = 0; |
248 |
my $totalprice = 0; |
253 |
my $totalprice = 0; |
249 |
for ( my $i = 0 ; $i < $issuecount ; $i++ ) { |
254 |
|
250 |
my $datedue = $issue->[$i]{'date_due'}; |
255 |
my @issuedata = build_issue_data($issue, $issuecount); |
251 |
my $issuedate = $issue->[$i]{'issuedate'}; |
256 |
my @relissuedata = build_issue_data($relissue, $relissuecount); |
252 |
$issue->[$i]{'date_due'} = C4::Dates->new($issue->[$i]{'date_due'}, 'iso')->output('syspref'); |
257 |
|
253 |
$issue->[$i]{'issuedate'} = C4::Dates->new($issue->[$i]{'issuedate'},'iso')->output('syspref'); |
258 |
sub build_issue_data { |
254 |
my $biblionumber = $issue->[$i]{'biblionumber'}; |
259 |
my $issue = shift; |
255 |
my %row = %{ $issue->[$i] }; |
260 |
my $issuecount = shift; |
256 |
$totalprice += $issue->[$i]{'replacementprice'}; |
261 |
|
257 |
$row{'replacementprice'} = $issue->[$i]{'replacementprice'}; |
262 |
my $localissue; |
258 |
# item lost, damaged loops |
263 |
|
259 |
if ($row{'itemlost'}) { |
264 |
for ( my $i = 0 ; $i < $issuecount ; $i++ ) { |
260 |
my $fw = GetFrameworkCode($issue->[$i]{'biblionumber'}); |
265 |
# Getting borrower details |
261 |
my $category = GetAuthValCode('items.itemlost',$fw); |
266 |
my $memberdetails = GetMemberDetails($issue->[$i]{'borrowernumber'}); |
262 |
my $lostdbh = C4::Context->dbh; |
267 |
$issue->[$i]{'borrowername'} = $memberdetails->{'firstname'} . " " . $memberdetails->{'surname'}; |
263 |
my $sth = $lostdbh->prepare("select lib from authorised_values where category=? and authorised_value =? "); |
268 |
|
264 |
$sth->execute($category, $row{'itemlost'}); |
269 |
my $datedue = $issue->[$i]{'date_due'}; |
265 |
my $loststat = $sth->fetchrow; |
270 |
my $issuedate = $issue->[$i]{'issuedate'}; |
266 |
if ($loststat) { |
271 |
$issue->[$i]{'date_due'} = C4::Dates->new($issue->[$i]{'date_due'}, 'iso')->output('syspref'); |
267 |
$row{'itemlost'} = $loststat; |
272 |
$issue->[$i]{'issuedate'} = C4::Dates->new($issue->[$i]{'issuedate'},'iso')->output('syspref'); |
|
|
273 |
my $biblionumber = $issue->[$i]{'biblionumber'}; |
274 |
my %row = %{ $issue->[$i] }; |
275 |
$totalprice += $issue->[$i]{'replacementprice'}; |
276 |
$row{'replacementprice'} = $issue->[$i]{'replacementprice'}; |
277 |
# item lost, damaged loops |
278 |
if ($row{'itemlost'}) { |
279 |
my $fw = GetFrameworkCode($issue->[$i]{'biblionumber'}); |
280 |
my $category = GetAuthValCode('items.itemlost',$fw); |
281 |
my $lostdbh = C4::Context->dbh; |
282 |
my $sth = $lostdbh->prepare("select lib from authorised_values where category=? and authorised_value =? "); |
283 |
$sth->execute($category, $row{'itemlost'}); |
284 |
my $loststat = $sth->fetchrow; |
285 |
if ($loststat) { |
286 |
$row{'itemlost'} = $loststat; |
287 |
} |
268 |
} |
288 |
} |
269 |
} |
289 |
if ($row{'damaged'}) { |
270 |
if ($row{'damaged'}) { |
290 |
my $fw = GetFrameworkCode($issue->[$i]{'biblionumber'}); |
271 |
my $fw = GetFrameworkCode($issue->[$i]{'biblionumber'}); |
291 |
my $category = GetAuthValCode('items.damaged',$fw); |
272 |
my $category = GetAuthValCode('items.damaged',$fw); |
292 |
my $damageddbh = C4::Context->dbh; |
273 |
my $damageddbh = C4::Context->dbh; |
293 |
my $sth = $damageddbh->prepare("select lib from authorised_values where category=? and authorised_value =? "); |
274 |
my $sth = $damageddbh->prepare("select lib from authorised_values where category=? and authorised_value =? "); |
294 |
$sth->execute($category, $row{'damaged'}); |
275 |
$sth->execute($category, $row{'damaged'}); |
295 |
my $damagedstat = $sth->fetchrow; |
276 |
my $damagedstat = $sth->fetchrow; |
296 |
if ($damagedstat) { |
277 |
if ($damagedstat) { |
297 |
$row{'itemdamaged'} = $damagedstat; |
278 |
$row{'itemdamaged'} = $damagedstat; |
298 |
} |
279 |
} |
299 |
} |
|
|
300 |
# end lost, damaged |
301 |
if ( $datedue lt $today ) { |
302 |
$overdues_exist = 1; |
303 |
$row{'red'} = 1; |
304 |
} |
305 |
if ( $issuedate eq $today ) { |
306 |
$row{'today'} = 1; |
307 |
} |
308 |
|
309 |
#find the charge for an item |
310 |
my ( $charge, $itemtype ) = |
311 |
GetIssuingCharges( $issue->[$i]{'itemnumber'}, $borrowernumber ); |
312 |
|
313 |
my $itemtypeinfo = getitemtypeinfo($itemtype); |
314 |
$row{'itemtype_description'} = $itemtypeinfo->{description}; |
315 |
$row{'itemtype_image'} = $itemtypeinfo->{imageurl}; |
316 |
|
317 |
$row{'charge'} = sprintf( "%.2f", $charge ); |
318 |
|
319 |
my ( $renewokay,$renewerror ) = CanBookBeRenewed( $borrowernumber, $issue->[$i]{'itemnumber'}, $override_limit ); |
320 |
$row{'norenew'} = !$renewokay; |
321 |
$row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' ); |
322 |
$row{"norenew_reason_$renewerror"} = 1 if $renewerror; |
323 |
$row{'renew_failed'} = $renew_failed{ $issue->[$i]{'itemnumber'} }; |
324 |
$row{'return_failed'} = $return_failed{$issue->[$i]{'barcode'}}; |
325 |
push( @$localissue, \%row ); |
280 |
} |
326 |
} |
281 |
# end lost, damaged |
327 |
return $localissue; |
282 |
if ( $datedue lt $today ) { |
|
|
283 |
$overdues_exist = 1; |
284 |
$row{'red'} = 1; |
285 |
} |
286 |
if ( $issuedate eq $today ) { |
287 |
$row{'today'} = 1; |
288 |
} |
289 |
|
290 |
#find the charge for an item |
291 |
my ( $charge, $itemtype ) = |
292 |
GetIssuingCharges( $issue->[$i]{'itemnumber'}, $borrowernumber ); |
293 |
|
294 |
my $itemtypeinfo = getitemtypeinfo($itemtype); |
295 |
$row{'itemtype_description'} = $itemtypeinfo->{description}; |
296 |
$row{'itemtype_image'} = $itemtypeinfo->{imageurl}; |
297 |
|
298 |
$row{'charge'} = sprintf( "%.2f", $charge ); |
299 |
|
300 |
my ( $renewokay,$renewerror ) = CanBookBeRenewed( $borrowernumber, $issue->[$i]{'itemnumber'}, $override_limit ); |
301 |
$row{'norenew'} = !$renewokay; |
302 |
$row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' ); |
303 |
$row{"norenew_reason_$renewerror"} = 1 if $renewerror; |
304 |
$row{'renew_failed'} = $renew_failed{ $issue->[$i]{'itemnumber'} }; |
305 |
$row{'return_failed'} = $return_failed{$issue->[$i]{'barcode'}}; |
306 |
push( @issuedata, \%row ); |
307 |
} |
328 |
} |
308 |
|
329 |
|
|
|
330 |
|
309 |
### ############################################################################### |
331 |
### ############################################################################### |
310 |
# BUILD HTML |
332 |
# BUILD HTML |
311 |
# show all reserves of this borrower, and the position of the reservation .... |
333 |
# show all reserves of this borrower, and the position of the reservation .... |
Lines 437-444
$template->param(
Link Here
|
437 |
totalprice => sprintf("%.2f", $totalprice), |
459 |
totalprice => sprintf("%.2f", $totalprice), |
438 |
totaldue => sprintf("%.2f", $total), |
460 |
totaldue => sprintf("%.2f", $total), |
439 |
totaldue_raw => $total, |
461 |
totaldue_raw => $total, |
440 |
issueloop => \@issuedata, |
462 |
issueloop => @issuedata, |
441 |
issuecount => $issuecount, |
463 |
relissueloop => @relissuedata, |
|
|
464 |
issuecount => $issuecount, |
465 |
relissuecount => $relissuecount, |
442 |
overdues_exist => $overdues_exist, |
466 |
overdues_exist => $overdues_exist, |
443 |
error => $error, |
467 |
error => $error, |
444 |
$error => 1, |
468 |
$error => 1, |
445 |
- |
|
|