Lines 81-87
my $sql = '
Link Here
|
81 |
borrowernumber, |
81 |
borrowernumber, |
82 |
surname, |
82 |
surname, |
83 |
firstname, |
83 |
firstname, |
84 |
cardnumber |
84 |
cardnumber, |
|
|
85 |
|
86 |
DATEDIFF( issuedate, CURRENT_DATE() ) AS not_issued_today |
85 |
FROM issues |
87 |
FROM issues |
86 |
LEFT JOIN items USING ( itemnumber ) |
88 |
LEFT JOIN items USING ( itemnumber ) |
87 |
LEFT JOIN biblio USING ( biblionumber ) |
89 |
LEFT JOIN biblio USING ( biblionumber ) |
Lines 107-113
$sth->execute(@parameters);
Link Here
|
107 |
|
109 |
|
108 |
my $item_level_itypes = C4::Context->preference('item-level_itypes'); |
110 |
my $item_level_itypes = C4::Context->preference('item-level_itypes'); |
109 |
|
111 |
|
110 |
my @checkouts; |
112 |
my @checkouts_today; |
|
|
113 |
my @checkouts_previous; |
111 |
while ( my $c = $sth->fetchrow_hashref() ) { |
114 |
while ( my $c = $sth->fetchrow_hashref() ) { |
112 |
my ($charge) = GetIssuingCharges( $c->{itemnumber}, $c->{borrowernumber} ); |
115 |
my ($charge) = GetIssuingCharges( $c->{itemnumber}, $c->{borrowernumber} ); |
113 |
|
116 |
|
Lines 116-167
while ( my $c = $sth->fetchrow_hashref() ) {
Link Here
|
116 |
|
119 |
|
117 |
my ( $renewals_count, $renewals_allowed, $renewals_remaining ) = |
120 |
my ( $renewals_count, $renewals_allowed, $renewals_remaining ) = |
118 |
GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} ); |
121 |
GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} ); |
119 |
push( |
122 |
|
120 |
@checkouts, |
123 |
my $checkout = { |
121 |
{ |
124 |
DT_RowId => $c->{itemnumber} . '-' . $c->{borrowernumber}, |
122 |
DT_RowId => $c->{itemnumber} . '-' . $c->{borrowernumber}, |
125 |
title => $c->{title}, |
123 |
title => $c->{title}, |
126 |
author => $c->{author}, |
124 |
author => $c->{author}, |
127 |
barcode => $c->{barcode}, |
125 |
barcode => $c->{barcode}, |
128 |
itemtype => $item_level_itypes ? $c->{itype} : $c->{itemtype}, |
126 |
itemtype => $item_level_itypes ? $c->{itype} : $c->{itemtype}, |
129 |
itemnotes => $c->{itemnotes}, |
127 |
itemnotes => $c->{itemnotes}, |
130 |
branchcode => $c->{branchcode}, |
128 |
branchcode => $c->{branchcode}, |
131 |
branchname => $c->{branchname}, |
129 |
branchname => $c->{branchname}, |
132 |
itemcallnumber => $c->{itemcallnumber} || q{}, |
130 |
itemcallnumber => $c->{itemcallnumber} || q{}, |
133 |
charge => $charge, |
131 |
charge => $charge, |
134 |
price => $c->{replacementprice} || q{}, |
132 |
price => $c->{replacementprice} || q{}, |
135 |
can_renew => $can_renew, |
133 |
can_renew => $can_renew, |
136 |
can_renew_error => $can_renew_error, |
134 |
can_renew_error => $can_renew_error, |
137 |
itemnumber => $c->{itemnumber}, |
135 |
itemnumber => $c->{itemnumber}, |
138 |
borrowernumber => $c->{borrowernumber}, |
136 |
borrowernumber => $c->{borrowernumber}, |
139 |
biblionumber => $c->{biblionumber}, |
137 |
biblionumber => $c->{biblionumber}, |
140 |
issuedate => $c->{issuedate}, |
138 |
issuedate => $c->{issuedate}, |
141 |
date_due => $c->{date_due}, |
139 |
date_due => $c->{date_due}, |
142 |
renewals_count => $renewals_count, |
140 |
renewals_count => $renewals_count, |
143 |
renewals_allowed => $renewals_allowed, |
141 |
renewals_allowed => $renewals_allowed, |
144 |
renewals_remaining => $renewals_remaining, |
142 |
renewals_remaining => $renewals_remaining, |
145 |
issuedate_formatted => output_pref( dt_from_string( $c->{issuedate} ) ), |
143 |
issuedate_formatted => |
146 |
date_due_formatted => output_pref( |
144 |
output_pref( dt_from_string( $c->{issuedate} ) ), |
147 |
{ |
145 |
date_due_formatted => output_pref( |
148 |
dt => dt_from_string( $c->{date_due} ), |
146 |
{ |
149 |
as_due_date => 1 |
147 |
dt => dt_from_string( $c->{date_due} ), |
|
|
148 |
as_due_date => 1 |
149 |
} |
150 |
), |
151 |
subtitle => GetRecordValue( |
152 |
'subtitle', |
153 |
GetMarcBiblio( $c->{biblionumber} ), |
154 |
GetFrameworkCode( $c->{biblionumber} ) |
155 |
), |
156 |
borrower => { |
157 |
surname => $c->{surname}, |
158 |
firstname => $c->{firstname}, |
159 |
cardnumber => $c->{cardnumber}, |
160 |
} |
150 |
} |
|
|
151 |
), |
152 |
subtitle => GetRecordValue( |
153 |
'subtitle', |
154 |
GetMarcBiblio( $c->{biblionumber} ), |
155 |
GetFrameworkCode( $c->{biblionumber} ) |
156 |
), |
157 |
borrower => { |
158 |
surname => $c->{surname}, |
159 |
firstname => $c->{firstname}, |
160 |
cardnumber => $c->{cardnumber}, |
161 |
} |
161 |
} |
162 |
); |
162 |
}; |
|
|
163 |
|
164 |
if ( $c->{not_issued_today} ) { |
165 |
push( @checkouts_previous, $checkout ); |
166 |
} |
167 |
else { |
168 |
push( @checkouts_today, $checkout ); |
169 |
} |
163 |
} |
170 |
} |
164 |
|
171 |
|
|
|
172 |
@checkouts_today = reverse(@checkouts_today) |
173 |
if ( C4::Context->preference('todaysIssuesDefaultSortOrder') eq 'desc' ); |
174 |
@checkouts_previous = reverse(@checkouts_previous) |
175 |
if ( C4::Context->preference('previousIssuesDefaultSortOrder') eq 'desc' ); |
176 |
|
177 |
my @checkouts = ( @checkouts_today, @checkouts_previous ); |
178 |
|
165 |
my $data; |
179 |
my $data; |
166 |
$data->{'iTotalRecords'} = scalar @checkouts; #FIXME |
180 |
$data->{'iTotalRecords'} = scalar @checkouts; #FIXME |
167 |
$data->{'iTotalDisplayRecords'} = scalar @checkouts; |
181 |
$data->{'iTotalDisplayRecords'} = scalar @checkouts; |
168 |
- |
|
|