Bug 4931: Stocking can be by homebranch or holding branch

Squashed commit of the following:

commit 105de81639cbac5084e4a5c099b19569043e69ff
Author: Nahuel ANGELINETTI <nahuel.angelinetti@biblibre.com>
Date:   Tue Jul 13 11:58:01 2010 +0200

    (bug #4931) fix forgottens input in buttons

    the previous patch missed an hidden input in next buttons that break next page. This fix it.

commit db00295a6b9d1d36fc888ba6a0558011fd6884ba
Author: Nahuel ANGELINETTI <nahuel.angelinetti@biblibre.com>
Date:   Fri Jul 2 15:27:59 2010 +0200

    (bug #4931) add the ability to choose home or holding branch in stocktaking

    This add radio box in stocktaking to base it on home or holdingbranch

Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>

Bug 4391 Followup: Adding back lost declaration of $branchcode
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Chris Cormack 2011-02-02 19:40:10 -05:00
parent c269dfdeb4
commit 35b47b6ff7
3 changed files with 17 additions and 5 deletions

View file

@ -954,7 +954,7 @@ $statushash requires a hashref that has the authorized values fieldname (intems.
=cut =cut
sub GetItemsForInventory { 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 $dbh = C4::Context->dbh;
my ( @bind_params, @where_strings ); my ( @bind_params, @where_strings );
@ -993,10 +993,14 @@ END_SQL
push @where_strings, 'items.location = ?'; push @where_strings, 'items.location = ?';
push @bind_params, $location; push @bind_params, $location;
} }
if ( $branch ) { if ( $branchcode ) {
if($branch eq "homebranch"){
push @where_strings, 'items.homebranch = ?'; push @where_strings, 'items.homebranch = ?';
push @bind_params, $branch; }else{
push @where_strings, 'items.holdingbranch = ?';
}
push @bind_params, $branchcode;
} }
if ( $itemtype ) { if ( $itemtype ) {

View file

@ -76,6 +76,10 @@ $(document).ready(function(){
<fieldset class="rows"> <fieldset class="rows">
<legend>Select items you want to check</legend> <legend>Select items you want to check</legend>
<ol><li> <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;"> <label for="branchloop">Library</label><select id="branchloop" name="branchcode" style="width:12em;">
<option value="">All Locations</option> <option value="">All Locations</option>
<!-- TMPL_LOOP NAME="branchloop" --> <!-- TMPL_LOOP NAME="branchloop" -->
@ -228,6 +232,7 @@ $(document).ready(function(){
</form> </form>
<!-- TMPL_IF NAME="offset" --> <!-- TMPL_IF NAME="offset" -->
<form method="post" action="/cgi-bin/koha/tools/inventory.pl"> <form method="post" action="/cgi-bin/koha/tools/inventory.pl">
<input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
<input type="hidden" name="minlocation" value="<!-- TMPL_VAR NAME="minlocation" -->" /> <input type="hidden" name="minlocation" value="<!-- TMPL_VAR NAME="minlocation" -->" />
<input type="hidden" name="maxlocation" value="<!-- TMPL_VAR NAME="maxlocation" -->" /> <input type="hidden" name="maxlocation" value="<!-- TMPL_VAR NAME="maxlocation" -->" />
<input type="hidden" name="location" value="<!-- TMPL_VAR NAME="location" -->" /> <input type="hidden" name="location" value="<!-- TMPL_VAR NAME="location" -->" />
@ -241,6 +246,7 @@ $(document).ready(function(){
<!-- /TMPL_IF --> <!-- /TMPL_IF -->
<!-- TMPL_IF NAME="nextoffset" --> <!-- TMPL_IF NAME="nextoffset" -->
<form method="post"> <form method="post">
<input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
<input type="hidden" name="location" value="<!-- TMPL_VAR NAME="location" -->" /> <input type="hidden" name="location" value="<!-- TMPL_VAR NAME="location" -->" />
<input type="hidden" name="branchcode" value="<!-- TMPL_VAR NAME="branchcode" -->" /> <input type="hidden" name="branchcode" value="<!-- TMPL_VAR NAME="branchcode" -->" />
<input type="hidden" name="minlocation" value="<!-- TMPL_VAR NAME="minlocation" -->" /> <input type="hidden" name="minlocation" value="<!-- TMPL_VAR NAME="minlocation" -->" />

View file

@ -49,6 +49,7 @@ $offset=0 unless $offset;
my $pagesize = $input->param('pagesize'); my $pagesize = $input->param('pagesize');
$pagesize=50 unless $pagesize; $pagesize=50 unless $pagesize;
my $branchcode = $input->param('branchcode'); my $branchcode = $input->param('branchcode');
my $branch = $input->param('branch');
my $op = $input->param('op'); my $op = $input->param('op');
my $res; #contains the results loop my $res; #contains the results loop
# warn "uploadbarcodes : ".$uploadbarcodes; # warn "uploadbarcodes : ".$uploadbarcodes;
@ -129,6 +130,7 @@ $template->param(branchloop => \@branch_loop,
location=>$location, location=>$location,
ignoreissued=>$ignoreissued, ignoreissued=>$ignoreissued,
branchcode=>$branchcode, branchcode=>$branchcode,
branch => $branch,
offset => $offset, offset => $offset,
pagesize => $pagesize, pagesize => $pagesize,
datelastseen => $datelastseen, datelastseen => $datelastseen,
@ -183,7 +185,7 @@ if ( ! ($uploadbarcodes && length($uploadbarcodes)>0 ) || ( $input->param('compa
} }
} }
if ($markseen or $op) { 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, $template->param(loop =>$res,
nextoffset => ($offset+$pagesize), nextoffset => ($offset+$pagesize),
prevoffset => ($offset?$offset-$pagesize:0), prevoffset => ($offset?$offset-$pagesize:0),