|
Lines 235-240
if ($noreport) {
Link Here
|
| 235 |
borrowers.title as borrowertitle, |
235 |
borrowers.title as borrowertitle, |
| 236 |
borrowers.surname, |
236 |
borrowers.surname, |
| 237 |
borrowers.firstname, |
237 |
borrowers.firstname, |
|
|
238 |
borrowers.preferred_name, |
| 238 |
borrowers.streetnumber, |
239 |
borrowers.streetnumber, |
| 239 |
borrowers.streettype, |
240 |
borrowers.streettype, |
| 240 |
borrowers.address, |
241 |
borrowers.address, |
|
Lines 268-274
if ($noreport) {
Link Here
|
| 268 |
items.itemnotes_nonpublic, |
269 |
items.itemnotes_nonpublic, |
| 269 |
items.itype, |
270 |
items.itype, |
| 270 |
return_claims.created_on AS return_claim_created_on, |
271 |
return_claims.created_on AS return_claim_created_on, |
| 271 |
return_claims.id AS return_claim_id |
272 |
return_claims.id AS return_claim_id, |
|
|
273 |
IF(date_due < NOW(), 1, 0) AS overdue |
| 272 |
FROM issues |
274 |
FROM issues |
| 273 |
LEFT JOIN borrowers ON (issues.borrowernumber=borrowers.borrowernumber ) |
275 |
LEFT JOIN borrowers ON (issues.borrowernumber=borrowers.borrowernumber ) |
| 274 |
LEFT JOIN categories ON (categories.categorycode = borrowers.categorycode ) |
276 |
LEFT JOIN categories ON (categories.categorycode = borrowers.categorycode ) |
|
Lines 338-356
if ($noreport) {
Link Here
|
| 338 |
my @overduedata; |
340 |
my @overduedata; |
| 339 |
while ( my $data = $sth->fetchrow_hashref ) { |
341 |
while ( my $data = $sth->fetchrow_hashref ) { |
| 340 |
|
342 |
|
| 341 |
# most of the overdue report data is linked to the database schema, i.e. things like borrowernumber and phone |
|
|
| 342 |
# but the patron attributes (patron_attr_value_loop) are unnormalised and varies dynamically from one db to the next |
| 343 |
|
| 344 |
my $pattrs = $borrowernumber_to_attributes{ $data->{borrowernumber} } || {}; # patron attrs for this borrower |
| 345 |
# $pattrs is a hash { attrcode => [ [value,displayvalue], [value,displayvalue]... ] } |
| 346 |
|
| 347 |
my @patron_attr_value_loop; # template array [ {value=>v1}, {value=>v2} ... } ] |
| 348 |
for my $pattr_filter ( grep { !$_->{isclone} } @patron_attr_filter_loop ) { |
| 349 |
my @displayvalues = |
| 350 |
map { $_->[1] } @{ $pattrs->{ $pattr_filter->{code} } }; # grab second value from each subarray |
| 351 |
push @patron_attr_value_loop, { value => join( ', ', sort { lc $a cmp lc $b } @displayvalues ) }; |
| 352 |
} |
| 353 |
|
| 354 |
push @overduedata, { |
343 |
push @overduedata, { |
| 355 |
borrower => { |
344 |
borrower => { |
| 356 |
branchcode => $data->{branchcode}, |
345 |
branchcode => $data->{branchcode}, |
|
Lines 401-408
if ($noreport) {
Link Here
|
| 401 |
return_claim_id => $data->{return_claim_id}, |
390 |
return_claim_id => $data->{return_claim_id}, |
| 402 |
enumchron => $data->{enumchron}, |
391 |
enumchron => $data->{enumchron}, |
| 403 |
itemtype => $data->{itype}, |
392 |
itemtype => $data->{itype}, |
| 404 |
overdue => DateTime->compare( dt_from_string( $data->{date_due} ), $today_dt ) == -1 ? 1 : 0, |
393 |
overdue => $data->{overdue} |
| 405 |
patron_attr_value_loop => \@patron_attr_value_loop, |
|
|
| 406 |
}; |
394 |
}; |
| 407 |
} |
395 |
} |
| 408 |
|
396 |
|
| 409 |
- |
|
|