From 9eed6c5190818b9ed40bedcb0242be9d8fc34f62 Mon Sep 17 00:00:00 2001 From: David Bourgault Date: Tue, 28 Nov 2017 11:23:01 -0500 Subject: [PATCH] Bug 19708: Improve code for printing the cart in OPAC MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This removes a lot of useless code relating to the print function from opac-basket.tt, opac-basket.pl and opac/basket.js. It also fixes the CSS so that no extra blank page is printed. To test: 0) Add an item to your cart 1) Print your basket Note the appearance of the page. There will be an extra blank page. 2) Apply patch 3) Reload basket 4) Print your basket The appearce should be identical. The extra blank page is gone. This only affects the OPAC. Signed-off-by: Tomás Cohen Arazi Signed-off-by: claude Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- .../bootstrap/en/modules/opac-basket.tt | 39 +++---------------- koha-tmpl/opac-tmpl/bootstrap/js/basket.js | 5 --- opac/opac-basket.pl | 2 - 3 files changed, 5 insertions(+), 41 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt index 2350369eb1..6eca240b1f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -5,7 +5,7 @@ [% INCLUDE 'doc-head-open.inc' %] [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your cart [% INCLUDE 'doc-head-close.inc' %] -[% BLOCK cssinclude %][% END %] +[% BLOCK cssinclude %][% END %] [% INCLUDE 'bodytag.inc' bodyid='basket' %]
@@ -14,8 +14,6 @@

Your cart

- - [% UNLESS ( print_basket ) %]
[% IF ( verbose ) %] Brief display @@ -26,7 +24,7 @@ Send [% END %] Download - Print + Print Empty and close Hide window
@@ -59,22 +57,15 @@ [% END %]
- [% END # / UNLESS print_basket %] [% IF ( verbose ) %]
[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]

- [% IF ( print_basket ) %] - [% BIBLIO_RESULT.title |html %] - [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield |html %] [% END %][% END %] - [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author |html %][% END %] - [% ELSE %] [% BIBLIO_RESULT.title |html %] [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield |html %] [% END %][% END %] [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author |html %][% END %] - [% END # / IF print_basket %]

@@ -247,7 +238,7 @@ - [% UNLESS ( print_basket ) %][% END %] + @@ -257,11 +248,9 @@ [% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %] - [% UNLESS ( print_basket ) %] - - [% END %]
   Title Author Year
+ [% BIBLIO_RESULT.title |html %][% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %][% subtitl.subfield |html %][% END %][% END %] @@ -295,11 +284,9 @@ [% END # / verbose %] - [% UNLESS ( print_basket ) %]
- [% END %] @@ -310,17 +297,7 @@ [% INCLUDE 'opac-bottom.inc' %] [% BLOCK jsinclude %] - [% IF ( print_basket ) %] - - [% ELSE %] - + [% INCLUDE 'datatables.inc' %] - [% END # / IF print_basket %] [% END # / BLOCK jsinclude %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js index ac5b1cdcc4..cd8d43931a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js @@ -366,11 +366,6 @@ function downloadBasket() { open(loc,"win_form",'scrollbars=no,resizable=no,height=300,width=450,top=50,left=100'); } -function printBasket() { - var loc = document.location + "&print=1"; - document.location = loc; -} - function showMore() { var strCookie = ""; diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl index f84258749b..87eea86e82 100755 --- a/opac/opac-basket.pl +++ b/opac/opac-basket.pl @@ -40,11 +40,9 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( ); my $bib_list = $query->param('bib_list'); -my $print_basket = $query->param('print'); my $verbose = $query->param('verbose'); if ($verbose) { $template->param( verbose => 1 ); } -if ($print_basket) { $template->param( print_basket => 1 ); } my @bibs = split( /\//, $bib_list ); my @results; -- 2.39.5