Bugzilla – Attachment 195240 Details for
Bug 42083
Email and SMS messages from patron record should have distinct permissions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 42083: atomicupdate for permissions
Bug-42083-atomicupdate-for-permissions.patch (text/plain), 2.71 KB, created by
Andrew Fuerste-Henry
on 2026-03-12 23:07:47 UTC
(
hide
)
Description:
Bug 42083: atomicupdate for permissions
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2026-03-12 23:07:47 UTC
Size:
2.71 KB
patch
obsolete
>From aad2639ad22f3e62d02ecb6c5e82d4218e6beb04 Mon Sep 17 00:00:00 2001 >From: Andrew Fuerste Henry <andrew@bywatersolutions.com> >Date: Thu, 12 Mar 2026 21:54:09 +0000 >Subject: [PATCH] Bug 42083: atomicupdate for permissions > >--- > .../Bug_42083_add_send_sms_permission.pl | 44 +++++++++++++++++++ > 1 file changed, 44 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/Bug_42083_add_send_sms_permission.pl > >diff --git a/installer/data/mysql/atomicupdate/Bug_42083_add_send_sms_permission.pl b/installer/data/mysql/atomicupdate/Bug_42083_add_send_sms_permission.pl >new file mode 100644 >index 00000000000..c3aff2aba2d >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/Bug_42083_add_send_sms_permission.pl >@@ -0,0 +1,44 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "42083", >+ description => "Split send_messages_to_borrowers into email and sms permissions", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{INSERT IGNORE permissions (module_bit, code, description) VALUES (4, 'send_messages_to_borrowers_email', 'Send messages to patrons via email')} >+ ); >+ say_success( $out, "Added new permission 'send_messages_to_borrowers_email'" ); >+ >+ $dbh->do( >+ q{INSERT IGNORE permissions (module_bit, code, description) VALUES (4, 'send_messages_to_borrowers_sms', 'Send messages to patrons via sms')} >+ ); >+ say_success( $out, "Added new permission 'send_messages_to_borrowers_sms'" ); >+ >+ my $insert_sth = >+ $dbh->prepare("INSERT IGNORE INTO user_permissions (borrowernumber, module_bit, code) VALUES (?, ?, ?)"); >+ >+ my $sth = >+ $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'send_messages_to_borrowers'"); >+ $sth->execute(); >+ >+ my @borrowernumbers; >+ while ( my ($borrowernumber) = $sth->fetchrow_array() ) { >+ push @borrowernumbers, $borrowernumber; >+ >+ my @rows_to_insert = ( map { [ $_, 4, "send_messages_to_borrowers_email" ] } @borrowernumbers ); >+ foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); } >+ } >+ >+ say_success( $out, "send_messages_to_borrowers_email added to all borrowers with send_messages_to_borrowers" ); >+ >+ $dbh->do(q{DELETE FROM permissions WHERE code='send_messages_to_borrowers'}); >+ say_success( $out, "Removed permission 'send_messages_to_borrowers'" ); >+ >+ $dbh->do(q{DELETE FROM user_permissions WHERE code='send_messages_to_borrowers'}); >+ say_success( $out, "Removed user_permission 'send_messages_to_borrowers'" ); >+ }, >+}; >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 42083
:
195239
| 195240 |
195241
|
195242