diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl index 35d1a0039d..e66aa4f498 100755 --- a/catalogue/itemsearch.pl +++ b/catalogue/itemsearch.pl @@ -303,7 +303,10 @@ if ($format eq 'csv') { type => 'text/csv', attachment => 'items.csv', }); - print $template->output; + + for my $line ( split '\n', $template->output ) { + print "$line\n" unless $line =~ m|^\s*$|; + } } else { output_with_http_headers $cgi, $cookie, $template->output, $content_type; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc index fd6e835a9d..9cc781c262 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc @@ -1,4 +1,4 @@ [%- USE Branches -%] [%- biblio = item.biblio -%] [%- biblioitem = item.biblioitem -%] -"[% biblio.title |html %] by [% biblio.author |html %]", "[% biblioitem.publicationyear |html %]", "[% biblioitem.publishercode |html %]", "[% biblioitem.collectiontitle |html %]", "[% item.barcode |html %]", "[% item.itemcallnumber |html %]", "[% Branches.GetName(item.homebranch) |html %]", "[% Branches.GetName(item.holdingbranch) |html %]", "[% item.location |html %]", "[% item.stocknumber |html %]", "[% item.status |html %]", "[% (item.issues || 0) |html %]" +"[% biblio.title |html %] by [% biblio.author |html %]", "[% biblioitem.publicationyear |html %]", "[% biblioitem.publishercode |html %]", "[% biblioitem.collectiontitle |html %]", "[% item.barcode |html %]", "[% item.itemcallnumber |html %]", "[% Branches.GetName(item.homebranch) |html %]", "[% Branches.GetName(item.holdingbranch) |html %]", "[% item.location |html %]", "[% item.stocknumber |html %]", "[% item.status |html %]", "[% (item.issues || 0) |html %]"[% INCLUDE 'empty_line.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt new file mode 100644 index 0000000000..28fabe707d --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt @@ -0,0 +1 @@ +Title, Publication Date, Publisher, Collection, Barcode, Call number, Home library, Current location, Shelving location, Inventory number, Status, Checkouts diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/empty_line.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/empty_line.inc new file mode 100644 index 0000000000..e69de29bb2 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.csv.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.csv.tt index 45cfd3281a..49878c4870 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.csv.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.csv.tt @@ -1,4 +1,4 @@ -Title, Publication Date, Publisher, Collection, Barcode, Call number, Home library, Current location, Shelving location, Inventory number, Status, Checkouts +[% INCLUDE csv_headers/catalogue/itemsearch.tt %] [% FOREACH item IN results -%] [%- INCLUDE 'catalogue/itemsearch_item.csv.inc' item = item -%] [%- END -%]