If sys pref ReservesControlBranch has null then update the table to insert a 
ItemHomeLibrary as value

To Test:
1) Go to mysql use koha database
2) select * from systempreferences where variable = 'ReservesControlBranch'; 
Check if value set to ItemHomeLibrary.
+-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+
| variable              | value           | options                       | 
explanation                                     | type   |
+-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+
| ReservesControlBranch | ItemHomeLibrary | ItemHomeLibrary|PatronLibrary | 
Branch checked for members reservations rights. | Choice |
+-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+
---
 installer/data/mysql/updatedatabase.pl |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/installer/data/mysql/updatedatabase.pl 
b/installer/data/mysql/updatedatabase.pl
index 2f66e79..4edbc5a 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -5219,6 +5219,16 @@ if ( C4::Context->preference("Version") < 
TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.09.00.XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    unless(C4::Context->preference('ReservesControlBranch')){
+        $dbh->do("INSERT INTO `systempreferences` 
(variable,value,options,explanation,type) VALUES 
('ReservesControlBranch','ItemHomeLibrary','ItemHomeLibrary|PatronLibrary','Branch
 checked for members reservations rights.','Choice')");
+    }
+    print "Upgrade to $DBversion done (Insert ReservesControlBranch 
systempreference into systempreferences table )\n";
+    SetVersion($DBversion);
+}
+
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
-- 
1.6.4.2

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to