If value is not exist it insert other wise update the
existing value.
To Test:
1) Go to mysql use koha database
2) select * from systempreferences where variable = 'ReservesControlBranch';
3) Show old result if value is present other wise it shows
+-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+
| variable | value | options |
explanation | type |
+-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+
| ReservesControlBranch | ItemHomeLibrary | ItemHomeLibrary|PatronLibrary |
Branch checked for members reservations rights. | Choice |
+-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+
---
installer/data/mysql/updatedatabase.pl | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/installer/data/mysql/updatedatabase.pl
b/installer/data/mysql/updatedatabase.pl
index 84f0437..839613e 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -5212,6 +5212,18 @@ if ( C4::Context->preference("Version") <
TransformToNum($DBversion) ) {
SetVersion($DBversion);
}
+$DBversion = "3.08.00.XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ if (C4::Context->preference('ReservesControlBranch')){
+ my $sth = $dbh->prepare("UPDATE systempreferences SET value = ? WHERE
variable = 'ReservesControlBranch'");
+ $sth->execute(C4::Context->preference('ReservesControlBranch'));
+ }else{
+ $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/Update 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/