From e37edbd8423e19c8e812d8ff3e0ffd7623ee93e1 Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Fri, 7 Mar 2014 10:16:13 -0500
Subject: [PATCH] Bug 10558 [QA Follow-up 8]

---
 C4/ImportBatch.pm                                  |    6 ++++--
 .../prog/en/modules/tools/manage-marc-import.tt    |   12 +++++++++---
 tools/batch_records_ajax.pl                        |    2 --
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm
index f320c7a..6ddab77 100644
--- a/C4/ImportBatch.pm
+++ b/C4/ImportBatch.pm
@@ -1032,8 +1032,10 @@ sub GetImportRecordsRange {
 
     my $dbh = C4::Context->dbh;
 
-    my $order_by =
-      $dbh->quote_identifier( $parameters->{order_by} || 'import_record_id' );
+    my $order_by = $parameters->{order_by} || 'import_record_id';
+    ( $order_by ) = grep( /^$order_by$/, qw( import_record_id title status overlay_status ) ) ? $order_by : 'import_record_id';
+    $order_by .= ",authorized_heading" if $order_by eq 'title';
+
     my $order_by_direction =
       uc( $parameters->{order_by_direction} ) eq 'DESC' ? 'DESC' : 'ASC';
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
index eed77d1..40f916d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
@@ -58,6 +58,12 @@ $(document).ready(function(){
               });
           },
           "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
+            [% IF ( record_type == 'auth' ) %]
+                var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
+            [% ELSE %]
+                var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
+            [% END %]
+
             $('td:eq(1)', nRow).html(
                 '<a href="javascript:void(0)" onclick="show_marc('
                 + aData['import_record_id']
@@ -86,14 +92,14 @@ $(document).ready(function(){
                     + aData['match_id']
                     + " (" + _("score") + "="
                     + aData['score']
-                    + '):' + '<a target="_blank" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber='
+                    + '):' + '<a target="_blank" href="' + record_details_url
                     + aData['match_id'] + '">' + aData['match_citation'] + '</a>'
                 );
             }
 
             $('td:eq(5)', nRow).html(
-                '<a target="_blank" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber='
-                + aData['matched'] + '">' + aData['matched'] + '</a>'
+                '<a target="_blank" href="' + record_details_url
+                    + aData['matched'] + '">' + aData['matched'] + '</a>'
             );
           },
       });
diff --git a/tools/batch_records_ajax.pl b/tools/batch_records_ajax.pl
index e32d41b..bc0fe82 100755
--- a/tools/batch_records_ajax.pl
+++ b/tools/batch_records_ajax.pl
@@ -1,7 +1,5 @@
 #!/usr/bin/perl
 
-# This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html)
-
 # Copyright 2013 ByWater Solutions
 # Based on circ/ysearch.pl: Copyright 2007 Tamil s.a.r.l.
 #
-- 
1.7.2.5