[Koha-patches] [PATCH] (MT 3267) Add Homebranch and Holdingbranch search criterion on circulation stat.

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Wed May 12 17:19:07 CEST 2010


From: Alex Arnaud <alex.arnaud at biblibre.com>

---
 .../prog/en/modules/reports/issues_stats.tmpl      |   24 ++++++++++
 reports/issues_stats.pl                            |   48 +++++++++++---------
 2 files changed, 51 insertions(+), 21 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tmpl
index 0bfd3ca..1ce07dd 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tmpl
@@ -271,6 +271,30 @@
             </td> 
         </tr>
         <!-- /TMPL_IF -->
+        <tr><td>Home branch</td>
+            <td><input type="radio" name="Line" value="items.homebranch" /></td>
+            <td><input type="radio" name="Column" value="items.homebranch" /></td>
+            <td><select name="Filter" id="homebranch">
+                    <option value=""> </option>
+                    <!-- TMPL_LOOP NAME="branchloop" -->
+                        <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option><!-- /TMPL_IF -->
+				    <!-- /TMPL_LOOP -->
+                </select>
+            </td>
+        </tr>
+
+        <tr><td>Holding branch</td>
+            <td><input type="radio" name="Line" value="items.holdingbranch" /></td>
+            <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
+            <td><select name="Filter" id="holdingbranch">
+                    <option value=""> </option>
+                    <!-- TMPL_LOOP NAME="branchloop" -->
+                        <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option><!-- /TMPL_IF -->
+				    <!-- /TMPL_LOOP -->
+                </select>
+            </td>
+        </tr>
+
         </tbody>
     </table><br /></fieldset>
 
diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl
index 5446378..23f67c1 100755
--- a/reports/issues_stats.pl
+++ b/reports/issues_stats.pl
@@ -228,6 +228,8 @@ sub calculate {
           : ( $i == 8 )  ? "Item callnumber <"
           : ( $i == 9 )  ? "sort1 ="
           : ( $i == 10 ) ? "sort2 ="
+          : ( $i == 11 ) ? "Home branch ="
+          : ( $i == 12 )? "Holding branch ="
           :                "UNKNOWN FILTER ($i)";
 
         # FIXME - no translation mechanism !
@@ -243,33 +245,37 @@ sub calculate {
     my ( $colsource, $linesource );
     $linefilter[1] = @$filters[1] if ( $line =~ /datetime/ );
     $linefilter[0] =
-        ( $line =~ /datetime/ ) ? @$filters[0]
-      : ( $line =~ /category/ ) ? @$filters[2]
-      : ( $line =~ /itemtype/ ) ? @$filters[3]
-      : ( $line =~ /branch/ )   ? @$filters[4]
-      : ( $line =~ /ccode/ )    ? @$filters[5]
-      : ( $line =~ /location/ ) ? @$filters[6]
-      : ( $line =~ /sort1/ )    ? @$filters[9]
-      : ( $line =~ /sort2/ )    ? @$filters[10]
-      :                           undef;
-
-    if ( $line =~ /ccode/ or $line =~ /location/ ) {
+        ( $line =~ /datetime/ )     ? @$filters[0]
+      : ( $line =~ /category/ )     ? @$filters[2]
+      : ( $line =~ /itemtype/ )     ? @$filters[3]
+      : ( $line =~ /branch/ )       ? @$filters[4]
+      : ( $line =~ /ccode/ )        ? @$filters[5]
+      : ( $line =~ /location/ )     ? @$filters[6]
+      : ( $line =~ /sort1/ )        ? @$filters[9]
+      : ( $line =~ /sort2/ )        ? @$filters[10]
+      : ( $line =~ /homebranch/)    ? @$filters[11]
+      : ( $line =~ /holdingbranch/) ? @$filters[12]
+      :                               undef;
+
+    if ( $line =~ /ccode/ or $line =~ /location/ or $line =~ /homebranch/ or $line =~ /holdingbranch/ ) {
         $linesource = 'items';
     }
 
     my @colfilter;
     $colfilter[1] = @$filters[1] if ( $column =~ /datetime/ );
     $colfilter[0] =
-        ( $column =~ /datetime/ ) ? @$filters[0]
-      : ( $column =~ /category/ ) ? @$filters[2]
-      : ( $column =~ /itemtype/ ) ? @$filters[3]
-      : ( $column =~ /branch/ )   ? @$filters[4]
-      : ( $column =~ /ccode/ )    ? @$filters[5]
-      : ( $column =~ /location/ ) ? @$filters[6]
-      : ( $column =~ /sort1/ )    ? @$filters[9]
-      : ( $column =~ /sort1/ )    ? @$filters[10]
-      :                             undef;
-    if ( $column =~ /ccode/ or $column =~ /location/ ) {
+        ( $column =~ /datetime/ )     ? @$filters[0]
+      : ( $column =~ /category/ )     ? @$filters[2]
+      : ( $column =~ /itemtype/ )     ? @$filters[3]
+      : ( $column =~ /branch/ )       ? @$filters[4]
+      : ( $column =~ /ccode/ )        ? @$filters[5]
+      : ( $column =~ /location/ )     ? @$filters[6]
+      : ( $column =~ /sort1/ )        ? @$filters[9]
+      : ( $column =~ /sort1/ )        ? @$filters[10]
+      : ( $column =~ /homebranch/)    ? @$filters[11]
+      : ( $column =~ /holdingbranch/) ? @$filters[12]
+      :                                 undef;
+    if ( $column =~ /ccode/ or $column =~ /location/ or $column =~ /homebranch/ or $column =~ /holdingbranch/ ) {
         $colsource = 'items';
     }
 
-- 
1.7.0.4




More information about the Koha-patches mailing list