From eaaea6ed27c549b64d813afbc3cb14ab3ebadd48 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 26 Feb 2016 12:28:55 +0000 Subject: [PATCH] Bug 4941 - DBRev 3.23.00.027 --- Koha.pm | 2 +- .../bug_4941-remove_singleBranchMode.perl | 13 ------------- installer/data/mysql/updatedatabase.pl | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 14 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_4941-remove_singleBranchMode.perl diff --git a/Koha.pm b/Koha.pm index c4c518b8eb..27d6dd0941 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "3.23.00.026"; +$VERSION = "3.23.00.027"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_4941-remove_singleBranchMode.perl b/installer/data/mysql/atomicupdate/bug_4941-remove_singleBranchMode.perl deleted file mode 100644 index 34ef9c670e..0000000000 --- a/installer/data/mysql/atomicupdate/bug_4941-remove_singleBranchMode.perl +++ /dev/null @@ -1,13 +0,0 @@ -use Modern::Perl; -use C4::Context; - -my $dbh = C4::Context->dbh; - -my ( $db_value ) = $dbh->selectrow_array(q|SELECT count(*) FROM branches|); -my $pref_value = C4::Context->preference("singleBranchMode") || 0; -if ( $db_value > 1 and $pref_value == 1 ) { - warn "WARNING: You have more than 1 libraries in your branches tables but the singleBranchMode system preference is on.\n"; - warn "This configuration does not make sense. The system preference is going to be deleted,\n"; - warn "and this parameter will be based on the number of libraries defined.\n"; -} -$dbh->do(q|DELETE FROM systempreferences WHERE variable="singleBranchMode"|); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 5c52dae136..722c5d3d3c 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -11830,6 +11830,21 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.23.00.027"; +if ( CheckVersion($DBversion) ) { + my ( $db_value ) = $dbh->selectrow_array(q|SELECT count(*) FROM branches|); + my $pref_value = C4::Context->preference("singleBranchMode") || 0; + if ( $db_value > 1 and $pref_value == 1 ) { + warn "WARNING: You have more than 1 libraries in your branches tables but the singleBranchMode system preference is on.\n"; + warn "This configuration does not make sense. The system preference is going to be deleted,\n"; + warn "and this parameter will be based on the number of libraries defined.\n"; + } + $dbh->do(q|DELETE FROM systempreferences WHERE variable="singleBranchMode"|); + + print "Upgrade to $DBversion done (Bug 4941 - Can't set branch in staff client when singleBranchMode is enabled)\n"; + SetVersion($DBversion); +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5