Bug 4461: Adding user flags for managing OPAC problem reports
authorAleisha Amohia <aleishaamohia@hotmail.com>
Tue, 10 Mar 2020 22:27:56 +0000 (22:27 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 6 Apr 2020 10:18:13 +0000 (11:18 +0100)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

C4/Auth.pm
C4/InstallAuth.pm
installer/data/mysql/atomicupdate/bug-4461_manage_problem_reports_userflags.perl [new file with mode: 0644]
installer/data/mysql/userflags.sql
installer/data/mysql/userpermissions.sql
koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc

index dc83ac4..067c576 100644 (file)
@@ -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} } ) {
index b73794a..987045d 100644 (file)
@@ -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 (file)
index 0000000..0d12b98
--- /dev/null
@@ -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";
+}
index ecadc0d..40ec125 100644 (file)
@@ -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)
 ;
index a0a4958..a79e48c 100644 (file)
@@ -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')
 ;
index 280054d..1179537 100644 (file)
@@ -72,6 +72,9 @@
     [%- CASE 'cash_management' -%]
         <span class="main_permission cash_management_permission">Cash management</span>
         <span class="permissioncode">([% name | html %])</span>
+    [%- CASE 'problem_reports' -%]
+        <span class="main_permission problem_reports_permission">OPAC problem reports management</span>
+        <span class="permissioncode">([% name | html %])</span>
     [%- END -%]
 [%- END -%]
 
             Perform anonymous refund actions
         </span>
         <span class="permissioncode">([% name | html %])</span>
+  [%# problem_reports %]
+    [%- CASE 'manage_problem_reports' -%]
+        <span class="sub_permission manage_problem_reports_subpermission">
+            Manage OPAC problem reports
+        </span>
+        <span class="permissioncode">([% name | html %])</span>
   [%- END -%]
 [%- END -%]