From 2985aa988339ebe75bff5b328be60047faa01ce1 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Tue, 1 Oct 2019 16:03:58 +0100 Subject: [PATCH] Bug 23681: Add modify_patron_restrictions permission This patch adds a new "modify_patron_restrictions" permission Sponsored-by: Loughborough University Signed-off-by: Benjamin Veasey Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../bug_23681_add_debarment_types.perl | 16 ++++++++-------- ...3681_add_manage_patron_restrictions_perm.perl | 9 +++++++++ .../data/mysql/mandatory/userpermissions.sql | 1 + .../prog/en/includes/permissions.inc | 5 +++++ .../prog/en/modules/admin/admin-home.tt | 4 ++++ 5 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.perl diff --git a/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl b/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl index 4fc862c954..0050b230eb 100644 --- a/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl +++ b/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl @@ -18,15 +18,15 @@ if ( CheckVersion( $DBversion ) ) { ('SUSPENSION', 'Suspension', 1, 0), ('DISCHARGE', 'Discharge', 1, 0); |); + $dbh->do( q| + ALTER TABLE borrower_debarments + MODIFY COLUMN type varchar(50) NOT NULL + | ); + $dbh->do( q| + ALTER TABLE borrower_debarments + ADD CONSTRAINT borrower_debarments_ibfk_2 FOREIGN KEY (type) REFERENCES debarment_types(code) ON DELETE NO ACTION ON UPDATE CASCADE; + | ); } - $dbh->do( q| - ALTER TABLE borrower_debarments - MODIFY COLUMN type varchar(50) NOT NULL - | ); - $dbh->do( q| - ALTER TABLE borrower_debarments - ADD CONSTRAINT borrower_debarments_ibfk_2 FOREIGN KEY (type) REFERENCES debarment_types(code) ON DELETE NO ACTION ON UPDATE CASCADE; - | ); SetVersion( $DBversion ); print "Upgrade to $DBversion done (Bug 23681 - Add debarment_types)\n"; diff --git a/installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.perl b/installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.perl new file mode 100644 index 0000000000..283791ba8a --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO permissions (module_bit, code, description) VALUES + ( 3, 'manage_patron_restrictions', 'Manage patron restrictions') + }); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 23681 - Add manage_patron_restrictions_permission)\n"; +} diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql index 612d17233f..a291f6dc6b 100644 --- a/installer/data/mysql/mandatory/userpermissions.sql +++ b/installer/data/mysql/mandatory/userpermissions.sql @@ -20,6 +20,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 3, 'manage_item_circ_alerts', 'Manage item circulation alerts'), ( 3, 'manage_cash_registers', 'Add and remove cash registers'), ( 3, 'manage_cities', 'Manage cities and towns'), + ( 3, 'manage_patron_restrictions', 'Manage patron restrictions'), ( 3, 'manage_marc_frameworks', 'Manage MARC bibliographic and authority frameworks'), ( 3, 'manage_classifications', 'Manage classification sources'), ( 3, 'manage_matching_rules', 'Manage record matching rules'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index bb635165d1..dc1c309bba 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -163,6 +163,11 @@ Manage patron categories ([% name | html %]) + [%- CASE 'manage_patron_restrictions' -%] + + Manage patron restrictions + + ([% name | html %]) [%- CASE 'manage_patron_attributes' -%] Manage extended patron attributes diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index 0a77a06495..076dc0729c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -123,6 +123,10 @@
Curbside pickup
Configure curbside pickup for libraries
[% END %] + [% IF ( CAN_user_parameters_manage_patron_restrictions ) %] +
Patron restrictions
+
Define patron restrictions.
+ [% END %] [% END %] -- 2.39.5