From 7fe0c6418a5ef9a77b64a8af4b25d807e00c969b Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Thu, 24 Mar 2016 12:55:04 -0400
Subject: [PATCH] Bug 16146 - ACQ: Previewed records in Z39.50 search results
 are wrong

For 3.22.x only:

This patch fixes a bug which was fixed in cataloging by Bug 6367 and
fixed in master by Bug 15318. A misplaced line of JavaScript means that
the popup menu of options shown when clicking in a table cell links to
the wrong record.

To test:

1. Apply the patch and navigate to Acquisitions.
2. Locate an exsiting basket or create a new one.
3. Add to the basket using the option to order from an external source..
4. Perform a search which will return multiple results.
5. Test the "MARC" and "Card" links for multiple results and confirm
   that the correct data is shown each time.
6. Click anywhere in the results table to show the hidden menu and test
   the "Preview MARC," "Preview card," and "Order" links it displays,
   confirming that the actions complete using the correct record.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
---
 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt
index 9b89e91..909297f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt
@@ -40,6 +40,7 @@
         /* Inline edit/delete links */
         $("td").click(function(event){
             var $tgt = $(event.target);
+            var row = $(this).parent();
             $(".linktools").hide();
             $("tr").removeClass("selected");
             if($tgt.is("a")||$tgt.is(":nth-child(5)")||$tgt.is(":nth-child(6)")||$tgt.is(":nth-child(7)")||$tgt.is(":nth-child(8)")){
@@ -50,7 +51,6 @@
                 var left = position.left+5;
                 $(".linktools",row).show().css("position","absolute").css("top",top).css("left",left);
             }
-            var row = $(this).parent();
             row.addClass("selected");
         });
 });
-- 
2.7.0