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

(-)a/admin/smart-rules.pl (+7 lines)
Lines 33-38 use Koha::RefundLostItemFeeRule; Link Here
33
use Koha::RefundLostItemFeeRules;
33
use Koha::RefundLostItemFeeRules;
34
use Koha::Libraries;
34
use Koha::Libraries;
35
use Koha::Patron::Categories;
35
use Koha::Patron::Categories;
36
use Koha::Patrons;
36
37
37
my $input = CGI->new;
38
my $input = CGI->new;
38
my $dbh = C4::Context->dbh;
39
my $dbh = C4::Context->dbh;
Lines 59-64 unless ( $branch ) { Link Here
59
        $branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*';
60
        $branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*';
60
    }
61
    }
61
}
62
}
63
64
my $uid = Koha::Patrons->find( $loggedinuser )->userid;
65
my $restricted_to_own_library = $uid && haspermission( $uid, { parameters => 'manage_circ_rules_restricted' }, { no_inherit => 1 } );
66
$template->param( restricted_to_own_library => $restricted_to_own_library );
67
$branch = C4::Context::mybranch() if $restricted_to_own_library;
68
62
$branch = '*' if $branch eq 'NO_LIBRARY_SET';
69
$branch = '*' if $branch eq 'NO_LIBRARY_SET';
63
70
64
my $op = $input->param('op') || q{};
71
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 39-60 Link Here
39
        <p>To modify a rule, create a new one with the same patron category and item type.</p>
39
        <p>To modify a rule, create a new one with the same patron category and item type.</p>
40
    </div>
40
    </div>
41
    <div>
41
    <div>
42
        <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
42
        [% UNLESS restricted_to_own_library %]
43
        Select a library :
43
            <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
44
            <select name="branch" id="branch" style="width:20em;">
44
            Select a library :
45
                <option value="*">Standard rules for all libraries</option>
45
                <select name="branch" id="branch" style="width:20em;">
46
                [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
46
                    <option value="*">Standard rules for all libraries</option>
47
            </select>
47
                    [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
48
        </form>
49
        [% IF ( definedbranch ) %]
50
            <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
51
                <label for="tobranch"><strong>Clone these rules to:</strong></label>
52
                <input type="hidden" name="frombranch" value="[% current_branch %]" />
53
                <select name="tobranch" id="tobranch">
54
                    [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
55
                </select>
48
                </select>
56
                <input type="submit" id="clone_rules" value="Clone" />
57
            </form>
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 %]" />
54
                    <select name="tobranch" id="tobranch">
55
                        [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
56
                    </select>
57
                    <input type="submit" id="clone_rules" value="Clone" />
58
                </form>
59
            [% END %]
58
        [% END %]
60
        [% END %]
59
61
60
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
62
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
61
- 

Return to bug 15520