Lines 83-88
push @query_params, output_pref({ dt => $startdate, dateformat => 'iso' }) ;
Link Here
|
83 |
$sqldatewhere .= " AND reservedate <= ?"; |
83 |
$sqldatewhere .= " AND reservedate <= ?"; |
84 |
push @query_params, output_pref({ dt => $enddate, dateformat => 'iso' }); |
84 |
push @query_params, output_pref({ dt => $enddate, dateformat => 'iso' }); |
85 |
|
85 |
|
|
|
86 |
my $include_aqorders_qty = |
87 |
C4::Context->preference('AcqCreateItem') eq 'receiving' |
88 |
? '+ COALESCE(aqorders.quantity, 0) - COALESCE(aqorders.quantityreceived, 0)' |
89 |
: q{}; |
90 |
|
91 |
my $include_aqorders_qty_join = |
92 |
C4::Context->preference('AcqCreateItem') eq 'receiving' |
93 |
? 'LEFT JOIN aqorders ON reserves.biblionumber=aqorders.biblionumber' |
94 |
: q{}; |
95 |
|
86 |
my $nfl_comparison = $include_ordered ? '<=' : '='; |
96 |
my $nfl_comparison = $include_ordered ? '<=' : '='; |
87 |
my $strsth = |
97 |
my $strsth = |
88 |
"SELECT reservedate, |
98 |
"SELECT reservedate, |
Lines 107-116
my $strsth =
Link Here
|
107 |
biblio.title, |
117 |
biblio.title, |
108 |
biblio.author, |
118 |
biblio.author, |
109 |
count(DISTINCT reserves.borrowernumber) as reservecount, |
119 |
count(DISTINCT reserves.borrowernumber) as reservecount, |
110 |
count(DISTINCT items.itemnumber) as itemcount |
120 |
count(DISTINCT items.itemnumber) $include_aqorders_qty as itemcount |
111 |
FROM reserves |
121 |
FROM reserves |
112 |
LEFT JOIN items ON items.biblionumber=reserves.biblionumber |
122 |
LEFT JOIN items ON items.biblionumber=reserves.biblionumber |
113 |
LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber |
123 |
LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber |
|
|
124 |
$include_aqorders_qty_join |
114 |
WHERE |
125 |
WHERE |
115 |
notforloan $nfl_comparison 0 AND damaged = 0 AND itemlost = 0 AND withdrawn = 0 |
126 |
notforloan $nfl_comparison 0 AND damaged = 0 AND itemlost = 0 AND withdrawn = 0 |
116 |
$sqldatewhere |
127 |
$sqldatewhere |
117 |
- |
|
|