diff --git a/lib/reporting/reports/enterprise_fee_summary/base.rb b/lib/reporting/reports/enterprise_fee_summary/base.rb index 837c84df7d..ccbef3d323 100644 --- a/lib/reporting/reports/enterprise_fee_summary/base.rb +++ b/lib/reporting/reports/enterprise_fee_summary/base.rb @@ -8,7 +8,8 @@ module Reporting def initialize(user, params = {}, render: false) super(user, params, render: render) - p = params[:q] + # Clone hash before modifying it: + p = params[:q].clone if p.present? p['start_at'] = p.delete('completed_at_gt') p['end_at'] = p.delete('completed_at_lt') diff --git a/spec/lib/reports/enterprise_fee_summary/enterprise_fee_summary_report_spec.rb b/spec/lib/reports/enterprise_fee_summary/enterprise_fee_summary_report_spec.rb index 6ea086c7dd..f9ce422d39 100644 --- a/spec/lib/reports/enterprise_fee_summary/enterprise_fee_summary_report_spec.rb +++ b/spec/lib/reports/enterprise_fee_summary/enterprise_fee_summary_report_spec.rb @@ -99,6 +99,12 @@ describe Reporting::Reports::EnterpriseFeeSummary::Base do let!(:second_customer_order) { prepare_order(customer: customer) } let!(:other_customer_order) { prepare_order(customer: another_customer) } + it "doesn't delete params" do + params = ActionController::Parameters.new("completed_at_gt" => "2023-02-08+00:00") + described_class.new(current_user, params) + expect(params["completed_at_gt"]).to eq "2023-02-08+00:00" + end + it "groups and sorts entries correctly" do totals = subject.query_result