Bug 15520: Rename permission to manage_circ_rules_from_any_libraries
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 23 Jul 2018 22:11:59 +0000 (19:11 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 9 Oct 2018 15:02:51 +0000 (15:02 +0000)
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

admin/smart-rules.pl
installer/data/mysql/atomicupdate/bug_15520-add_manage_circ_rules_restricted.sql
installer/data/mysql/userpermissions.sql
koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc

index 74a0674..854dcde 100755 (executable)
@@ -63,10 +63,11 @@ unless ( $branch ) {
     }
 }
 
-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;
+my $logged_in_patron = Koha::Patrons->find( $loggedinuser );
+
+my $can_edit_from_any_library = $logged_in_patron->has_permission( {parameters => 'manage_circ_rules_from_any_libraries' } );
+$template->param( restricted_to_own_library => not $can_edit_from_any_library );
+$branch = C4::Context::mybranch() unless $can_edit_from_any_library;
 
 $branch = '*' if $branch eq 'NO_LIBRARY_SET';
 
index 830f4fb..c7e99ce 100644 (file)
@@ -1 +1 @@
-INSERT IGNORE INTO `permissions` (module_bit, code, description) VALUES(3, 'manage_circ_rules_restricted', 'Only manage circ rules for own library');
+INSERT IGNORE INTO `permissions` (module_bit, code, description) VALUES(3, 'manage_circ_rules_from_any_libraries', 'Manage circ rules for any libraries');
index 18fe3f8..ae45a57 100644 (file)
@@ -7,7 +7,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
    ( 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'),
+   ( 3, 'manage_circ_rules_restricted', 'Manage circ rules for any libraries'),
    ( 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'),
index baf966a..4127bff 100644 (file)
@@ -33,7 +33,7 @@
     [%- 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 'manage_circ_rules_from_any_libraries' -%]<span>Edit circulation rules from any libraries. If not set the logged in user could only edit circulation rules for its the 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>