=cut
sub GetItemsForInventory {
- my ( $minlocation, $maxlocation,$location, $itemtype, $datelastseen, $branch, $offset, $size ) = @_;
+ my ( $minlocation, $maxlocation,$location, $itemtype, $ignoreissued, $datelastseen, $branch, $offset, $size ) = @_;
my $dbh = C4::Context->dbh;
my $query = <<'END_SQL';
-SELECT itemnumber, barcode, itemcallnumber, title, author, biblio.biblionumber, datelastseen
+SELECT items.itemnumber, barcode, itemcallnumber, title, author, biblio.biblionumber, datelastseen
FROM items
LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber
LEFT JOIN biblioitems on items.biblionumber = biblioitems.biblionumber
$query.= ' AND biblioitems.itemtype = ? ';
push @bind_params, $itemtype;
}
+ if ( $ignoreissued) {
+ $query .= "LEFT JOIN issues ON items.itemnumber = issues.itemnumber ";
+ push @where_strings, 'issues.date_due IS NULL';
+ }
+ if ( @where_strings ) {
+ $query .= 'WHERE ';
+ $query .= join ' AND ', @where_strings;
+ }
$query .= ' ORDER BY itemcallnumber, title';
my $sth = $dbh->prepare($query);
$sth->execute( @bind_params );
);
</script>
</li>
+ <li><label for="ignoreissued">Skip copies on loan: </label>
+ <!-- TMPL_IF NAME="ignoreissued" -->
+ <input type="checkbox" id="ignoreissued" name="ignoreissued" checked="checked" /></li>
+ <!-- TMPL_ELSE -->
+ <input type="checkbox" id="ignoreissued" name="ignoreissued" /></li>
+ <!-- /TMPL_IF -->
<li><label for="pagesize">Show: </label>
<input type="text" id="pagesize" name="pagesize" value="<!-- TMPL_VAR NAME="pagesize" -->" maxlength="5" size="5" /> items</li>
<li><label for="offset">Beginning at offset: </label>
$maxlocation=$minlocation.'Z' unless $maxlocation;
my $location=$input->param('location');
my $itemtype=$input->param('itemtype');
+my $ignoreissued=$input->param('ignoreissued');
my $datelastseen = $input->param('datelastseen');
my $offset = $input->param('offset');
my $markseen = $input->param('markseen');
minlocation => $minlocation,
maxlocation => $maxlocation,
location=>$location,
+ ignoreissued=>$ignoreissued,
branchcode=>$branchcode,
offset => $offset,
pagesize => $pagesize,
}
}
if ($markseen or $op) {
- my $res = GetItemsForInventory($minlocation,$maxlocation,$location,$itemtype,$datelastseen,$branchcode,$offset,$pagesize);
+ my $res = GetItemsForInventory($minlocation,$maxlocation,$location,$itemtype,$ignoreissued,$datelastseen,$branchcode,$offset,$pagesize);
$template->param(loop =>$res,
nextoffset => ($offset+$pagesize),
prevoffset => ($offset?$offset-$pagesize:0),