View | Details | Raw Unified | Return to bug 29393
Collapse All | Expand All

(-)a/circ/add_message.pl (+5 lines)
Lines 57-62 if ( $message_type eq 'L' or $message_type eq 'B' ) { Link Here
57
}
57
}
58
58
59
if ( $message_type eq 'E' ) {
59
if ( $message_type eq 'E' ) {
60
    my $logged_in_patron = Koha::Patrons->find( $loggedinuser );
61
    if ( !$logged_in_patron->has_permission({ borrowers => 'send_messages_to_borrowers' }) ) {
62
        C4::Output::output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
63
    }
64
60
    my $letter = {
65
    my $letter = {
61
        title   => $borrower_subject,
66
        title   => $borrower_subject,
62
        content => $borrower_message
67
        content => $borrower_message
(-)a/installer/data/mysql/atomicupdate/Bug_29393_add_send_message_permission.pl (+14 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "29393",
5
    description => "Add permission borrowers:send_messages_to_borrowers",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        $dbh->do(q{INSERT INTO permissions (module_bit, code, description)
11
            VALUES (4, 'send_messages_to_borrowers', 'Send messages to patrons')});
12
        say $out "Update is going well so far";
13
    },
14
}
(-)a/installer/data/mysql/mandatory/userpermissions.sql (+1 lines)
Lines 44-49 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
44
   ( 3, 'manage_identity_providers', 'Manage authentication providers'),
44
   ( 3, 'manage_identity_providers', 'Manage authentication providers'),
45
   ( 4, 'delete_borrowers', 'Delete patrons'),
45
   ( 4, 'delete_borrowers', 'Delete patrons'),
46
   ( 4, 'edit_borrowers', 'Add, modify and view patron information'),
46
   ( 4, 'edit_borrowers', 'Add, modify and view patron information'),
47
   ( 4, 'send_messages_to_borrowers', 'Send messages to patrons'),
47
   ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'),
48
   ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'),
48
   ( 6, 'place_holds', 'Place holds for patrons'),
49
   ( 6, 'place_holds', 'Place holds for patrons'),
49
   ( 6, 'modify_holds_priority', 'Modify holds priority'),
50
   ( 6, 'modify_holds_priority', 'Modify holds priority'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (-1 / +3 lines)
Lines 122-128 Link Here
122
                        <select name="message_type" id="message_type">
122
                        <select name="message_type" id="message_type">
123
                            <option value="L">Staff - Internal note</option>
123
                            <option value="L">Staff - Internal note</option>
124
                            <option value="B">OPAC - [% patron.firstname | html %] [% patron.surname | html %]</option>
124
                            <option value="B">OPAC - [% patron.firstname | html %] [% patron.surname | html %]</option>
125
                            <option value="E">Email - email addresses of patron</option>
125
                            [% IF CAN_user_borrowers_send_messages_to_borrowers %]
126
                                <option value="E">Email - email addresses of patron</option>
127
                            [% END %]
126
                        </select>
128
                        </select>
127
                    </div>
129
                    </div>
128
                    [% bor_notes = AuthorisedValues.Get( 'BOR_NOTES' ) %]
130
                    [% bor_notes = AuthorisedValues.Get( 'BOR_NOTES' ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc (-1 / +5 lines)
Lines 309-314 Link Here
309
            View patron infos from any libraries. If not set the logged in user could only access patron infos from its own library or group of libraries.
309
            View patron infos from any libraries. If not set the logged in user could only access patron infos from its own library or group of libraries.
310
        </span>
310
        </span>
311
        <span class="permissioncode">([% name | html %])</span>
311
        <span class="permissioncode">([% name | html %])</span>
312
    [%- CASE 'send_messages_to_borrowers' -%]
313
        <span class="sub_permission send_messages_to_borrowers_subpermission">
314
            Send messages to patrons
315
        </span>
316
        <span class="permissioncode">([% name | html %])</span>
312
    [%- CASE 'modify_holds_priority' -%]
317
    [%- CASE 'modify_holds_priority' -%]
313
        <span class="sub_permission modify_holds_priority_subpermission">
318
        <span class="sub_permission modify_holds_priority_subpermission">
314
            Modify holds priority
319
            Modify holds priority
315
- 

Return to bug 29393