@@ -, +, @@ export a barcodes file to the previous search results you should have the same result as in step 5 --- catalogue/itemsearch.pl | 16 +++++ .../prog/en/modules/catalogue/itemsearch.tt | 79 ++++++++++++++-------- 2 files changed, 66 insertions(+), 29 deletions(-) --- a/catalogue/itemsearch.pl +++ a/catalogue/itemsearch.pl @@ -75,6 +75,9 @@ if (defined $format and $format eq 'json') { # Retrieve all results $cgi->param('rows', 0); +} elsif (defined $format and $format eq 'barcodes') { + # Retrieve all results + $cgi->param('rows', 0); } elsif (defined $format) { die "Unsupported format $format"; } @@ -196,6 +199,19 @@ if (scalar keys %params > 0) { }; my ($results, $total_rows) = SearchItems($filter, $search_params); + + if ($format eq 'barcodes') { + print $cgi->header({ + type => 'text/plain', + attachment => 'barcodes.txt', + }); + + foreach my $item (@$results) { + print $item->{barcode} . "\n"; + } + exit; + } + if ($results) { # Get notforloan labels my $notforloan_map = {}; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt @@ -226,11 +226,54 @@ + ' ' + tr + tr + '' + ' ' + ''; - var results_heading = "

" + _("Item search results") + "

"; - results_heading += "

" + _("Go to advanced search") + "

"; - results_heading += "

" + _("Edit search") + ""; - results_heading += " | " + _("Output results to csv") + "

"; - $('#results-wrapper').empty().html(results_heading + table); + + var advSearchLink = $('') + .attr('href', '/cgi-bin/koha/catalogue/search.pl') + .html(_("Go to advanced search")); + var editSearchLink = $('') + .attr('href', '#') + .html(_("Edit search")) + .addClass('btn btn-default btn-xs') + .on('click', function(e) { + e.preventDefault(); + $('#item-search-block').show(); + }); + + var csvExportLink = $('') + .attr('href', '#') + .html(_("Export results to CSV")) + .addClass('btn btn-default btn-xs') + .on('click', function(e) { + e.preventDefault(); + $('#format-csv').prop('checked', true); + $('#itemsearchform').submit(); + $('#format-html').prop('checked', true); + }); + var barcodesExportLink = $('') + .attr('href', '#') + .html(_("Export results to barcodes file")) + .addClass('btn btn-default btn-xs') + .on('click', function(e) { + e.preventDefault(); + $('#format-barcodes').prop('checked', true); + $('#itemsearchform').submit(); + $('#format-html').prop('checked', true); + }); + + var editSearchAndExportLinks = $('

') + .append(editSearchLink) + .append(' | ') + .append(csvExportLink) + .append(' ') + .append(barcodesExportLink); + + var results_heading = $('

').addClass('results-heading') + .append("

" + _("Item search results") + "

") + .append($('

').append(advSearchLink)) + .append(editSearchAndExportLinks); + $('#results-wrapper').empty() + .append(results_heading) + .append(table); var params = []; $form.find('select').not(':disabled').find('option:selected').each(function () { @@ -310,11 +353,6 @@ }); } - function hideForm() { - $("#item-search-block").hide(); - $('.editsearchlink').show(); - } - $(document).ready(function () { $('#toolbar').fixFloat(); // Add the "New field" link. @@ -351,26 +389,10 @@ var format = searchform.find('input[name="format"]:checked').val(); if (format == 'html') { submitForm(searchform); - hideForm(); + $("#item-search-block").hide(); return false; } }); - - $("body").on("click",".editsearchlink",function(e) { - e.preventDefault(); - $('#item-search-block').show(); - $(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; - }); }); //]]> @@ -479,11 +501,10 @@ +

- -

--