Bug 14298: DBRev 3.21.00.027

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomas Cohen Arazi 2015-09-25 11:20:13 -03:00
parent a888b372f9
commit e131df30a0
3 changed files with 29 additions and 28 deletions

View File

@ -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.21.00.026";
$VERSION = "3.21.00.027";
sub version {
return $VERSION;

View File

@ -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);

View File

@ -10868,6 +10868,34 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
$DBversion = "3.21.00.027";
if ( CheckVersion($DBversion) ) {
$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 (Bug 14298: AutoSelfCheckID user should only be able to access SCO)\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.