From e65c493d5f459cd20fc864d5f076995150749c7c 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 --- 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 f81e0ca1b8..d3736adaec 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -814,6 +814,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 ); @@ -876,6 +877,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 a8a68633a0..06200b0582 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -128,6 +128,10 @@ [% END %] +
  • + + +
  • diff --git a/tools/inventory.pl b/tools/inventory.pl index 2ad1dd8d2c..ca46ea2801 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'); @@ -126,6 +127,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 @@ -229,6 +231,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. @@ -243,6 +246,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.11.0