From 32d39920d78453086e9cad837c5d8194af5a6bf0 Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Wed, 4 Dec 2019 13:21:15 -0500
Subject: [PATCH] Bug 20256: (QA follow-up) Give existing users with edit_items
 permission edit_any_item as well

Signed-off-by: Bob Bennhoff - CLiC <bbennhoff@clicweb.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 installer/data/mysql/atomicupdate/bug_20256.perl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/installer/data/mysql/atomicupdate/bug_20256.perl b/installer/data/mysql/atomicupdate/bug_20256.perl
index 2080f540e7..28049442e7 100644
--- a/installer/data/mysql/atomicupdate/bug_20256.perl
+++ b/installer/data/mysql/atomicupdate/bug_20256.perl
@@ -2,6 +2,14 @@ $DBversion = 'XXX'; # will be replaced by the RM
 if( CheckVersion( $DBversion ) ) {
     $dbh->do( "INSERT IGNORE INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_any_item', 'Edit any item reguardless of home library');" );
 
+    $dbh->do(q{
+        INSERT INTO user_permissions ( borrowernumber, module_bit, code )
+        SELECT borrowernumber, '9', 'edit_any_item'
+        FROM user_permissions
+        WHERE module_bit = '9'
+          AND code = 'edit_items'
+    });
+
     if ( !column_exists( 'library_groups', 'ft_limit_item_editing' ) ) {
         $dbh->do( "ALTER TABLE library_groups ADD COLUMN ft_limit_item_editing tinyint(1) NOT NULL DEFAULT 0 AFTER ft_hide_patron_info" );
     }
-- 
2.20.1