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

(-)a/admin/smart-rules.pl (+7 lines)
Lines 34-39 use Koha::RefundLostItemFeeRules; Link Here
34
use Koha::Libraries;
34
use Koha::Libraries;
35
use Koha::Patron::Categories;
35
use Koha::Patron::Categories;
36
use Koha::Caches;
36
use Koha::Caches;
37
use Koha::Patrons;
37
38
38
my $input = CGI->new;
39
my $input = CGI->new;
39
my $dbh = C4::Context->dbh;
40
my $dbh = C4::Context->dbh;
Lines 60-65 unless ( $branch ) { Link Here
60
        $branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*';
61
        $branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*';
61
    }
62
    }
62
}
63
}
64
65
my $uid = Koha::Patrons->find( $loggedinuser )->userid;
66
my $restricted_to_own_library = $uid && haspermission( $uid, { parameters => 'manage_circ_rules_restricted' }, { no_inherit => 1 } );
67
$template->param( restricted_to_own_library => $restricted_to_own_library );
68
$branch = C4::Context::mybranch() if $restricted_to_own_library;
69
63
$branch = '*' if $branch eq 'NO_LIBRARY_SET';
70
$branch = '*' if $branch eq 'NO_LIBRARY_SET';
64
71
65
my $op = $input->param('op') || q{};
72
my $op = $input->param('op') || q{};
(-)a/installer/data/mysql/atomicupdate/bug_15520-add_manage_circ_rules_restricted.sql (+1 lines)
Line 0 Link Here
1
INSERT IGNORE INTO `permissions` (module_bit, code, description) VALUES(3, 'manage_circ_rules_restricted', 'Only manage circ rules for own library');
(-)a/installer/data/mysql/userpermissions.sql (+1 lines)
Lines 7-12 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
7
   ( 1, 'manage_checkout_notes', 'Mark checkout notes as seen/not seen'),
7
   ( 1, 'manage_checkout_notes', 'Mark checkout notes as seen/not seen'),
8
   ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'),
8
   ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'),
9
   ( 3, 'manage_circ_rules', 'Manage circulation rules'),
9
   ( 3, 'manage_circ_rules', 'Manage circulation rules'),
10
   ( 3, 'manage_circ_rules_restricted', 'Only manage circ rules for own library'),
10
   ( 4, 'edit_borrowers', 'Add, modify and view patron information'),
11
   ( 4, 'edit_borrowers', 'Add, modify and view patron information'),
11
   ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'),
12
   ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'),
12
   ( 6, 'place_holds', 'Place holds for patrons'),
13
   ( 6, 'place_holds', 'Place holds for patrons'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc (+1 lines)
Lines 33-38 Link Here
33
    [%- CASE 'override_renewals' -%]<span>Override blocked renewals</span>
33
    [%- CASE 'override_renewals' -%]<span>Override blocked renewals</span>
34
    [%- CASE 'manage_checkout_notes' %]<span>Mark checkout notes as seen/not seen</span>
34
    [%- CASE 'manage_checkout_notes' %]<span>Mark checkout notes as seen/not seen</span>
35
    [%- CASE 'manage_circ_rules' -%]<span>manage circulation rules</span>
35
    [%- CASE 'manage_circ_rules' -%]<span>manage circulation rules</span>
36
    [%- CASE 'manage_circ_rules_restricted' -%]<span>Limit circulation rules editing to the user's own library (please note that manage_circ_rules is still required)</span>
36
    [%- CASE 'parameters_remaining_permissions' -%]<span>Remaining system parameters permissions</span>
37
    [%- CASE 'parameters_remaining_permissions' -%]<span>Remaining system parameters permissions</span>
37
    [%- CASE 'edit_borrowers' -%]<span>Add, modify and view patron information</span>
38
    [%- CASE 'edit_borrowers' -%]<span>Add, modify and view patron information</span>
38
    [%- CASE 'view_borrower_infos_from_any_libraries' -%]<span>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.</span>
39
    [%- CASE 'view_borrower_infos_from_any_libraries' -%]<span>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.</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-15 / +16 lines)
Lines 40-61 Link Here
40
        <p>To modify a rule, create a new one with the same patron category and item type.</p>
40
        <p>To modify a rule, create a new one with the same patron category and item type.</p>
41
    </div>
41
    </div>
42
    <div>
42
    <div>
43
        <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
43
        [% UNLESS restricted_to_own_library %]
44
        Select a library :
44
            <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
45
            <select name="branch" id="branch" style="width:20em;">
45
            Select a library :
46
                <option value="*">Standard rules for all libraries</option>
46
                <select name="branch" id="branch" style="width:20em;">
47
                [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
47
                    <option value="*">Standard rules for all libraries</option>
48
            </select>
48
                    [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
49
        </form>
50
        [% IF ( definedbranch ) %]
51
            <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
52
                <label for="tobranch"><strong>Clone these rules to:</strong></label>
53
                <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
54
                <select name="tobranch" id="tobranch">
55
                    [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
56
                </select>
49
                </select>
57
                <input type="submit" id="clone_rules" value="Clone" />
58
            </form>
50
            </form>
51
            [% IF ( definedbranch ) %]
52
                <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
53
                    <label for="tobranch"><strong>Clone these rules to:</strong></label>
54
                    <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
55
                    <select name="tobranch" id="tobranch">
56
                        [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
57
                    </select>
58
                    <input type="submit" id="clone_rules" value="Clone" />
59
                </form>
60
            [% END %]
59
        [% END %]
61
        [% END %]
60
62
61
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
63
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
62
- 

Return to bug 15520