Bugzilla – Attachment 62007 Details for
Bug 18394
Add an option to item search to export a barcodes file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 18394: Add an option to item search to export a barcodes file
SIGNED-OFF-Bug-18394-Add-an-option-to-item-search-.patch (text/plain), 6.32 KB, created by
Owen Leonard
on 2017-04-10 15:52:54 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 18394: Add an option to item search to export a barcodes file
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2017-04-10 15:52:54 UTC
Size:
6.32 KB
patch
obsolete
>From f00c118ce10a11383ed0dcfbe38b1744face4518 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 5 Apr 2017 15:37:35 +0200 >Subject: [PATCH] [SIGNED-OFF] Bug 18394: Add an option to item search to > export a barcodes file > >Test plan: >1. Go to item search (/cgi-bin/koha/catalogue/itemsearch.pl) >2. Fill the form with whatever you want >3. Leave the 'Output' option to 'Screen' and click 'Search' >4. Verify that the search still works >5. Click on 'Edit search' and set 'Output' to 'Barcodes file', click 'Search' >6. You should be able to download a 'barcodes.txt' file, open it and compare it > to the previous search results >7. Now click on the 'Export results to barcodes file' button above the results, > you should have the same result as in step 5 >8. Verify that the CSV export still works > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > catalogue/itemsearch.pl | 16 +++++ > .../prog/en/modules/catalogue/itemsearch.tt | 79 ++++++++++++++-------- > 2 files changed, 66 insertions(+), 29 deletions(-) > >diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl >index 66a9cf7..5f20dd3 100755 >--- a/catalogue/itemsearch.pl >+++ b/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 = {}; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >index a904146..5905e3e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >@@ -226,11 +226,54 @@ > + ' <thead>' + tr + tr + '</thead>' > + ' <tbody></tbody>' > + '</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>"; >- results_heading += " | <a class=\"resultstocsv\" href=\"#\">" + _("Output results to csv") + "</a></p>"; >- $('#results-wrapper').empty().html(results_heading + table); >+ >+ var advSearchLink = $('<a>') >+ .attr('href', '/cgi-bin/koha/catalogue/search.pl') >+ .html(_("Go to advanced search")); >+ var editSearchLink = $('<a>') >+ .attr('href', '#') >+ .html(_("Edit search")) >+ .addClass('btn btn-default btn-xs') >+ .on('click', function(e) { >+ e.preventDefault(); >+ $('#item-search-block').show(); >+ }); >+ >+ var csvExportLink = $('<a>') >+ .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 = $('<a>') >+ .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 = $('<p>') >+ .append(editSearchLink) >+ .append(' | ') >+ .append(csvExportLink) >+ .append(' ') >+ .append(barcodesExportLink); >+ >+ var results_heading = $('<div>').addClass('results-heading') >+ .append("<h1>" + _("Item search results") + "</h1>") >+ .append($('<p>').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; >- }); > }); > //]]> > </script> >@@ -479,11 +501,10 @@ > <label>Output:</label> > <input type="radio" id="format-html" name="format" value="html" checked="checked" /> <label for="format-html">Screen</label> > <input type="radio" id="format-csv" name="format" value="csv" /> <label for="format-csv">CSV</label> >+ <input type="radio" id="format-barcodes" name="format" value="barcodes"/> <label for="format-barcodes">Barcodes file</label> > </div> > </fieldset> > </form> >- >- <p><a id="editsearchlink" href="#" style="display:none">Edit search</a></p> > </div> > </div> > <div id="doc3" class="yui-t7"> >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18394
:
61937
|
61938
|
62006
|
62007
|
62068
|
62069