Bug 17516 - Add CSV export option to item search after displaying output to screen
authorNick Clemens <nick@bywatersolutions.com>
Mon, 31 Oct 2016 13:50:16 +0000 (13:50 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 9 Dec 2016 18:26:14 +0000 (18:26 +0000)
To test:
1 - Perform an item search
2 - Note you now have a link to output to csv
3 - Click that link
4 - Page should not change and you should recieve a csv
5 - Ensure nothing breaks
6 - Sign off
    High five!

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt

index 55f553e..646a05f 100644 (file)
         + '</table>';
       var results_heading = "<h1>" + _("Item search results") + "</h1>";
       results_heading += "<p><a href=\"/cgi-bin/koha/catalogue/search.pl\">" + _("Go to advanced search") + "</a></p>";
-      results_heading += "<p><a class=\"editsearchlink\" href=\"#\">" + _("Edit search") + "</a></p>";
+      results_heading += "<p><a class=\"editsearchlink\" href=\"#\">" + _("Edit search") + "</a>";
+      results_heading += " | <a class=\"resultstocsv\" href=\"#\">" + _("Output results to csv") + "</a></p>";
       $('#results-wrapper').empty().html(results_heading + table);
 
       var params = [];
         $(this).hide();
         return false;
       });
+
+      $("body").on("click",".resultstocsv",function(e) {
+        e.preventDefault();
+        $('#format-csv').prop("checked",true);
+        $('#itemsearchform').submit();
+        hideForm();
+        $('#format-html').prop("checked",true);
+        return false;
+      });
     });
     //]]>
   </script>