From 2f02d4b74c6f9784dad1d7db25327b1b8a7bb3f9 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 19 Oct 2015 15:19:28 -0300 Subject: [PATCH] Bug 11759: (QA followup) Sysprefs should be kosher The introduced syspref was defined before we added new guidelines for them. This patch puts them in sync with current standards. It also splits them into: - A big on/off switch (BatchCheckouts) - Patron category filter (BatchCheckoutsValidCategories) The latter is expected to go away if we move this into a boolean column on the 'categories' table, which seems a better approach. I'm filling a new bug for this last comment. Signed-off-by: Tomas Cohen Arazi --- circ/circulation.pl | 4 ++-- installer/data/mysql/sysprefs.sql | 3 ++- installer/data/mysql/updatedatabase.pl | 8 ++++++-- koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc | 3 ++- .../prog/en/modules/admin/preferences/circulation.pref | 12 +++++++++--- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index ed470ec..828ed89 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -114,9 +114,9 @@ my $borrowernumber = $query->param('borrowernumber'); my $borrower = $borrowernumber ? GetMember( borrowernumber => $borrowernumber ) : undef; my $batch = $query->param('batch'); my $batch_allowed = 0; -if ( $batch ) { +if ( $batch && C4::Context->preference('BatchCheckouts') ) { $template_name = q|circ/circulation_batch_checkouts.tt|; - my @batch_category_codes = split '\|', C4::Context->preference('batch_checkouts'); + my @batch_category_codes = split '\|', C4::Context->preference('BatchCheckoutsValidCategories'); if ( grep {/^$borrower->{categorycode}$/} @batch_category_codes ) { $batch_allowed = 1; } else { diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 9e7b98b..578ab79 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -63,7 +63,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('BakerTaylorPassword','','','Baker & Taylor Password for Content Cafe (external content)','Free'), ('BakerTaylorUsername','','','Baker & Taylor Username for Content Cafe (external content)','Free'), ('BasketConfirmations','1','always ask for confirmation.|do not ask for confirmation.','When closing or reopening a basket,','Choice'), -('batch_checkouts','',NULL,'Allow patron categories allowed to checkout in a batch','Free'), +('BatchCheckouts','0','','Enable or disable batch checkouts','YesNo'), +('BatchCheckoutsValidCategories','',NULL,'Patron categories allowed to checkout in a batch','Free'), ('BiblioAddsAuthorities','0',NULL,'If ON, adding a new biblio will check for an existing authority record and create one on the fly if one doesn\'t exist','YesNo'), ('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'), ('BibtexExportAdditionalFields', '', NULL , 'Define additional BibTex tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.', 'textarea'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 152df42..c53b47f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -11121,10 +11121,14 @@ if ( CheckVersion($DBversion) ) { } $DBversion = "3.21.00.XXX"; -if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { +if ( CheckVersion($DBversion) ) { + $dbh->do(q| + INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) + VALUES ('BatchCheckouts','0','','Enable or disable batch checkouts','YesNo') + |); $dbh->do(q| INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) - VALUES ('batch_checkouts','','','Allow patron categories allowed to checkout in a batch','Free') + VALUES ('BatchCheckoutsValidCategories','',NULL,'Patron categories allowed to checkout in a batch','Free') |); print "Upgrade to $DBversion done (Bug 11759: Add batch_checkouts system preference)\n"; SetVersion($DBversion); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 12c1e98..8c058f1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -64,7 +64,8 @@