From 3f4e3569072d5e3683627ae6aaa8c7da4feb8e82 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 6 Jan 2016 10:41:42 +0000 Subject: [PATCH] Bug 4940: DB Changes Signed-off-by: Chris Cormack http://bugs.koha-community.org/show_bug.cgi?id=4941 Signed-off-by: Kyle M Hall --- .../atomicupdate/bug_4941-remove_singleBranchMode.perl | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_4941-remove_singleBranchMode.perl diff --git a/installer/data/mysql/atomicupdate/bug_4941-remove_singleBranchMode.perl b/installer/data/mysql/atomicupdate/bug_4941-remove_singleBranchMode.perl new file mode 100644 index 0000000..34ef9c6 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_4941-remove_singleBranchMode.perl @@ -0,0 +1,13 @@ +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"|); -- 2.1.4