From c95ae98d6085495e055d6d6775fb8e0acc1e1cc5 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 10 Mar 2020 22:27:56 +0000 Subject: [PATCH] Bug 4461: Adding user flags for managing OPAC problem reports Signed-off-by: Martin Renvoize Signed-off-by: David Nind Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- C4/Auth.pm | 3 ++- C4/InstallAuth.pm | 1 + .../bug-4461_manage_problem_reports_userflags.perl | 9 +++++++++ installer/data/mysql/userflags.sql | 3 ++- installer/data/mysql/userpermissions.sql | 3 ++- koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc | 9 +++++++++ 6 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug-4461_manage_problem_reports_userflags.perl diff --git a/C4/Auth.pm b/C4/Auth.pm index dc83ac4ea0..067c576950 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -298,7 +298,7 @@ sub get_template_and_user { my $all_perms = get_all_subpermissions(); my @flagroots = qw(circulate catalogue parameters borrowers permissions reserveforothers borrow - editcatalogue updatecharges tools editauthorities serials reports acquisition clubs); + editcatalogue updatecharges tools editauthorities serials reports acquisition clubs problem_reports); # We are going to use the $flags returned by checkauth # to create the template's parameters that will indicate @@ -323,6 +323,7 @@ sub get_template_and_user { $template->param( CAN_user_clubs => 1 ); $template->param( CAN_user_ill => 1 ); $template->param( CAN_user_stockrotation => 1 ); + $template->param( CAN_user_problem_reports => 1 ); foreach my $module ( keys %$all_perms ) { foreach my $subperm ( keys %{ $all_perms->{$module} } ) { diff --git a/C4/InstallAuth.pm b/C4/InstallAuth.pm index b73794ae99..987045df50 100644 --- a/C4/InstallAuth.pm +++ b/C4/InstallAuth.pm @@ -147,6 +147,7 @@ sub get_template_and_user { $template->param( CAN_user_editauthorities => 1 ); $template->param( CAN_user_serials => 1 ); $template->param( CAN_user_reports => 1 ); + $template->param( CAN_user_problem_reports => 1 ); } my $minPasswordLength = C4::Context->preference('minPasswordLength'); diff --git a/installer/data/mysql/atomicupdate/bug-4461_manage_problem_reports_userflags.perl b/installer/data/mysql/atomicupdate/bug-4461_manage_problem_reports_userflags.perl new file mode 100644 index 0000000000..0d12b9888d --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-4461_manage_problem_reports_userflags.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{INSERT IGNORE INTO userflags (bit, flag, flagdesc, defaulton) VALUES (26, 'problem_reports', 'Manage problem reports', 0) }); + $dbh->do(q{INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (26, 'manage_problem_reports', 'Manage OPAC problem reports') }); + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 4461 - Add user permissions for managing OPAC problem reports)\n"; +} diff --git a/installer/data/mysql/userflags.sql b/installer/data/mysql/userflags.sql index ecadc0d450..40ec125eea 100644 --- a/installer/data/mysql/userflags.sql +++ b/installer/data/mysql/userflags.sql @@ -22,5 +22,6 @@ INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (22,'ill','The Interlibrary Loans Module',0), (23,'self_check','Self check modules',0), (24, 'stockrotation', 'Manage stockrotation operations', 0), -(25, 'cash_management', 'Cash management', 0) +(25, 'cash_management', 'Cash management', 0), +(26, 'problem_reports', 'Manage problem reports', 0) ; diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql index a0a4958494..a79e48c6ff 100644 --- a/installer/data/mysql/userpermissions.sql +++ b/installer/data/mysql/userpermissions.sql @@ -125,5 +125,6 @@ INSERT INTO permissions (module_bit, code, description) VALUES (24, 'manage_rota_items', 'Add and remove items from rotas'), (25, 'anonymous_refund', 'Perform refund actions from cash registers'), (25, 'cashup', 'Perform cash register cashup action'), - (25, 'takepayment', 'Access the point of sale page and take payments') + (25, 'takepayment', 'Access the point of sale page and take payments'), + (26, 'manage_problem_reports', 'Manage OPAC problem reports') ; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index 280054ddf5..1179537930 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -72,6 +72,9 @@ [%- CASE 'cash_management' -%] Cash management ([% name | html %]) + [%- CASE 'problem_reports' -%] + OPAC problem reports management + ([% name | html %]) [%- END -%] [%- END -%] @@ -719,5 +722,11 @@ Perform anonymous refund actions ([% name | html %]) + [%# problem_reports %] + [%- CASE 'manage_problem_reports' -%] + + Manage OPAC problem reports + + ([% name | html %]) [%- END -%] [%- END -%] -- 2.39.5