From a1a5a88148f46d9d800b094193aa345978d1ed64 Mon Sep 17 00:00:00 2001 From: Brendan Date: Thu, 21 Mar 2013 04:18:50 -0700 Subject: [PATCH] [PASSED QA] Bug 9448 - Add separate permission for writing off fees Adds new sub-permissions to updatecharges, 'writeoff' for writing off fees and 'remaining_permissions' for all other fee related activites. Test plan: 1) Apply patch 2) Run updatedatabase.pl 3) Remove the 'writeoff' permission from your privileges 4) Attempt to write off a fee, you should not be able to 5) Re-add the 'writeoff' permission 6) Attempt to write off a fee, you should now be able to do so Signed-off-by: Joel Sasse Signed-off-by: Katrin Fischer Comments on second patch. --- installer/data/mysql/de-DE/mandatory/userpermissions.sql | 2 ++ installer/data/mysql/en/mandatory/userpermissions.sql | 2 ++ installer/data/mysql/es-ES/mandatory/userpermissions.sql | 2 ++ installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql | 2 ++ installer/data/mysql/it-IT/necessari/userpermissions.sql | 2 ++ installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql | 2 ++ installer/data/mysql/pl-PL/mandatory/userpermissions.sql | 2 ++ .../data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql | 2 ++ .../data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 8 ++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt | 4 ++-- members/boraccount.pl | 2 +- members/mancredit.pl | 2 +- members/maninvoice.pl | 2 +- members/pay.pl | 3 ++- members/paycollect.pl | 3 ++- members/printfeercpt.pl | 2 +- members/printinvoice.pl | 2 +- 18 files changed, 37 insertions(+), 9 deletions(-) diff --git a/installer/data/mysql/de-DE/mandatory/userpermissions.sql b/installer/data/mysql/de-DE/mandatory/userpermissions.sql index 9c754ee..1f1e6ad 100644 --- a/installer/data/mysql/de-DE/mandatory/userpermissions.sql +++ b/installer/data/mysql/de-DE/mandatory/userpermissions.sql @@ -11,6 +11,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Katalogdaten bearbeiten (Titel- und Exemplardaten ändern)'), ( 9, 'fast_cataloging', 'Schnellaufnahmen anlegen'), ( 9, 'edit_items', 'Exemplare bearbeiten'), + (10, 'writeoff', 'Write off charges'), + (10, 'remaining_permissions', 'Remaining updatecharges permissions'), (11, 'vendors_manage', 'Lieferanten verwalten'), (11, 'contracts_manage', 'Vereinbarungen verwalten'), (11, 'period_manage', 'Etats verwalten'), diff --git a/installer/data/mysql/en/mandatory/userpermissions.sql b/installer/data/mysql/en/mandatory/userpermissions.sql index eb1275c..642f3be 100644 --- a/installer/data/mysql/en/mandatory/userpermissions.sql +++ b/installer/data/mysql/en/mandatory/userpermissions.sql @@ -11,6 +11,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), ( 9, 'fast_cataloging', 'Fast cataloging'), ( 9, 'edit_items', 'Edit Items'), + (10, 'writeoff', 'Write off charges'), + (10, 'remaining_permissions', 'Remaining updatecharges permissions'), (11, 'vendors_manage', 'Manage vendors'), (11, 'contracts_manage', 'Manage contracts'), (11, 'period_manage', 'Manage periods'), diff --git a/installer/data/mysql/es-ES/mandatory/userpermissions.sql b/installer/data/mysql/es-ES/mandatory/userpermissions.sql index 2f42224..fa22c18 100644 --- a/installer/data/mysql/es-ES/mandatory/userpermissions.sql +++ b/installer/data/mysql/es-ES/mandatory/userpermissions.sql @@ -11,6 +11,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), ( 9, 'fast_cataloging', 'Fast cataloging'), ( 9, 'edit_items', 'Edit Items'), + (10, 'writeoff', 'Write off charges'), + (10, 'remaining_permissions', 'Remaining updatecharges permissions'), (11, 'vendors_manage', 'Manage vendors'), (11, 'contracts_manage', 'Manage contracts'), (11, 'period_manage', 'Manage periods'), diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql index 702db68..8966895 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql @@ -11,6 +11,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Ajouter et modifier des notices au catalogue'), ( 9, 'fast_cataloging', 'Catalogage rapide'), ( 9, 'edit_items', 'Modifier des exemplaires'), + (10, 'writeoff', 'Write off charges'), + (10, 'remaining_permissions', 'Remaining updatecharges permissions'), (13, 'edit_news', 'Ecrire des nouvelles pour l''OPAC et l''interface professionnelle'), (13, 'label_creator', 'Créer des étiquettes à partir des données du catalogues et des adhérents'), (13, 'edit_calendar', 'Définir les jours de fermeture de la bibliothèque'), diff --git a/installer/data/mysql/it-IT/necessari/userpermissions.sql b/installer/data/mysql/it-IT/necessari/userpermissions.sql index 0d27fc0..ec121e0 100644 --- a/installer/data/mysql/it-IT/necessari/userpermissions.sql +++ b/installer/data/mysql/it-IT/necessari/userpermissions.sql @@ -13,6 +13,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Cataloga (crea/modifica dati bibliografici e di copia)'), ( 9, 'fast_cataloging', 'Catalogazione veloce'), ( 9, 'edit_items', 'Crea/modifica copie'), + (10, 'writeoff', 'Write off charges'), + (10, 'remaining_permissions', 'Remaining updatecharges permissions'), (11, 'vendors_manage', 'Crea/modifica fornitori'), (11, 'contracts_manage', 'Crea/modifica contratti'), (11, 'period_manage', 'Gestisci scadenze budgets'), diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql index c581bbd..88f91c7 100644 --- a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql +++ b/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql @@ -31,6 +31,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Endre katalogen (Endre bibliografiske poster og eksemplaropplysninger)'), ( 9, 'fast_cataloging', 'Hurtigkatalogisering'), ( 9, 'edit_items', 'Endre eksmeplarer'), + (10, 'writeoff', 'Write off charges'), + (10, 'remaining_permissions', 'Remaining updatecharges permissions'), (11, 'vendors_manage', 'Administrere leverandører'), (11, 'contracts_manage', 'Administrere kontrakter'), (11, 'period_manage', 'Administrere perioder'), diff --git a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql b/installer/data/mysql/pl-PL/mandatory/userpermissions.sql index dcd8aef..4ae6b6f 100644 --- a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql +++ b/installer/data/mysql/pl-PL/mandatory/userpermissions.sql @@ -11,6 +11,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Edit catalogue'), ( 9, 'fast_cataloging', 'Szybkie katalogowanie'), ( 9, 'edit_items', 'Edit Items'), + (10, 'writeoff', 'Write off charges'), + (10, 'remaining_permissions', 'Remaining updatecharges permissions'), (11, 'vendors_manage', 'Zarządzanei dostawcami'), (11, 'contracts_manage', 'Zarządzanie kontraktami'), (11, 'period_manage', 'Manage periods'), 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 acf904d..0c18a35 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 @@ -37,6 +37,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), ( 9, 'fast_cataloging', 'Fast cataloging'), ( 9, 'edit_items', 'Edit Items'), + (10, 'writeoff', 'Write off charges'), + (10, 'remaining_permissions', 'Remaining updatecharges permissions'), (11, 'vendors_manage', 'Manage vendors'), (11, 'contracts_manage', 'Manage contracts'), (11, 'period_manage', 'Manage periods'), 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 adee3ff..de7b934 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 @@ -37,6 +37,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), ( 9, 'fast_cataloging', 'Fast cataloging'), ( 9, 'edit_items', 'Edit Items'), + (10, 'writeoff', 'Write off charges'), + (10, 'remaining_permissions', 'Remaining updatecharges permissions'), (11, 'vendors_manage', 'Manage vendors'), (11, 'contracts_manage', 'Manage contracts'), (11, 'period_manage', 'Manage periods'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 4de4f4e..e67e60a 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8129,6 +8129,14 @@ if(CheckVersion($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.15.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ('10', 'writeoff', 'Write off charges')"); + $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ('10', 'remaining_permissions', 'Remaining updatecharges permissions')"); + print "Upgrade to $DBversion done (Bug 9448 - Add separate permission for writing off fees)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt index e584588..2b012d3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt @@ -100,7 +100,7 @@ function enableCheckboxActions(){ [% IF ( line.amountoutstanding > 0 ) %] - + [% IF CAN_user_updatecharges_writeoff %][% END %] [% END %] @@ -148,7 +148,7 @@ function enableCheckboxActions(){
- +[% IF CAN_user_updatecharges_writeoff %][% END %] Cancel
diff --git a/members/boraccount.pl b/members/boraccount.pl index 255b1ff..314f558 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -42,7 +42,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {borrowers => 1, updatecharges => 1}, + flagsrequired => {borrowers => 1, updatecharges => 'remaining_permissions'}, debug => 1, }); diff --git a/members/mancredit.pl b/members/mancredit.pl index a2c2258..0ba52f3 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -65,7 +65,7 @@ if ($add){ query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => $flagsrequired, + flagsrequired => { borrowers => 1, updatecharges => 'remaining_permissions' }, debug => 1, }); diff --git a/members/maninvoice.pl b/members/maninvoice.pl index c4a9294..4bf294a 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -83,7 +83,7 @@ if ($add){ query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {borrowers => 1, updatecharges => 1}, + flagsrequired => {borrowers => 1, updatecharges => 'remaining_permissions'}, debug => 1, }); diff --git a/members/pay.pl b/members/pay.pl index 8a8e902..3e36073 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -44,12 +44,13 @@ use C4::Members::Attributes qw(GetBorrowerAttributes); our $input = CGI->new; +my $updatecharges_permissions = $input->param('woall') ? 'writeoff' : 'remaining_permissions'; our ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => 'members/pay.tmpl', query => $input, type => 'intranet', authnotrequired => 0, - flagsrequired => { borrowers => 1, updatecharges => 1 }, + flagsrequired => { borrowers => 1, updatecharges => $updatecharges_permissions }, debug => 1, } ); diff --git a/members/paycollect.pl b/members/paycollect.pl index 96ca0fb..2e88efc 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -31,12 +31,13 @@ use C4::Branch; my $input = CGI->new(); +my $updatecharges_permissions = $input->param('writeoff_individual') ? 'writeoff' : 'remaining_permissions'; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => 'members/paycollect.tmpl', query => $input, type => 'intranet', authnotrequired => 0, - flagsrequired => { borrowers => 1, updatecharges => 1 }, + flagsrequired => { borrowers => 1, updatecharges => $updatecharges_permissions }, debug => 1, } ); diff --git a/members/printfeercpt.pl b/members/printfeercpt.pl index 6a86bc3..048f938 100755 --- a/members/printfeercpt.pl +++ b/members/printfeercpt.pl @@ -41,7 +41,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {borrowers => 1, updatecharges => 1}, + flagsrequired => {borrowers => 1, updatecharges => 'remaining_permissions'}, debug => 1, }); diff --git a/members/printinvoice.pl b/members/printinvoice.pl index 10ae114..5ad43f1 100755 --- a/members/printinvoice.pl +++ b/members/printinvoice.pl @@ -38,7 +38,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { borrowers => 1, updatecharges => 1 }, + flagsrequired => { borrowers => 1, updatecharges => 'remaining_permissions' }, debug => 1, } ); -- 1.8.3.2