use Koha::CirculationRules;
use Koha::Patron::Categories;
use Koha::Caches;
+use Koha::Patrons;
my $input = CGI->new;
my $dbh = C4::Context->dbh;
$branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*';
}
}
+
+my $uid = Koha::Patrons->find( $loggedinuser )->userid;
+my $restricted_to_own_library = $uid && haspermission( $uid, { parameters => 'manage_circ_rules_restricted' }, { no_inherit => 1 } );
+$template->param( restricted_to_own_library => $restricted_to_own_library );
+$branch = C4::Context::mybranch() if $restricted_to_own_library;
+
$branch = '*' if $branch eq 'NO_LIBRARY_SET';
my $op = $input->param('op') || q{};
--- /dev/null
+INSERT IGNORE INTO `permissions` (module_bit, code, description) VALUES(3, 'manage_circ_rules_restricted', 'Only manage circ rules for own library');
( 1, 'manage_checkout_notes', 'Mark checkout notes as seen/not seen'),
( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'),
( 3, 'manage_circ_rules', 'Manage circulation rules'),
+ ( 3, 'manage_circ_rules_restricted', 'Only manage circ rules for own library'),
( 4, 'edit_borrowers', 'Add, modify and view patron information'),
( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'),
( 6, 'place_holds', 'Place holds for patrons'),
[%- CASE 'override_renewals' -%]<span>Override blocked renewals</span>
[%- CASE 'manage_checkout_notes' %]<span>Mark checkout notes as seen/not seen</span>
[%- CASE 'manage_circ_rules' -%]<span>manage circulation rules</span>
+ [%- 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>
[%- CASE 'parameters_remaining_permissions' -%]<span>Remaining system parameters permissions</span>
[%- CASE 'edit_borrowers' -%]<span>Add, modify and view patron information</span>
[%- 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>
<p>To modify a rule, create a new one with the same patron category and item type.</p>
</div>
<div>
- <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
- Select a library :
- <select name="branch" id="branch" style="width:20em;">
- <option value="*">Standard rules for all libraries</option>
- [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
- </select>
- </form>
- [% IF ( definedbranch ) %]
- <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
- <label for="tobranch"><strong>Clone these rules to:</strong></label>
- <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
- <select name="tobranch" id="tobranch">
- [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
+ [% UNLESS restricted_to_own_library %]
+ <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
+ Select a library :
+ <select name="branch" id="branch" style="width:20em;">
+ <option value="*">Standard rules for all libraries</option>
+ [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
</select>
- <input type="submit" id="clone_rules" value="Clone" />
</form>
+ [% IF ( definedbranch ) %]
+ <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
+ <label for="tobranch"><strong>Clone these rules to:</strong></label>
+ <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
+ <select name="tobranch" id="tobranch">
+ [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
+ </select>
+ <input type="submit" id="clone_rules" value="Clone" />
+ </form>
+ [% END %]
[% END %]
<form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">