Lines 181-187
sub calculate {
Link Here
|
181 |
$colorder .= $column; |
181 |
$colorder .= $column; |
182 |
|
182 |
|
183 |
my $strsth2; |
183 |
my $strsth2; |
184 |
$strsth2 .= "select distinctrow $colfield FROM borrowers LEFT JOIN `old_issues` USING(borrowernumber)"; |
184 |
$strsth2 .= "select distinct $colfield FROM borrowers WHERE 1"; |
185 |
if ($colfilter[0]) { |
185 |
if ($colfilter[0]) { |
186 |
$colfilter[0] =~ s/\*/%/g; |
186 |
$colfilter[0] =~ s/\*/%/g; |
187 |
$strsth2 .= " and $column LIKE '$colfilter[0]' " ; |
187 |
$strsth2 .= " and $column LIKE '$colfilter[0]' " ; |
Lines 229-238
sub calculate {
Link Here
|
229 |
$strcalc .= "WHERE 1 "; |
229 |
$strcalc .= "WHERE 1 "; |
230 |
@$filters[0]=~ s/\*/%/g if (@$filters[0]); |
230 |
@$filters[0]=~ s/\*/%/g if (@$filters[0]); |
231 |
$strcalc .= " AND borrowers.categorycode like '" . @$filters[0] ."'" if ( @$filters[0] ); |
231 |
$strcalc .= " AND borrowers.categorycode like '" . @$filters[0] ."'" if ( @$filters[0] ); |
232 |
my $strqueryfilter = "SELECT DISTINCT borrowernumber FROM old_issues WHERE borrowernumber IS NOT NULL "; |
232 |
|
233 |
if (@$filters[1]){ |
233 |
my $strqueryfilter = "SELECT DISTINCT borrowernumber FROM "; |
234 |
my $strqueryfilter .= "AND old_issues.timestamp> @$filters[1] "; |
234 |
$strqueryfilter .= "(SELECT borrowernumber from old_issues WHERE borrowernumber IS NOT NULL "; |
|
|
235 |
if ($filters->[1]){ |
236 |
$strqueryfilter .= "AND old_issues.timestamp> '$filters->[1]' "; |
237 |
} |
238 |
$strqueryfilter .= "UNION SELECT borrowernumber FROM issues WHERE 1 "; |
239 |
if ($filters->[1]){ |
240 |
$strqueryfilter .= "AND issues.timestamp> '$filters->[1]' "; |
235 |
} |
241 |
} |
|
|
242 |
$strqueryfilter .= ") active_borrowers"; |
243 |
|
236 |
$strcalc .= " AND borrowers.borrowernumber not in ($strqueryfilter)"; |
244 |
$strcalc .= " AND borrowers.borrowernumber not in ($strqueryfilter)"; |
237 |
$strcalc .= " group by borrowers.borrowernumber"; |
245 |
$strcalc .= " group by borrowers.borrowernumber"; |
238 |
$strcalc .= ", $colfield" if ($column); |
246 |
$strcalc .= ", $colfield" if ($column); |
239 |
- |
|
|