Adding selection by location for inventory

This commit is contained in:
hdl 2007-07-19 07:40:08 +00:00
parent 2b6116a057
commit fbec734d57
2 changed files with 43 additions and 14 deletions

View file

@ -1114,10 +1114,11 @@ offset & size can be used to retrieve only a part of the whole listing (defaut b
=cut
sub GetItemsForInventory {
my ( $minlocation, $maxlocation, $datelastseen, $branch, $offset, $size ) = @_;
my ( $minlocation, $maxlocation,$location, $datelastseen, $branch, $offset, $size ) = @_;
my $dbh = C4::Context->dbh;
my $sth;
if ($datelastseen) {
$datelastseen=format_date_in_iso($datelastseen);
my $query =
"SELECT itemnumber,barcode,itemcallnumber,title,author,datelastseen
FROM items
@ -1125,6 +1126,7 @@ sub GetItemsForInventory {
WHERE itemcallnumber>= ?
AND itemcallnumber <=?
AND (datelastseen< ? OR datelastseen IS NULL)";
$query.= " AND items.location=".$dbh->quote($location) if $location;
$query.= " AND items.homebranch=".$dbh->quote($branch) if $branch;
$query .= " ORDER BY itemcallnumber,title";
$sth = $dbh->prepare($query);
@ -1137,6 +1139,7 @@ sub GetItemsForInventory {
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
WHERE itemcallnumber>= ?
AND itemcallnumber <=?";
$query.= " AND items.location=".$dbh->quote($location) if $location;
$query.= " AND items.homebranch=".$dbh->quote($branch) if $branch;
$query .= " ORDER BY itemcallnumber,title";
$sth = $dbh->prepare($query);
@ -1145,6 +1148,7 @@ sub GetItemsForInventory {
my @results;
while ( my $row = $sth->fetchrow_hashref ) {
$offset-- if ($offset);
$row->{datelastseen}=format_date($row->{datelastseen});
if ( ( !$offset ) && $size ) {
push @results, $row;
$size--;
@ -1543,15 +1547,17 @@ sub GetMarcBiblio {
my $sth =
$dbh->prepare("select marcxml from biblioitems where biblionumber=? ");
$sth->execute($biblionumber);
my ($marcxml) = $sth->fetchrow;
MARC::File::XML->default_record_format(C4::Context->preference('marcflavour'));
$marcxml =~ s/\x1e//g;
$marcxml =~ s/\x1f//g;
$marcxml =~ s/\x1d//g;
$marcxml =~ s/\x0f//g;
$marcxml =~ s/\x0c//g;
my ($marcxml) = $sth->fetchrow;
MARC::File::XML->default_record_format(C4::Context->preference('marcflavour'));
$marcxml =~ s/\x1e//g;
$marcxml =~ s/\x1f//g;
$marcxml =~ s/\x1d//g;
$marcxml =~ s/\x0f//g;
$marcxml =~ s/\x0c//g;
# warn $marcxml;
my $record = MARC::Record->new();
$record = MARC::Record::new_from_xml( $marcxml, "utf8",C4::Context->preference('marcflavour')) if $marcxml;
$record = MARC::Record::new_from_xml( $marcxml, "utf8",C4::Context->preference('marcflavour')) if $marcxml;
# $record = MARC::Record::new_from_usmarc( $marc) if $marc;
return $record;
}
@ -2022,9 +2028,9 @@ sub TransformHtmlToXml {
@$values[$i] =~ s/>/&gt;/g;
@$values[$i] =~ s/"/&quot;/g;
@$values[$i] =~ s/'/&apos;/g;
if ( !utf8::is_utf8( @$values[$i] ) ) {
utf8::decode( @$values[$i] );
}
# if ( !utf8::is_utf8( @$values[$i] ) ) {
# utf8::decode( @$values[$i] );
# }
if ( ( @$tags[$i] ne $prevtag ) ) {
$j++ unless ( @$tags[$i] eq "" );
if ( !$first ) {
@ -3956,6 +3962,9 @@ Joshua Ferraro jmf@liblime.com
# $Id$
# $Log$
# Revision 1.218 2007/07/19 07:40:08 hdl
# Adding selection by location for inventory
#
# Revision 1.217 2007/07/03 13:47:44 tipaul
# fixing some display bugs (itemtype not properly returned and a html table bug that makes items appear strangely
#

View file

@ -4,10 +4,10 @@
<!--TMPL_INCLUDE NAME="menus.inc" --><!-- TMPL_INCLUDE NAME="menu-reports.inc"-->
<!-- Additions to enable Calendar system -->
<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar-system.css">
<!-- End of additions --><!-- Additions to enable Calendar system -->
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar.js"></script>
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar-en.js"></script>
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar-setup.js"></script>
<!-- End of additions -->
<h1>Inventory/Stocktaking</h1>
<form method="post">
<fieldset>
@ -29,6 +29,20 @@
and
<input type="text" name="maxlocation" value="<!-- TMPL_VAR NAME="maxlocation" -->" />
</p>
<!-- TMPL_IF NAME="authorised_values" -->
<p>
Item Location (items.location) is
<select id="locationloop" name="location">
<option value="">Filter location</option>
<!-- TMPL_LOOP NAME="authorised_values" -->
<!-- TMPL_IF name="selected" -->
<option value="<!-- TMPL_VAR NAME='authorised_value' -->" selected><!-- TMPL_VAR NAME='lib' --></option>
<!-- TMPL_ELSE -->
<option value="<!-- TMPL_VAR NAME='authorised_value' -->"><!-- TMPL_VAR NAME='lib' --></option>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</select> </p>
<!-- /TMPL_IF -->
<p><label>Not seen since:</label>
<input type="text" id="datelastseen" name="datelastseen" value="<!-- TMPL_VAR NAME="datelastseen" -->" />
<img src="<!-- TMPL_VAR Name="themelang" -->/includes/calendar/cal.gif" id="datelastseen_button" />
@ -88,6 +102,8 @@
<input type="hidden" name="markseen" value="1">
<input type="hidden" name="minlocation" value="<!-- TMPL_VAR NAME="minlocation" -->">
<input type="hidden" name="maxlocation" value="<!-- TMPL_VAR NAME="maxlocation" -->">
<input type="hidden" name="location" value="<!-- TMPL_VAR NAME="location" -->">
<input type="hidden" name="branchcode" value="<!-- TMPL_VAR NAME="branchcode" -->">
<input type="hidden" name="datelastseen" value="<!-- TMPL_VAR NAME="datelastseen" -->">
<input type="hidden" name="pagesize" value="<!-- TMPL_VAR NAME="pagesize" -->">
<input type="hidden" name="offset" value="<!-- TMPL_VAR NAME="offset" -->">
@ -118,11 +134,12 @@
</table>
<input type="submit" value="Mark seen">
</form>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="offset" -->
<form method="post">
<input type="hidden" name="minlocation" value="<!-- TMPL_VAR NAME="minlocation" -->">
<input type="hidden" name="maxlocation" value="<!-- TMPL_VAR NAME="maxlocation" -->">
<input type="hidden" name="location" value="<!-- TMPL_VAR NAME="location" -->">
<input type="hidden" name="branchcode" value="<!-- TMPL_VAR NAME="branchcode" -->">
<input type="hidden" name="datelastseen" value="<!-- TMPL_VAR NAME="datelastseen" -->">
<input type="hidden" name="pagesize" value="<!-- TMPL_VAR NAME="pagesize" -->">
<input type="hidden" name="offset" value="<!-- TMPL_VAR NAME="prevoffset" -->">
@ -131,6 +148,8 @@
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="nextoffset" -->
<form method="post">
<input type="hidden" name="location" value="<!-- TMPL_VAR NAME="location" -->">
<input type="hidden" name="branchcode" value="<!-- TMPL_VAR NAME="branchcode" -->">
<input type="hidden" name="minlocation" value="<!-- TMPL_VAR NAME="minlocation" -->">
<input type="hidden" name="maxlocation" value="<!-- TMPL_VAR NAME="maxlocation" -->">
<input type="hidden" name="datelastseen" value="<!-- TMPL_VAR NAME="datelastseen" -->">
@ -139,5 +158,6 @@
<input type="submit" value="&gt;&gt;&gt;" class="button reports">
</form>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->