From 04000eacbe1f42acec3be27357dbb8141f098aa3 Mon Sep 17 00:00:00 2001 From: Liz Rea Date: Wed, 23 Sep 2015 13:19:17 +1200 Subject: [PATCH] Bug 14298: Update database --- ...d_permissions_circulate_self_checkout.perl | 27 -------------- installer/data/mysql/updatedatabase.pl | 37 +++++++++++++++++++ kohaversion.pl | 2 +- 3 files changed, 38 insertions(+), 28 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_14298_add_permissions_circulate_self_checkout.perl diff --git a/installer/data/mysql/atomicupdate/bug_14298_add_permissions_circulate_self_checkout.perl b/installer/data/mysql/atomicupdate/bug_14298_add_permissions_circulate_self_checkout.perl deleted file mode 100644 index 9ec23a051b..0000000000 --- a/installer/data/mysql/atomicupdate/bug_14298_add_permissions_circulate_self_checkout.perl +++ /dev/null @@ -1,27 +0,0 @@ -use Modern::Perl; - -use C4::Context; -my $dbh = C4::Context->dbh; - -$dbh->do(q| - INSERT INTO permissions (module_bit, code, description) - VALUES (1, 'self_checkout', 'Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID') -|); - -my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID'); - -$dbh->do(q| - UPDATE borrowers - SET flags=0 - WHERE userid=? -|, undef, $AutoSelfCheckID); - -$dbh->do(q| - DELETE FROM user_permissions - WHERE borrowernumber=(SELECT borrowernumber FROM borrowers WHERE userid=?) -|, undef, $AutoSelfCheckID); - -$dbh->do(q| - INSERT INTO user_permissions(borrowernumber, module_bit, code) - SELECT borrowernumber, 1, 'self_checkout' FROM borrowers WHERE userid=? -|, undef, $AutoSelfCheckID); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 433d446625..aabb944d1e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9872,6 +9872,43 @@ if ( CheckVersion($DBversion) ) { print "Upgrade to $DBversion done"; SetVersion($DBversion); } +$DBversion = "3.18.10.002"; +if ( CheckVersion($DBversion) ) { + print "Bug 14298: AutoSelfCheckID user should only be able to access SCO\n"; + $dbh->do( + q| + INSERT INTO permissions (module_bit, code, description) + VALUES (1, 'self_checkout', 'Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID') + | + ); + + my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID'); + + $dbh->do( + q| + UPDATE borrowers + SET flags=0 + WHERE userid=? + |, undef, $AutoSelfCheckID + ); + + $dbh->do( + q| + DELETE FROM user_permissions + WHERE borrowernumber=(SELECT borrowernumber FROM borrowers WHERE userid=?) + |, undef, $AutoSelfCheckID + ); + + $dbh->do( + q| + INSERT INTO user_permissions(borrowernumber, module_bit, code) + SELECT borrowernumber, 1, 'self_checkout' FROM borrowers WHERE userid=? + |, undef, $AutoSelfCheckID + ); + print +"Upgrade to $DBversion done\n"; + SetVersion($DBversion); +} =head1 FUNCTIONS diff --git a/kohaversion.pl b/kohaversion.pl index 65bdba8c27..1eecf1229e 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -17,7 +17,7 @@ the kohaversion is divided in 4 parts : use strict; sub kohaversion { - our $VERSION = '3.18.10.001'; + our $VERSION = '3.18.10.002'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install -- 2.39.5