From a74f8eb6343079eef1af1ccdd1f5e059f8712383 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 26 Sep 2018 11:41:14 -0300 Subject: [PATCH] Bug 21413: Inventory - 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 Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- C4/Items.pm | 6 ++++++ koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt | 4 ++++ tools/inventory.pl | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/C4/Items.pm b/C4/Items.pm index ec2c0a4a6e..09167060a3 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -813,6 +813,7 @@ sub GetItemsForInventory { my $offset = $parameters->{'offset'} // ''; my $size = $parameters->{'size'} // ''; my $statushash = $parameters->{'statushash'} // ''; + my $ignore_waiting_holds = $parameters->{'ignore_waiting_holds'} // ''; my $dbh = C4::Context->dbh; my ( @bind_params, @where_strings ); @@ -875,6 +876,11 @@ sub GetItemsForInventory { push @where_strings, 'issues.date_due IS NULL'; } + if ( $ignore_waiting_holds ) { + $query .= "LEFT JOIN reserves ON items.itemnumber = reserves.itemnumber "; + push( @where_strings, q{reserves.found != 'W' OR reserves.found IS NULL} ); + } + 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 a60e2811e6..e1c63c2365 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -129,6 +129,10 @@ [% END %] +
  • + + +
  • diff --git a/tools/inventory.pl b/tools/inventory.pl index ac33fbefcd..b5c94d6d94 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -46,6 +46,7 @@ my $maxlocation=$input->param('maxlocation'); $maxlocation=$minlocation.'Z' unless ( $maxlocation || ! $minlocation ); my $location=$input->param('location') || ''; my $ignoreissued=$input->param('ignoreissued'); +my $ignore_waiting_holds = $input->param('ignore_waiting_holds'); my $datelastseen = $input->param('datelastseen'); # last inventory date my $branchcode = $input->param('branchcode') || ''; my $branch = $input->param('branch'); @@ -127,6 +128,7 @@ $template->param( datelastseen => $datelastseen, compareinv2barcd => $compareinv2barcd, uploadedbarcodesflag => $uploadbarcodes ? 1 : 0, + ignore_waiting_holds => $ignore_waiting_holds, ); # Walk through uploaded barcodes, report errors, mark as seen, check in @@ -230,6 +232,7 @@ if ( $op && ( !$uploadbarcodes || $compareinv2barcd )) { branch => $branch, offset => 0, statushash => $staton, + ignore_waiting_holds => $ignore_waiting_holds, }); } # Build rightplacelist used to check if a scanned item is in the right place. @@ -244,6 +247,7 @@ if( @scanned_items ) { branch => $branch, offset => 0, statushash => undef, + ignore_waiting_holds => $ignore_waiting_holds, }); # Convert the structure to a hash on barcode $rightplacelist = { -- 2.39.5