[Koha-cvs] koha C4/Circulation/Circ2.pm koha-tmpl/intranet... [rel_3_0]

paul poulain paul at koha-fr.org
Tue Dec 5 12:23:55 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	paul poulain <tipaul>	06/12/05 11:23:55

Modified files:
	C4/Circulation : Circ2.pm 
	koha-tmpl/intranet-tmpl/prog/en/tools: inventory.tmpl 
	tools          : inventory.pl 

Log message:
	inventory improvement : the librarian can select a branch to filter on

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Circ2.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.114.2.21&r2=1.114.2.22
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/tools/inventory.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/tools/inventory.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.2&r2=1.1.2.3

Patches:
Index: C4/Circulation/Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.114.2.21
retrieving revision 1.114.2.22
diff -u -b -r1.114.2.21 -r1.114.2.22
--- C4/Circulation/Circ2.pm	29 Nov 2006 11:52:50 -0000	1.114.2.21
+++ C4/Circulation/Circ2.pm	5 Dec 2006 11:23:55 -0000	1.114.2.22
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Circ2.pm,v 1.114.2.21 2006/11/29 11:52:50 toins Exp $
+# $Id: Circ2.pm,v 1.114.2.22 2006/12/05 11:23:55 tipaul Exp $
 
 use strict;
 require Exporter;
@@ -38,7 +38,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.114.2.21 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.114.2.22 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -146,7 +146,7 @@
 =cut
 
 sub GetItemsForInventory {
-    my ( $minlocation, $maxlocation, $datelastseen, $offset, $size ) = @_;
+    my ( $minlocation, $maxlocation, $datelastseen, $branch, $offset, $size ) = @_;
     my $dbh = C4::Context->dbh;
     my $sth;
     if ($datelastseen) {
@@ -156,8 +156,9 @@
                    LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber 
                  WHERE itemcallnumber>= ?
                    AND itemcallnumber <=?
-                   AND (datelastseen< ? OR datelastseen IS NULL)
-                 ORDER BY itemcallnumber,title";
+                   AND (datelastseen< ? OR datelastseen IS NULL)";
+        $query.= " AND items.homebranch=".$dbh->quote($branch) if $branch;
+        $query .= " ORDER BY itemcallnumber,title";
         $sth = $dbh->prepare($query);
         $sth->execute( $minlocation, $maxlocation, $datelastseen );
     }
@@ -167,9 +168,9 @@
                 FROM items 
                   LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber 
                 WHERE itemcallnumber>= ?
-                  AND itemcallnumber <=?
-                ORDER BY itemcallnumber,title
-       ";
+                  AND itemcallnumber <=?";
+        $query.= " AND items.homebranch=".$dbh->quote($branch) if $branch;
+        $query .= " ORDER BY itemcallnumber,title";
         $sth = $dbh->prepare($query);
         $sth->execute( $minlocation, $maxlocation );
     }

Index: koha-tmpl/intranet-tmpl/prog/en/tools/inventory.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/tools/Attic/inventory.tmpl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- koha-tmpl/intranet-tmpl/prog/en/tools/inventory.tmpl	30 Oct 2006 10:08:07 -0000	1.1.2.1
+++ koha-tmpl/intranet-tmpl/prog/en/tools/inventory.tmpl	5 Dec 2006 11:23:55 -0000	1.1.2.2
@@ -11,21 +11,33 @@
         <fieldset>
         <legend>Select items you want to check</legend>
         <p>
+        <label>Branch</label><select id="branchloop" name="branchcode">
+        <!-- TMPL_LOOP NAME="branchloop" -->
+            <!-- TMPL_IF name="selected" -->
+                <option value="<!-- TMPL_VAR NAME='value' -->" SELECTED><!-- TMPL_VAR NAME='branchname' --></option>
+            <!-- TMPL_ELSE -->
+                <option value="<!-- TMPL_VAR NAME='value' -->"><!-- TMPL_VAR NAME='branchname' --></option>
+            <!-- /TMPL_IF -->
+        <!-- /TMPL_LOOP -->
+        </select>
+        </p>
+        <p>
             Item Location (items.itemcallnumber) between 
