[Koha-patches] [PATCH] bugfix inventory skips records when marking and continuing

Michael Hafen mdhafen at tech.washk12.org
Thu Oct 1 17:59:46 CEST 2009


In the Inventory tool when the user uses the 'Mark Seen and Continue' button
the tool will skip forward the number of selected records because the next
offset isn't adjusted for the records which were taken out of the list.

Also select the user's branch by default if IndependantBranches is on.
---
 tools/inventory.pl |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/inventory.pl b/tools/inventory.pl
index 8474d7d..8ab13f5 100755
--- a/tools/inventory.pl
+++ b/tools/inventory.pl
@@ -56,6 +56,9 @@ my ($template, $borrowernumber, $cookie)
                 debug => 1,
                 });
 
+if ( ! $branchcode && C4::Branch::onlymine() ) {
+    $branchcode = C4::Branch::mybranch();
+}
 my $branches = GetBranches();
 my @branch_loop;
 push @branch_loop, {value => "", branchname => "All Locations", };
@@ -150,16 +153,17 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){
 # 	$template->param(errorfile=>$errorfile) if ($errorfile);
     $template->param(errorloop=>\@errorloop) if (@errorloop);
 }else{
+    my $seen = 0;  # if this page gets smaller the next offset needs adjusting
     if ($markseen) {
         foreach ($input->param) {
-            /SEEN-(.+)/ and &ModDateLastSeen($1);
+            /SEEN-(.+)/ and &ModDateLastSeen($1) and $seen++;
         }
     }
     if ($markseen or $op) {
-        my $res = GetItemsForInventory($minlocation,$maxlocation,$location,$itemtype,$ignoreissued,$datelastseen,$branchcode,$offset,$pagesize);
+        my $res = GetItemsForInventory($minlocation,$maxlocation,$location,$itemtype,$ignoreissued,$datelastseen,$branchcode,$offset-$seen,$pagesize);
         $template->param(loop =>$res,
-                        nextoffset => ($offset+$pagesize),
-                        prevoffset => ($offset?$offset-$pagesize:0),
+                        nextoffset => ($offset-$seen+$pagesize),
+                        prevoffset => (($offset-$pagesize>0)?$offset-$pagesize:0),
                         );
     }
 }
-- 
1.6.0.4




More information about the Koha-patches mailing list