Bug 5396: New system preference UseTablesortForCirc
authorOwen Leonard <oleonard@myacpl.org>
Fri, 12 Nov 2010 20:54:50 +0000 (15:54 -0500)
committerChris Cormack <chrisc@catalyst.net.nz>
Sat, 13 Nov 2010 06:53:12 +0000 (19:53 +1300)
This system preference allows the librarian to toggle on or off whether the JQuery tablesort is used on the
circ/circulation.pl page.  For patrons with many checkouts, this sort may cause very slow page loading (and
therefore slow circulation transaction time), depending on the browser and local machine used.  Staff can
still see a sortable list of current checkouts on the members/moremember.pl page.

My revision prevents the template from including *any* tablesorter code if the
preference is feature is turned off: both the circulation list and
the holds list will have no jQuery tablesorter.

Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
circ/circulation.pl
installer/data/mysql/en/mandatory/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
kohaversion.pl

index 539b88c..7c4a0dc 100755 (executable)
@@ -109,6 +109,10 @@ if (C4::Context->preference("DisplayClearScreenButton")) {
     $template->param(DisplayClearScreenButton => 1);
 }
 
+if (C4::Context->preference("UseTablesortForCirc")) {
+    $template->param(UseTablesortForCirc => 1);
+}
+
 my $barcode        = $query->param('barcode') || '';
 $barcode =~  s/^\s*|\s*$//g; # remove leading/trailing whitespace
 
index caf1155..214d198 100644 (file)
@@ -270,6 +270,7 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('A
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoSelfCheckID','','Staff ID with circulation rights to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','','free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoSelfCheckPass','','Password to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','','free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('soundon','0','Enable circulation sounds during checkin and checkout in the staff interface.  Not supported by all web browsers yet.','','YesNo');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('UseTablesortForCirc','0','If on, use the JQuery tablesort function on the list of current borrower checkouts on the circulation page.  Note that the use of this function may slow down circ for patrons with may checkouts.','','YesNo');
 INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'PrintNoticesMaxLines', '0', '', 'If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.', 'Integer' );
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI','0','Enables ILS-DI services at OPAC.','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI:AuthorizedIPs','','.','Restricts usage of ILS-DI to some IPs','Free');
index 27daa38..62e4cd0 100755 (executable)
@@ -3735,6 +3735,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+<<<<<<< HEAD:installer/data/mysql/updatedatabase.pl
 $DBversion = '3.01.00.999';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     print "Upgrade to $DBversion done (3.2.0 release candidate)\n";
@@ -3835,6 +3836,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.03.00.003';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('UseTablesortForCirc','0','If on, use the JQuery tablesort function on the list of current borrower checkouts on the circulation page. Note that the use of this function may slow down circ for patrons with may checkouts.','','YesNo');");
+    print "Upgrade to $DBversion done (Add UseTablesortForCirc syspref)\n";
+    SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 DropAllForeignKeys($table)
index 16b52ff..c4d4305 100644 (file)
@@ -31,6 +31,12 @@ Circulation:
                   desc: latest to earliest
             - due date.
         -
+            - pref: UseTablesortForCirc
+              choices:
+                  yes: "Enable"
+                  no: "Don't enable"
+            - "the sorting of current patron checkouts on the circulation screen. <br/>NOTE: Enabling this function may slow down circulation time for patrons with many checkouts."
+        -
             - pref: soundon
               choices: 
                  yes: "Enable"
index 0b4ac29..822de15 100644 (file)
@@ -5,20 +5,20 @@
 (<!-- TMPL_VAR NAME="cardnumber" -->)
 <!-- /TMPL_IF --></title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
+<!-- TMPL_IF NAME="UseTablesortForCirc" --><script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script><!-- /TMPL_IF -->
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
 <script type="text/javascript">
 //<![CDATA[
-$.tablesorter.addParser({
+<!-- TMPL_IF NAME="UseTablesortForCirc" -->$.tablesorter.addParser({
     id: 'articles',
     is: function(s) {return false;  },
     format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
     type: 'text'
-});
+});<!-- /TMPL_IF -->
 <!-- TMPL_UNLESS NAME="borrowernumber" --><!-- TMPL_UNLESS NAME="CGIselectborrower" -->window.onload=function(){ $('#findborrower').focus(); };<!-- /TMPL_UNLESS --><!-- /TMPL_UNLESS -->
         $(document).ready(function() {
                $('#patronlists > ul').tabs();
-               $.tablesorter.defaults.widgets = ['zebra'];
+               <!-- TMPL_IF NAME="UseTablesortForCirc" -->$.tablesorter.defaults.widgets = ['zebra'];
                $("#issuest").tablesorter({<!-- TMPL_IF NAME="dateformat_metric" -->
                dateFormat: 'uk',<!-- /TMPL_IF -->
                headers: { 1: { sorter: 'articles' },5: { sorter: false },6:{sorter:false},7:{sorter:false},8:{sorter:false}}
@@ -30,8 +30,7 @@ $.tablesorter.addParser({
                dateFormat: 'uk',<!-- /TMPL_IF -->
                        sortList: [[0,0]],
                        headers: { 1: { sorter: 'articles' }}
-               });
-
+               });<!-- /TMPL_IF -->
         <!-- TMPL_IF NAME="AllowRenewalLimitOverride" -->
         $( '#override_limit' ).click( function () {
             if ( this.checked ) {
index 1c409f3..86d63f9 100644 (file)
@@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.03.00.002';
+    our $VERSION = '3.03.00.003';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install