From e25da1fa432ea43cede897b5b8c5adc485fa6da6 Mon Sep 17 00:00:00 2001 From: JaTara Barnes Date: Sun, 5 Jan 2014 00:33:31 -0600 Subject: [PATCH] Bug 11415: Add syspref to toggle SCO receipt printing This patch adds the SelfCheckReceiptPrompt to control whether receipts are automatically printed when a patron finishes a SCO session. This is on by default during new installations and upgrades. Signed-off-by: Mark Tompsett Signed-off-by: Kyle M Hall Signed-off-by: Galen Charlton (cherry picked from commit 9cc3b69a0cf1adfc7c50c25ef6d57c2e027e8950) Conflicts: installer/data/mysql/updatedatabase.pl --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../prog/en/modules/admin/preferences/circulation.pref | 7 +++++++ koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 4 ++++ koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt | 3 +++ 5 files changed, 22 insertions(+) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 6438483249..0ccdb33cfb 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -331,6 +331,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('SearchEngine','Zebra','Solr|Zebra','Search Engine','Choice'), ('SearchMyLibraryFirst','0',NULL,'If ON, OPAC searches return results limited by the user\'s library by default if they are logged in','YesNo'), ('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'), +('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'), ('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'), ('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'), ('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index e21e64513b..ef17721e3d 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7916,6 +7916,13 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.15.00.XXX"; +if (CheckVersion($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('SelfCheckReceiptPrompt', '1', 'NULL', 'If ON, print receipt dialog pops up when self checkout is finished.', 'YesNo');"); + print "Upgrade to $DBversion done (Bug 11415: add system preference for self checkout receipt print)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) 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 2c5469b388..33ae4c9162 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 @@ -592,6 +592,13 @@ Circulation: - and this password - pref: AutoSelfCheckPass - . + - + - pref: SelfCheckReceiptPrompt + choices: + yes: Show + no: "Don't show" + - "the print receipt popup dialog when self checkout is finished" + Course Reserves: - - pref: UseCourseReserves 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 b1c2f1137a..b98ba611be 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 @@ -1,3 +1,4 @@ +[% USE Koha %] [% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] › Self checkout @@ -356,8 +357,11 @@ $("#logout_form").submit(function(){ clearTimeout(mainTimeout); + [% IF Koha.Preference('SelfCheckReceiptPrompt') %] if(confirm("Would you like to print a receipt?")){ window.open("/cgi-bin/koha/sco/printslip.pl?borrowernumber=[% borrowernumber %]&print=qslip"); + [% END %] + } return true; }); diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt index 6ab8b11d31..2fbdefb682 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] › Self checkout @@ -90,8 +91,10 @@ $(document).ready(function() { })); $("#logout_form").submit(function(){ clearTimeout(mainTimeout); + [% IF Koha.Preference('SelfCheckReceiptPrompt') %] if(confirm("Would you like to print a receipt?")){ window.open("/cgi-bin/koha/sco/printslip.pl?borrowernumber=[% borrowernumber %]&print=qslip"); + [%END %] } return true; }); -- 2.20.1