[Koha-patches] [PATCH] (bug #4931) add the ability to choose home or holding branch in stocktaking

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Fri Jul 2 15:32:21 CEST 2010


This add radio box in stocktaking to base it on home or holdingbranch
---
 C4/Items.pm                                        |   12 ++++++++----
 .../prog/en/modules/tools/inventory.tmpl           |    4 ++++
 tools/inventory.pl                                 |    3 ++-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/C4/Items.pm b/C4/Items.pm
index ffdf6dd..077b728 100644
--- a/C4/Items.pm
+++ b/C4/Items.pm
@@ -1029,7 +1029,7 @@ $statushash requires a hashref that has the authorized values fieldname (intems.
 =cut
 
 sub GetItemsForInventory {
-    my ( $minlocation, $maxlocation, $location, $itemtype, $ignoreissued, $datelastseen, $branch, $offset, $size, $statushash ) = @_;
+    my ( $minlocation, $maxlocation, $location, $itemtype, $ignoreissued, $datelastseen, $branchcode, $branch, $offset, $size, $statushash ) = @_;
     my $dbh = C4::Context->dbh;
     my ( @bind_params, @where_strings );
 
@@ -1069,9 +1069,13 @@ END_SQL
         push @bind_params,   $location;
     }
 
-    if ($branch) {
-        push @where_strings, 'items.homebranch = ?';
-        push @bind_params,   $branch;
+    if ( $branchcode ) {
+        if($branch eq "homebranch"){
+            push @where_strings, 'items.homebranch = ?';
+        }else{
+            push @where_strings, 'items.holdingbranch = ?';
+        }
+        push @bind_params, $branchcode;
     }
 
     if ($itemtype) {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tmpl
index 0b35000..36e8cc4 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tmpl
@@ -76,6 +76,10 @@ $(document).ready(function(){
         <fieldset class="rows">
         <legend>Select items you want to check</legend>
         <ol><li>
+        <label for="branch">Branch</label>
+            <input type="radio" name="branch" value="homebranch">Home Branch</input>
+            <input type="radio" name="branch" value="holdingbranch">Holding Branch</input>
+        </li><li>
         <label for="branchloop">Library</label><select id="branchloop" name="branchcode" style="width:12em;">
             <option value="">All Locations</option>
         <!-- TMPL_LOOP NAME="branchloop" -->
diff --git a/tools/inventory.pl b/tools/inventory.pl
index fea7c17..15f1c61 100755
--- a/tools/inventory.pl
+++ b/tools/inventory.pl
@@ -49,6 +49,7 @@ $offset = 0 unless $offset;
 my $pagesize = $input->param('pagesize');
 $pagesize = 50 unless $pagesize;
 my $branchcode = $input->param('branchcode');
+my $branch     = $input->param('branch');
 my $op         = $input->param('op');
 my $res;                                            #contains the results loop
 
@@ -191,7 +192,7 @@ if ( !( $uploadbarcodes && length($uploadbarcodes) > 0 ) || ( $input->param('com
         }
     }
     if ( $markseen or $op ) {
-        $res = GetItemsForInventory( $minlocation, $maxlocation, $location, $ignoreissued, $itemtype, $datelastseen, $branchcode, $offset, $pagesize, $staton );
+        $res = GetItemsForInventory( $minlocation, $maxlocation, $location, $ignoreissued, $itemtype, $datelastseen, $branchcode, $branch, $offset, $pagesize, $staton );
         $template->param(
             loop       => $res,
             nextoffset => ( $offset + $pagesize ),
-- 
1.7.0.4



More information about the Koha-patches mailing list