From 39e9917b0bbcbbb681b0c8048ce364dde87b3fb7 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Fri, 27 Jan 2017 03:37:31 +0000 Subject: [PATCH] Bug 12691: Use Koha.Preference in Self-Checkout For calls to SCOUserJS, SCOUserCSS, OPACUserCSS, AllowSelfCheckReturns, OpacFavicon, ShowPatronImageInWebBasedSelfCheck, SelfCheckoutByLogin Sponsored-by: Catalyst IT Signed-off-by: Katrin Fischer https://bugs.koha-community.org/show_bug.cgi?id=12601 --- .../opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 24 +++++++++++----------- opac/sco/sco-main.pl | 19 +++-------------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt index f7fae7b..e6356ac 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt @@ -5,12 +5,12 @@ [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] › Self checkout - + -[% IF ( OPACUserCSS ) %][% END %] -[% IF ( SCOUserCSS ) %][% END %] +[% IF ( Koha.Preference('OPACUserCSS') ) %][% END %] +[% IF ( Koha.Preference('SCOUserCSS') ) %][% END %] @@ -25,7 +25,7 @@
- [% IF ( display_patron_image ) %] + [% IF ( Koha.Preference('ShowPatronImageInWebBasedSelfCheck') ) %]
[% ELSE %]
@@ -76,7 +76,7 @@ Please see a member of the library staff.

- [% IF ( returnitem && AllowSelfCheckReturns ) %] + [% IF ( returnitem && Koha.Preference('AllowSelfCheckReturns') ) %]
@@ -100,7 +100,7 @@

This item is already checked out to you.

[% END %] - [% IF ( renew && AllowSelfCheckReturns ) %] + [% IF ( renew && Koha.Preference('AllowSelfCheckReturns') ) %] @@ -184,7 +184,7 @@
- Check out[% IF ( AllowSelfCheckReturns ) %], return[% END %] or renew an item: + Check out[% IF ( Koha.Preference('AllowSelfCheckReturns') ) %], return[% END %] or renew an item:
@@ -202,7 +202,7 @@
- [% IF ( display_patron_image ) %] + [% IF ( Koha.Preference('ShowPatronImageInWebBasedSelfCheck') && image_exists ) %]
@@ -269,7 +269,7 @@ [% ELSE %] No renewals allowed [% END %] - [% IF AllowSelfCheckReturns %] + [% IF Koha.Preference('AllowSelfCheckReturns') %] @@ -294,7 +294,7 @@
- [% IF ( authbylogin ) %] + [% IF ( Koha.Preference('SelfCheckoutByLogin') ) %] Log in to your account @@ -309,7 +309,7 @@
- [% END # / IF authbylogin %] + [% END %] [% FOREACH INPUT IN INPUTS %] @@ -418,5 +418,5 @@ //]]> - [% IF ( SCOUserJS ) %][% END %] + [% IF ( Koha.Preference('SCOUserJS') ) %][% END %] [% END %] diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 80ac47d..c7718d1 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -76,25 +76,18 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ debug => 1, }); -if (C4::Context->preference('SelfCheckoutByLogin')) -{ - $template->param(authbylogin => 1); -} - # Get the self checkout timeout preference, or use 120 seconds as a default my $selfchecktimeout = 120000; if (C4::Context->preference('SelfCheckTimeout')) { $selfchecktimeout = C4::Context->preference('SelfCheckTimeout') * 1000; } -$template->param(SelfCheckTimeout => $selfchecktimeout); +$template->param( SelfCheckTimeout => $selfchecktimeout ); # Checks policy laid out by AllowSelfCheckReturns, defaults to 'on' if preference is undefined my $allowselfcheckreturns = 1; if (defined C4::Context->preference('AllowSelfCheckReturns')) { $allowselfcheckreturns = C4::Context->preference('AllowSelfCheckReturns'); } -$template->param(AllowSelfCheckReturns => $allowselfcheckreturns); - my $issuerid = $loggedinuser; my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed) = ( @@ -300,9 +293,8 @@ if ($borrower->{cardnumber}) { if (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) { my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber}); $template->param( - display_patron_image => 1, - cardnumber => $borrower->{cardnumber}, - csrf_token => Koha::Token->new->generate_csrf( { session_id => scalar $query->cookie('CGISESSID') . $borrower->{cardnumber}, id => $borrower->{userid}} ), + image_exists => 1, + csrf_token => Koha::Token->new->generate_csrf( { session_id => scalar $query->cookie('CGISESSID') . $borrower->{cardnumber}, id => $borrower->{userid}} ), ) if $patron_image; } } else { @@ -312,9 +304,4 @@ if ($borrower->{cardnumber}) { ); } -$template->param( - SCOUserJS => C4::Context->preference('SCOUserJS'), - SCOUserCSS => C4::Context->preference('SCOUserCSS'), -); - output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; -- 2.1.4