From 7c9d82635c2dc050d2bcecbae8a30c0987400e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> Date: Tue, 18 Apr 2017 15:55:06 +0200 Subject: [PATCH] [SIGNED-OFF] Bug 17381: Add system preference SCOMainUserBlock This patch adds a system preference SCOMainUserBlock to display custom HTML on the self checkout page. To test: - Set up self checkout (see section Self Checkout in Circulaton sysprefs ) - Apply patch - Update db - Add some HTML system preference SCOMainUserBlock - Go to sco page - Verify that HTML displays on page (logged in and not logged in) Signed-off-by: Josef Moravec <josef.moravec@gmail.com> --- .../data/mysql/atomicupdate/bug_17381_SCOMainUserBlock.perl | 9 +++++++++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/circulation.pref | 5 +++++ koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 3 ++- opac/sco/sco-main.pl | 1 + 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_17381_SCOMainUserBlock.perl diff --git a/installer/data/mysql/atomicupdate/bug_17381_SCOMainUserBlock.perl b/installer/data/mysql/atomicupdate/bug_17381_SCOMainUserBlock.perl new file mode 100644 index 0000000..94a5d61 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_17381_SCOMainUserBlock.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + + $dbh->do("INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type` ) VALUES ('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea')" ); + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 17381 - Add system preference SCOMainUserBlock)\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 0bd8cac..71bd735 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -462,6 +462,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('RoutingListAddReserves','1','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'), ('RoutingListNote','To change this note edit <a href=\"/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RoutingListNote#jumped\">RoutingListNote</a> system preference.','70|10','Define a note to be shown on all routing lists','Textarea'), ('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'), +('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'), ('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'), ('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'), ('SearchEngine','Zebra','Elasticsearch|Zebra','Search Engine','Choice'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 90b2844..5e6ae73 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -747,6 +747,11 @@ Circulation: type: textarea class: code - + - "Include the following HTML on the the web-based self checkout screen:" + - pref: SCOMainUserBlock + type: textarea + class: code + - - "Include the following CSS on all pages in the web-based self checkout:" - pref: SCOUserCSS type: textarea 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..f23871a 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 @@ -290,6 +290,7 @@ <h3>You currently have nothing checked out.</h3> [% END # / IF issues_count %] </div> <!-- / #borrowerdetails --> + </div> <!-- / #newcheckout --> [% ELSE # IF validuser %] <div class="sco_entry" > <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post"> @@ -320,7 +321,7 @@ </div> <!-- / .sco_entry --> [% END # / IF validuser %] [% END # / UNLESS ( hide_main %] - + [% IF ( SCOMainUserBlock ) %]<div id="scomainuserblock">[% SCOMainUserBlock %]</div>[% END %] </div> <!-- / .span12 --> </div> <!-- / .row-fluid --> </div> <!-- / .container-fluid --> diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 4153277..9ee4c1e 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -315,6 +315,7 @@ if ($borrower->{cardnumber}) { $template->param( SCOUserJS => C4::Context->preference('SCOUserJS'), SCOUserCSS => C4::Context->preference('SCOUserCSS'), + SCOMainUserBlock => C4::Context->preference('SCOMainUserBlock'), ); output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; -- 2.1.4