From 57adcce431d8fe9b1370c2228df570a99eec69f3 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Wed, 11 Feb 2026 07:59:18 -0500 Subject: [PATCH] Refactor JavaScript path handling for issue form updates to help prevent 422 errors on new issue creation --- lib/redmine_qbo/hooks/issues_hook_listener.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/redmine_qbo/hooks/issues_hook_listener.rb b/lib/redmine_qbo/hooks/issues_hook_listener.rb index 7fd4334..321bf0b 100644 --- a/lib/redmine_qbo/hooks/issues_hook_listener.rb +++ b/lib/redmine_qbo/hooks/issues_hook_listener.rb @@ -62,11 +62,14 @@ module RedmineQbo value: '#issue_customer' } + + js_path = "updateIssueFrom('/issues/new.js', this)" + js_path = "updateIssueFrom('#{escape_javascript update_issue_form_path(issue.project, issue)}', this)" unless issue.new_record? # This hidden field is used for the customer ID for the issue # the onchange event will reload the issue form via ajax to update the available estimates customer_id = f.hidden_field :customer_id, id: "issue_customer_id", - onchange: "updateIssueFrom('#{escape_javascript update_issue_form_path(issue.project, issue)}', this)".html_safe + onchange: js_path.html_safe # Generate the drop down list of quickbooks estimates owned by the selected customer select_estimate = f.select :estimate_id,