diff --git a/app/controllers/facility_accounts_reconciliation_controller.rb b/app/controllers/facility_accounts_reconciliation_controller.rb index 46c17c8df6..1b2ac26664 100644 --- a/app/controllers/facility_accounts_reconciliation_controller.rb +++ b/app/controllers/facility_accounts_reconciliation_controller.rb @@ -11,6 +11,7 @@ class FacilityAccountsReconciliationController < ApplicationController before_action :check_acting_as before_action :init_current_facility before_action :check_billing_access + before_action :check_billing_access_to_mark_as_unrecoverable before_action :set_billing_navigation def index @@ -81,4 +82,10 @@ def unreconciled_details OrderDetail.complete.statemented(current_facility) end + def check_billing_access_to_mark_as_unrecoverable + if params[:order_status] == "unrecoverable" && !(current_user.administrator? || current_user.global_billing_administrator?) + flash[:error] = t("controllers.facility_accounts_reconciliation.cannot_mark_as_unrecoverable") + redirect_to([account_route.to_sym, :facility_accounts]) + end + end end diff --git a/config/locales/en.controllers.yml b/config/locales/en.controllers.yml index 39a76d9496..87a370b0bf 100644 --- a/config/locales/en.controllers.yml +++ b/config/locales/en.controllers.yml @@ -36,6 +36,9 @@ en: success: "Payment source activated successfully" failure: "Cannot activate. %{errors}" + facility_accounts_reconciliation: + cannot_mark_as_unrecoverable: "You do not have permission to mark payments as unrecoverable. Please contact your Global Administrator for help." + facility_notifications: no_selection: No orders selected errors_html: We experienced the following errors. Please try again.
%{errors}