From 97c63728d5811b203643bd3f53cba83645c2498a Mon Sep 17 00:00:00 2001 From: Eric Garcia Date: Wed, 17 Jul 2024 20:33:43 +0000 Subject: [PATCH] Bug 17473: Add void payment permission To test: 1. Apply patch, updatedatabase, restart_all 2. Search for staff patron 3. More -> Set permissions 4. Check - Staff access, allows viewing of catalogue in staff interface - Add, modify and view patron information - Manage patrons fines and fee 5. Notice under Manage patrons fines and fee there is a new permission "Voiding Payments" 6. Sign into staff interface as your selected staff patron 7. Search for a non-staff patron -> Accounting 8. Click 'Create manual invoice', add an amount and click 'Save and pay' -> 'Confirm' 9. Go to transactions and notice the option to Void payment appears 10. Go back to your staff patron's permission and unselect 'Voiding Payments' 11. Go to your non-staff patron and notice the option to void payments is gone --- .../atomicupdate/bug_17473_add_permission.pl | 21 +++++++++++++++++++ .../data/mysql/mandatory/userpermissions.sql | 1 + .../prog/en/includes/permissions.inc | 5 +++++ .../prog/en/modules/members/boraccount.tt | 10 +++++---- 4 files changed, 33 insertions(+), 4 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_17473_add_permission.pl diff --git a/installer/data/mysql/atomicupdate/bug_17473_add_permission.pl b/installer/data/mysql/atomicupdate/bug_17473_add_permission.pl new file mode 100755 index 0000000000..2b2993b3d0 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_17473_add_permission.pl @@ -0,0 +1,21 @@ +use Modern::Perl + +return { + bug_number => "17473", + description => "Add void_payment permission", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + $dbh->do(q{ + INSERT IGNORE permissions (module_bit, code, description) VALUES + (10, 'void_payment', 'Voiding Payments') + }); + + say $out "Added new permission 'void_payment'"; + + $dbh->do(q{ + INSERT IGNORE INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 10, 'void_payment' FROM user_permissions WHERE code = 'remaining_permissions' + }); + }, +}; diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql index 4b5c8ebe2c..b996f07e88 100644 --- a/installer/data/mysql/mandatory/userpermissions.sql +++ b/installer/data/mysql/mandatory/userpermissions.sql @@ -68,6 +68,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (10, 'refund', 'Perform account refund action'), (10, 'discount', 'Perform account discount action'), (10, 'writeoff', 'Write off fines and fees'), + (10, 'void_payment', 'Voiding Payments'), (10, 'manual_credit', 'Add manual credits to a patron account'), (10, 'manual_invoice', 'Add manual invoices to a patron account'), (10, 'remaining_permissions', 'Remaining permissions for managing fines and fees'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index b8f2c2b040..c16609d925 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -427,6 +427,11 @@ Write off fines and fees ([% name | html %]) + [%- CASE 'void_payment' -%] + + Voiding Payments + + ([% name | html %]) [%- CASE 'manual_invoice' -%] Add manual invoices to a patron account diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt index a051fc2732..4d4527c9b5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -181,10 +181,12 @@ - + [% IF CAN_user_updatecharges_void_payment %] + + [% END %] [% END %] [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %] -- 2.30.2