Bug 21413: Inventory - Skip items with waiting holds
authorKyle M Hall <kyle@bywatersolutions.com>
Wed, 26 Sep 2018 14:41:14 +0000 (11:41 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 8 Nov 2018 13:32:41 +0000 (13:32 +0000)
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 <tomascohen@theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

C4/Items.pm
koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt
tools/inventory.pl

index ec2c0a4..0916706 100644 (file)
@@ -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;
index a60e281..e1c63c2 100644 (file)
                 <input type="checkbox" id="ignoreissued" name="ignoreissued" />
             [% END %]
         </li>
+        <li>
+            <label for="ignore_waiting_holds">Skip copies marked as waiting holds: </label>
+            <input type="checkbox" id="ignore_waiting_holds" name="ignore_waiting_holds" />
+        </li>
         </ol>
     </fieldset>
 
index ac33fbe..b5c94d6 100755 (executable)
@@ -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 = {