From 0de40144ff38994c73344637e08f5c31f57a6da3 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@biblibre.com>
Date: Fri, 14 Feb 2014 11:25:54 +0100
Subject: [PATCH] Bug 11759: Batch checkout - DB changes

Add the new pref batch_checkouts in DB.
---
 installer/data/mysql/sysprefs.sql                            |    1 +
 installer/data/mysql/updatedatabase.pl                       |   10 ++++++++++
 .../prog/en/modules/admin/preferences/circulation.pref       |    6 ++++++
 3 files changed, 17 insertions(+)

diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 1668d37..6f05fa3 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -58,6 +58,7 @@ 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'),
 ('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'),
 ('BlockReturnOfWithdrawnItems','1','0','If enabled, items that are marked as withdrawn cannot be returned.','YesNo'),
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index f043d0b..afbad1c 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -7953,6 +7953,16 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.15.00.XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do(q|
+        INSERT INTO systempreferences ( variable, value, options, explanation, type ) VALUES
+        ('batch_checkouts','','','Allow patron categories allowed to checkout in a batch','Free')
+    |);
+    print "Upgrade to $DBversion done (MT13483: Add batch_checkouts system preference)\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 33ae4c9..ddf99e9 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
@@ -606,3 +606,9 @@ Circulation:
                   yes: Use
                   no: "Don't use"
             - course reserves
+    Batch checkout:
+        -
+            - "Allow some patron categories to checkout in a batch"
+            - pref: batch_checkouts
+            - "(list of patron category separated with a pipe '|')"
+
-- 
1.7.10.4