From da9e5ac4f2766c9cd4519b1551bedc9059f258be Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 16 Dec 2013 10:50:31 -0500 Subject: [PATCH] Bug 11405 [2] - Skip items with waiting holds This patch enables items to be skipped for inventory stocktaking if the item is currently a waiting hold. The intention is to skip items that should be on the holds waiting shelf in the library. Test Plan: 1) Apply this patch 2) Generate a list of barcodes ordered by callnumber 3) Select one of those items and place it on hold, then confirm the hold 4) Remove that barcode from the list of barcodes 5) Browse to the inventory tool, choose your barcodes file 6) Run the inventory tool with that barcode file. 7) Note the tool says that item should have been scanned 8) Click the browsers back button to return to the previous page 9) Check the checkbox for "Skip copies marked as waiting holds" 10) Run the tool again, not it does not flag that item as previously --- C4/Items.pm | 9 +++++++-- .../prog/en/modules/tools/inventory.tt | 5 +++++ tools/inventory.pl | 4 +++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 80361b9..994dbe0 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -979,7 +979,7 @@ sub GetLostItems { =head2 GetItemsForInventory -($itemlist, $iTotalRecords) = GetItemsForInventory($minlocation, $maxlocation, $location, $itemtype, $ignoreissued, $datelastseen, $branchcode, $offset, $size, $statushash); +($itemlist, $iTotalRecords) = GetItemsForInventory($minlocation, $maxlocation, $location, $itemtype, $ignoreissued, $ignore_holds_waiting, $datelastseen, $branchcode, $offset, $size, $statushash); Retrieve a list of title/authors/barcode/callnumber, for biblio inventory. @@ -997,7 +997,7 @@ $iTotalRecords is the number of rows that would have been returned without the $ =cut sub GetItemsForInventory { - my ( $minlocation, $maxlocation,$location, $itemtype, $ignoreissued, $datelastseen, $branchcode, $branch, $offset, $size, $statushash ) = @_; + my ( $minlocation, $maxlocation,$location, $itemtype, $ignoreissued, $ignore_holds_waiting, $datelastseen, $branchcode, $branch, $offset, $size, $statushash ) = @_; my $dbh = C4::Context->dbh; my ( @bind_params, @where_strings ); @@ -1059,6 +1059,11 @@ sub GetItemsForInventory { push @where_strings, 'issues.date_due IS NULL'; } + if ( $ignore_holds_waiting ) { + $query .= "LEFT JOIN reserves ON items.itemnumber = reserves.itemnumber "; + push( @where_strings, q{reserves.found != 'W'} ); + } + if ( @where_strings ) { $query .= 'WHERE '; $query .= join ' AND ', @where_strings; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt index 6d19f20..b1a596d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -174,6 +174,11 @@ $(document).ready(function(){ [% END %]
  • +
  • + + +
  • +
  • diff --git a/tools/inventory.pl b/tools/inventory.pl index a357f35..2529106 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -46,6 +46,7 @@ $maxlocation=$minlocation.'Z' unless ( $maxlocation || ! $minlocation ); my $location=$input->param('location') || ''; my $itemtype=$input->param('itemtype'); # FIXME note, template does not currently supply this my $ignoreissued=$input->param('ignoreissued'); +my $ignore_holds_waiting = $input->param('ignore_holds_waiting'); my $datelastseen = $input->param('datelastseen'); my $markseen = $input->param('markseen'); my $branchcode = $input->param('branchcode') || ''; @@ -135,6 +136,7 @@ $template->param( maxlocation => $maxlocation, location => $location, ignoreissued => $ignoreissued, + ignore_holds_waiting => $ignore_holds_waiting, branchcode => $branchcode, branch => $branch, datelastseen => $datelastseen, @@ -199,7 +201,7 @@ my @items_with_problems; if ( $markseen or $op ) { # retrieve all items in this range. my $totalrecords; - ($inventorylist, $totalrecords) = GetItemsForInventory($minlocation, $maxlocation, $location, $itemtype, $ignoreissued, '', $branchcode, $branch, 0, undef , $staton); + ($inventorylist, $totalrecords) = GetItemsForInventory($minlocation, $maxlocation, $location, $itemtype, $ignoreissued, $ignore_holds_waiting, '', $branchcode, $branch, 0, undef , $staton); } # If "compare barcodes list to results" has been checked, we want to alert for missing items -- 1.7.2.5