From 7afc07bfaae3b508a043ec426f161bbe0cd87f8d Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Thu, 7 Mar 2013 12:17:33 -0500 Subject: [PATCH] Bug 6898 - circulation librarians can't run overdues without reports permissions followup Better update database. Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart Signed-off-by: Chris Cormack --- installer/data/mysql/updatedatabase.pl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 1922828b67..0ae796c40c 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6225,7 +6225,19 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { $DBversion = "3.10.05.002"; if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { - $dbh->do("INSERT INTO permissions ( module_bit, code, description ) VALUES ( '1', 'overdues_report', 'Execute overdue items report' )"); + $dbh->do(q{ + INSERT INTO permissions ( module_bit, code, description ) + VALUES ( '1', 'overdues_report', 'Execute overdue items report' ) + }); + # add new permission for users with all report permissions and circulation remaining permission + my $sth = $dbh->prepare(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT user_permissions.borrowernumber, 1, 'overdues_report' + FROM user_permissions + LEFT JOIN borrowers USING(borrowernumber) + WHERE borrowers.flags & (1 << 16) + AND user_permissions.code = 'circulate_remaining_permissions' + }); print "Upgrade to $DBversion done ( Add circ permission overdues_report )\n"; SetVersion($DBversion); } -- 2.39.5