use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue );
use C4::Circulation qw(GetIssuingCharges CanBookBeRenewed GetRenewCount GetSoonestRenewDate);
use C4::Koha qw(GetAuthorisedValueByCode);
+use C4::Overdues qw(GetFine);
use C4::Context;
use Koha::DateUtils;
itemlost,
damaged,
+ location,
DATEDIFF( issuedate, CURRENT_DATE() ) AS not_issued_today
FROM issues
my @checkouts_previous;
while ( my $c = $sth->fetchrow_hashref() ) {
my ($charge) = GetIssuingCharges( $c->{itemnumber}, $c->{borrowernumber} );
+ my $fine = GetFine( $c->{itemnumber}, $c->{borrowernumber} );
my ( $can_renew, $can_renew_error ) =
CanBookBeRenewed( $c->{borrowernumber}, $c->{itemnumber} );
barcode => $c->{barcode},
itemtype => $item_level_itypes ? $c->{itype} : $c->{itemtype},
itemtype_description => $item_level_itypes ? $c->{itype_description} : $c->{itemtype_description},
+ location => $c->{location} ? GetAuthorisedValueByCode( 'LOC', $c->{location} ) : q{},
itemnotes => $c->{itemnotes},
branchcode => $c->{branchcode},
branchname => $c->{branchname},
itemcallnumber => $c->{itemcallnumber} || q{},
charge => $charge,
+ fine => $fine,
price => $c->{replacementprice} || q{},
can_renew => $can_renew,
can_renew_error => $can_renew_error,
}
}
+
+@checkouts_today = sort { $a->{timestamp} cmp $b->{timestamp} } @checkouts_today;
@checkouts_today = reverse(@checkouts_today)
- if ( C4::Context->preference('todaysIssuesDefaultSortOrder') eq 'desc' );
+ unless ( C4::Context->preference('todaysIssuesDefaultSortOrder') eq 'desc' );
+
+@checkouts_previous = sort { $a->{date_due} cmp $b->{date_due} } @checkouts_previous;
@checkouts_previous = reverse(@checkouts_previous)
if ( C4::Context->preference('previousIssuesDefaultSortOrder') eq 'desc' );
my @checkouts = ( @checkouts_today, @checkouts_previous );
+my $i = 1;
+map { $_->{sort_order} = $i++ } @checkouts;
+
+
my $data;
$data->{'iTotalRecords'} = scalar @checkouts;
$data->{'iTotalDisplayRecords'} = scalar @checkouts;