From a0c44ab17cb0cfa7e997dace7c5505e849557070 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 10 Feb 2012 10:43:29 -0500 Subject: [PATCH] Bug 6898 - circulation librarians can't run overdues without reports permissions This patch adds a new user permission overdues_report for the circulation module, and requires this permission to run the overdue items report, rather than requiring full reports permissions. Test plan : With a user with permissions circulate_remaining_permissions : - Add overdues_report permission to user - Go to circulation home => you see "Overdues" link - Clik on it => you are allowed to access and use this page - Remove overdues_report permission to user - Go to circulation home => you do not see "Overdues" link - Edit URL : /cgi-bin/koha/circ/overdue.pl => you are not allowed to access this page - Go to main page => you don't have access to reports module Signed-off-by: Kyle M Hall Signed-off-by: Fridolyn SOMERS Signed-off-by: Jonathan Druart Signed-off-by: Jared Camins-Esakov --- circ/overdue.pl | 2 +- installer/data/mysql/de-DE/mandatory/userpermissions.sql | 1 + installer/data/mysql/en/mandatory/userpermissions.sql | 1 + installer/data/mysql/es-ES/mandatory/userpermissions.sql | 1 + .../data/mysql/fr-FR/1-Obligatoire/userpermissions.sql | 1 + installer/data/mysql/it-IT/necessari/userpermissions.sql | 1 + .../data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql | 1 + installer/data/mysql/pl-PL/mandatory/userpermissions.sql | 1 + .../mysql/ru-RU/mandatory/permissions_and_user_flags.sql | 1 + .../mysql/uk-UA/mandatory/permissions_and_user_flags.sql | 1 + installer/data/mysql/updatedatabase.pl | 6 ++++++ .../intranet-tmpl/prog/en/modules/circ/circulation-home.tt | 2 +- 12 files changed, 17 insertions(+), 2 deletions(-) diff --git a/circ/overdue.pl b/circ/overdue.pl index cef345cbff..8fed8c8605 100755 --- a/circ/overdue.pl +++ b/circ/overdue.pl @@ -60,7 +60,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { reports => 1, circulate => "circulate_remaining_permissions" }, + flagsrequired => { circulate => "overdues_report" }, debug => 1, } ); diff --git a/installer/data/mysql/de-DE/mandatory/userpermissions.sql b/installer/data/mysql/de-DE/mandatory/userpermissions.sql index ec5a22af07..f203a8d3f0 100644 --- a/installer/data/mysql/de-DE/mandatory/userpermissions.sql +++ b/installer/data/mysql/de-DE/mandatory/userpermissions.sql @@ -1,6 +1,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Übrige Ausleihberechtigungen'), ( 1, 'override_renewals', 'Gesperrte Verlängerungen überschreiben'), + ( 1, 'overdues_report', 'Execute overdue items report'), ( 3, 'parameters_remaining_permissions', 'Übrige Administrationsberechtigungen'), ( 3, 'manage_circ_rules', 'Ausleihkonditionen verwalten'), ( 6, 'place_holds', 'Vormerkungen für Benutzer setzen'), diff --git a/installer/data/mysql/en/mandatory/userpermissions.sql b/installer/data/mysql/en/mandatory/userpermissions.sql index 070e8f595e..8577ef231e 100644 --- a/installer/data/mysql/en/mandatory/userpermissions.sql +++ b/installer/data/mysql/en/mandatory/userpermissions.sql @@ -1,6 +1,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), ( 1, 'override_renewals', 'Override blocked renewals'), + ( 1, 'overdues_report', 'Execute overdue items report'), ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), diff --git a/installer/data/mysql/es-ES/mandatory/userpermissions.sql b/installer/data/mysql/es-ES/mandatory/userpermissions.sql index 070e8f595e..8577ef231e 100644 --- a/installer/data/mysql/es-ES/mandatory/userpermissions.sql +++ b/installer/data/mysql/es-ES/mandatory/userpermissions.sql @@ -1,6 +1,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), ( 1, 'override_renewals', 'Override blocked renewals'), + ( 1, 'overdues_report', 'Execute overdue items report'), ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql index 3147bed115..3c57a81e60 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql @@ -1,6 +1,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Fonctions de circulation restantes'), ( 1, 'override_renewals', 'Outrepasser les limites de renouvellement'), + ( 1, 'overdues_report', 'Executer le rapport de retards'), ( 3, 'parameters_remaining_permissions', 'Paramètres du système restants'), ( 3, 'manage_circ_rules', 'Gestion des règles de circulation'), ( 6, 'place_holds', 'Réserver pour des adhérents'), diff --git a/installer/data/mysql/it-IT/necessari/userpermissions.sql b/installer/data/mysql/it-IT/necessari/userpermissions.sql index cf5424e5ff..31e6e18c29 100644 --- a/installer/data/mysql/it-IT/necessari/userpermissions.sql +++ b/installer/data/mysql/it-IT/necessari/userpermissions.sql @@ -3,6 +3,7 @@ SET FOREIGN_KEY_CHECKS=0; INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Permessi rimanenti per la circolazione'), ( 1, 'override_renewals', 'Sblocca i rinnovi bloccati'), + ( 1, 'overdues_report', 'Execute overdue items report'), ( 3, 'parameters_remaining_permissions', 'Permessi rimanenti'), ( 3, 'manage_circ_rules', 'Gestisci regole circolazione'), ( 6, 'place_holds', 'Fai prenotazioni per gli utenti'), diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql index 36c03f374b..79778656de 100644 --- a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql +++ b/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql @@ -21,6 +21,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Øvrige rettigheter for sirkulasjon'), ( 1, 'override_renewals', 'Overstyre blokkerte fornyinger'), + ( 1, 'overdues_report', 'Execute overdue items report'), ( 3, 'parameters_remaining_permissions', 'Øvrige rettigheter knyttet til systempreferanser'), ( 3, 'manage_circ_rules', 'Endre sirkulasjonsregler'), ( 6, 'place_holds', 'Foreta reservering for lånere'), diff --git a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql b/installer/data/mysql/pl-PL/mandatory/userpermissions.sql index 1165af141f..02b25517b2 100644 --- a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql +++ b/installer/data/mysql/pl-PL/mandatory/userpermissions.sql @@ -1,6 +1,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), ( 1, 'override_renewals', 'Override blocked renewals'), + ( 1, 'overdues_report', 'Execute overdue items report'), ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), diff --git a/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql b/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql index 00d6538045..868c3c03d2 100644 --- a/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql +++ b/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql @@ -25,6 +25,7 @@ TRUNCATE permissions; INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), ( 1, 'override_renewals', 'Override blocked renewals'), + ( 1, 'overdues_report', 'Execute overdue items report'), ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), diff --git a/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql b/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql index 188a146643..8d0126b399 100644 --- a/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql +++ b/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql @@ -25,6 +25,7 @@ TRUNCATE permissions; INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), ( 1, 'override_renewals', 'Override blocked renewals'), + ( 1, 'overdues_report', 'Execute overdue items report'), ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 82654d8285..90019ff39b 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6486,6 +6486,12 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.11.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("INSERT INTO permissions ( module_bit, code, description ) VALUES ( '1', 'overdues_report', 'Execute overdue items report' )"); + print "Upgrade to $DBversion done ( Add circ permission overdues_report )\n"; + SetVersion($DBversion); +} =head1 FUNCTIONS diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt index 631158fb1c..cb0662a2de 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt @@ -40,7 +40,7 @@
  • Holds awaiting pickup
  • Hold ratios
  • Transfers to receive
  • - [% IF ( CAN_user_reports_execute_reports ) %]
  • Overdues + [% IF ( CAN_user_circulate_overdues_report ) %]
  • Overdues - Warning: This report is very resource intensive on systems with large numbers of overdue items.
  • [% END %]
  • Overdues with fines - Limited to your library. See report help for other details.
  • -- 2.39.5