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

(-)a/circ/add_message.pl (+5 lines)
Lines 63-68 else { Link Here
63
    }
63
    }
64
64
65
    if ( $message_type eq 'E' ) {
65
    if ( $message_type eq 'E' ) {
66
        my $logged_in_patron = Koha::Patrons->find( $loggedinuser );
67
        if ( !$logged_in_patron->has_permission({ borrowers => 'send_messages_to_borrowers' }) ) {
68
            C4::Output::output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
69
        }
70
66
        my $letter = {
71
        my $letter = {
67
            title   => $borrower_subject,
72
            title   => $borrower_subject,
68
            content => $borrower_message
73
            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 45-50 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
45
   ( 3, 'manage_identity_providers', 'Manage identity providers'),
45
   ( 3, 'manage_identity_providers', 'Manage identity providers'),
46
   ( 4, 'delete_borrowers', 'Delete patrons'),
46
   ( 4, 'delete_borrowers', 'Delete patrons'),
47
   ( 4, 'edit_borrowers', 'Add, modify and view patron information'),
47
   ( 4, 'edit_borrowers', 'Add, modify and view patron information'),
48
   ( 4, 'send_messages_to_borrowers', 'Send messages to patrons'),
48
   ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'),
49
   ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'),
49
   ( 6, 'place_holds', 'Place holds for patrons'),
50
   ( 6, 'place_holds', 'Place holds for patrons'),
50
   ( 6, 'modify_holds_priority', 'Modify holds priority'),
51
   ( 6, 'modify_holds_priority', 'Modify holds priority'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (-1 / +3 lines)
Lines 130-136 Link Here
130
                        <select name="message_type" id="message_type">
130
                        <select name="message_type" id="message_type">
131
                            <option value="L">Staff - Internal note</option>
131
                            <option value="L">Staff - Internal note</option>
132
                            <option value="B">OPAC - [% patron.firstname | html %] [% patron.surname | html %]</option>
132
                            <option value="B">OPAC - [% patron.firstname | html %] [% patron.surname | html %]</option>
133
                            <option value="E">Email - email addresses of patron</option>
133
                            [% IF CAN_user_borrowers_send_messages_to_borrowers %]
134
                                <option value="E">Email - email addresses of patron</option>
135
                            [% END %]
134
                        </select>
136
                        </select>
135
                    </div>
137
                    </div>
136
                    [% bor_notes = AuthorisedValues.Get( 'BOR_NOTES' ) %]
138
                    [% bor_notes = AuthorisedValues.Get( 'BOR_NOTES' ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc (-1 / +5 lines)
Lines 317-322 Link Here
317
            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.
317
            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.
318
        </span>
318
        </span>
319
        <span class="permissioncode">([% name | html %])</span>
319
        <span class="permissioncode">([% name | html %])</span>
320
    [%- CASE 'send_messages_to_borrowers' -%]
321
        <span class="sub_permission send_messages_to_borrowers_subpermission">
322
            Send messages to patrons
323
        </span>
324
        <span class="permissioncode">([% name | html %])</span>
320
    [%- CASE 'modify_holds_priority' -%]
325
    [%- CASE 'modify_holds_priority' -%]
321
        <span class="sub_permission modify_holds_priority_subpermission">
326
        <span class="sub_permission modify_holds_priority_subpermission">
322
            Modify holds priority
327
            Modify holds priority
323
- 

Return to bug 29393