Bug 5795 Update the database as follow-up If sys pref
authorAmit Gupta <amit.gupta@osslabs.biz>
Tue, 22 May 2012 10:32:31 +0000 (16:02 +0530)
committerPaul Poulain <paul.poulain@biblibre.com>
Thu, 24 May 2012 16:06:01 +0000 (18:06 +0200)
ReservesControlBranch has null then update the table to
insert a PatronLibrary 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 | PatronLibrary   | ItemHomeLibrary|PatronLibrary | Branch checked for members reservations rights. | Choice |
+-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
installer/data/mysql/updatedatabase.pl

index ca5fb30..fcf904e 100755 (executable)
@@ -5284,6 +5284,15 @@ 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','PatronLibrary','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)