-                <input type="text" name="minlocation" value="<!-- TMPL_VAR NAME="minlocation" -->"> 
+                <input type="text" name="minlocation" value="<!-- TMPL_VAR NAME="minlocation" -->" /> 
             and 
-                <input type="text" name="maxlocation" value="<!-- TMPL_VAR NAME="maxlocation" -->">
+                <input type="text" name="maxlocation" value="<!-- TMPL_VAR NAME="maxlocation" -->" />
         </p>
         <p><label>Not seen since:</label>
-            <input type="text" name="datelastseen" value="<!-- TMPL_VAR NAME="datelastseen" -->">
+            <input type="text" name="datelastseen" value="<!-- TMPL_VAR NAME="datelastseen" -->" />
         </p>
         <p><label>Show:</label>
-            <input type="text" name="pagesize" value="<!-- TMPL_VAR NAME="pagesize" -->" maxlength="5" size="5">
+            <input type="text" name="pagesize" value="<!-- TMPL_VAR NAME="pagesize" -->" maxlength="5" size="5" />
             <i> items beginning at offset</i>
-            <input type="text" name="offset" value="<!-- TMPL_VAR NAME="offset" -->" size="5" maxlength="5">
+            <input type="text" name="offset" value="<!-- TMPL_VAR NAME="offset" -->" size="5" maxlength="5" />
         </p>
         <p>
-            <input type="submit" value="OK" class="button reports">
+            <input type="hidden" name="op" value="do_it" />
+            <input type="submit" value="OK" class="button reports"/>
         </p>
         </fieldset>
     </form>

Index: tools/inventory.pl
===================================================================
RCS file: /sources/koha/koha/tools/Attic/inventory.pl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- tools/inventory.pl	21 Nov 2006 10:45:55 -0000	1.1.2.2
+++ tools/inventory.pl	5 Dec 2006 11:23:55 -0000	1.1.2.3
@@ -25,6 +25,7 @@
 use C4::Interface::CGI::Output;
 use C4::Circulation::Circ2;
 use C4::Date;
+use C4::Koha;
 use HTML::Template;
 
 # Fixed variables
@@ -38,7 +39,7 @@
 #######################################################################################
 # Main loop....
 my $input = new CGI;
-my $minlocation=$input->param('minlocation');
+my $minlocation=$input->param('minlocation') || 'A';
 my $maxlocation=$input->param('maxlocation');
 $maxlocation=$minlocation.'Z' unless $maxlocation;
 my $datelastseen = $input->param('datelastseen');
@@ -49,6 +50,8 @@
 my $pagesize = $input->param('pagesize');
 $pagesize=50 unless $pagesize;
 my $uploadbarcodes = $input->param('uploadbarcodes');
+my $branchcode = $input->param('branchcode');
+my $op = $input->param('op');
 # warn "uploadbarcodes : ".$uploadbarcodes;
 
 my ($template, $borrowernumber, $cookie)
@@ -59,6 +62,17 @@
                 flagsrequired => {tools => 1},
                 debug => 1,
                 });
+
+my $branches = GetBranches();
+my @branch_loop;
+push @branch_loop, {value => "", branchname => "All Branches", };
+for my $branch_hash (keys %$branches) {
+	push @branch_loop, {value => "$branch_hash",
+	                   branchname => $branches->{$branch_hash}->{'branchname'}, 
+	                   selected => ($branch_hash eq $branchcode?1:0)};	
+}
+$template->param(branchloop => \@branch_loop,);
+
 $template->param(minlocation => $minlocation,
                 maxlocation => $maxlocation,
                 offset => $offset,
@@ -117,8 +131,8 @@
             }
         }
     }
-    if ($minlocation) {
-        my $res = C4::Circulation::Circ2::GetItemsForInventory($minlocation,$maxlocation,$datelastseen,$offset,$pagesize);
+    if ($op) {
+        my $res = C4::Circulation::Circ2::GetItemsForInventory($minlocation,$maxlocation,$datelastseen,$branchcode,$offset,$pagesize);
         $template->param(loop =>$res,
                         nextoffset => ($offset+$pagesize),
                         prevoffset => ($offset?$offset-$pagesize:0),





More information about the Koha-cvs mailing list