From 808e372f78b3b57d36efc239307d5fc9eb3c5727 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Sat, 21 Mar 2015 11:31:14 -0400 Subject: [PATCH] Bug 13886 - Add ability to merge records directly from cataloging search This patch adds a merge button and checkboxes to the cataloging search results screen to allow librarians to merge directly from these reults To test: 1 - Apply patch 2 - Perform a cataloging search 3 - Try to select 1 or more than 2 records to merge and check that you get an error 4 - Select 2 records to merge and confirm the correct records are passed to the merge tool --- .../prog/en/modules/cataloguing/addbooks.tt | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt index 5619816..59380e2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt @@ -18,6 +18,10 @@ PopupZ3950($(this).prop('id')); return false; }); + $(".merge-items").on("click",function(e){ + e.preventDefault(); + MergeItems(); + }); }); /* this function open a popup to search on z3950 server. */ @@ -36,6 +40,20 @@ return strQuery; } + /** + * This function checks if the adequate number of records are checked for merging + */ + function MergeItems() { + var checkboxes = $("input:checkbox:checked"); + var nbCheckbox = checkboxes.length; + if (nbCheckbox != 2) { + alert(_("Two records must be selected for merging.")); + } else { + location.href='/cgi-bin/koha/cataloguing/merge.pl?biblionumber=' + checkboxes[0].value + '&biblionumber=' + checkboxes[1].value; + } + return false; + } + //]]> @@ -73,6 +91,7 @@ [% END %] +
[% END %] @@ -89,6 +108,7 @@
+ @@ -101,6 +121,7 @@ [% ELSE %] [% END %] +
  Title Location Preview

[% resultsloo.title |html %] -- 1.7.10.4