issues_stats returns empty results if row/column = items.ccode/datetime
authorJoe Atzberger <joe.atzberger@liblime.com>
Wed, 20 Aug 2008 20:40:44 +0000 (15:40 -0500)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 4 Nov 2008 17:46:10 +0000 (18:46 +0100)
Also added ESCAPE="HTML" to column/row headers because users may define
collections that include ampersands, like:
    B&T Rental--Fiction
The Tidy error associated would be:
    line 574 column 29 - Error: general entity "T" not defined and no default entity

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tmpl
reports/issues_stats.pl

index 4f2d616..5eb0101 100644 (file)
             <tr>
                 <th><!-- TMPL_VAR name="line" --> / <!-- TMPL_VAR name="column" --></th>
                 <!-- TMPL_LOOP NAME="loopcol" -->
-                    <th><!-- TMPL_VAR NAME="coltitle_display" --></th>
+                    <th><!-- TMPL_VAR ESCAPE="HTML" NAME="coltitle_display" --></th>
                 <!-- /TMPL_LOOP -->
                 <th>TOTAL</th>
                 </tr>
                 <!-- TMPL_LOOP NAME="looprow" -->
                     <tr<!-- TMPL_UNLESS NAME="__odd__" --> class="highlight"<!-- /TMPL_UNLESS -->>
-                        <td><!-- TMPL_VAR NAME="rowtitle_display" DEFAULT="UNKNOWN VALUE"--></td>
+                        <td><!-- TMPL_VAR ESCAPE="HTML" NAME="rowtitle_display" DEFAULT="UNKNOWN VALUE" --></td>
                     <!-- TMPL_LOOP NAME="loopcell" -->
                                                <td><!-- TMPL_VAR NAME="value" DEFAULT="&nbsp;" --></td>
                     <!-- /TMPL_LOOP -->
index 949e0b9..201c676 100755 (executable)
@@ -442,7 +442,9 @@ sub calculate {
         FROM statistics
         LEFT JOIN borrowers ON statistics.borrowernumber=borrowers.borrowernumber
        ";
-       $strcalc .= "LEFT JOIN items ON statistics.itemnumber=items.itemnumber " if (($colsource eq 'items')||@$filters[5]||@$filters[6]||@$filters[7]||@$filters[8]);
+       $strcalc .= "LEFT JOIN items ON statistics.itemnumber=items.itemnumber "
+        if ($linefield =~ /^items\./ or $colfield =~ /^items\./ or ($colsource eq 'items')
+            ||@$filters[5]||@$filters[6]||@$filters[7]||@$filters[8]);
         
        $strcalc .= "WHERE 1=1 ";
        @$filters = map {defined($_) and s/\*/%/g; $_} @$filters;