diff --git a/app/controllers/qbo_controller.rb b/app/controllers/qbo_controller.rb index dd46e08..f692e0e 100644 --- a/app/controllers/qbo_controller.rb +++ b/app/controllers/qbo_controller.rb @@ -34,15 +34,13 @@ class QboController < ApplicationController def bill issue = Issue.find_by(id: params[:id]) raise I18n.t(:notice_error_issue_not_found) unless issue - raise I18n.t(:label_billing_error_no_customer) unless issue.customer - raise I18n.t(:label_billing_error_no_employee) unless issue.assigned_to&.employee_id.present? - raise I18n.t(:label_billing_error_no_qbo) unless Qbo.exists? + raise I18n.t(:notice_billing_error_no_customer) unless issue.customer + raise I18n.t(:notice_billing_error_no_employee) unless issue.assigned_to&.employee_id.present? + raise I18n.t(:notice_billing_error_no_qbo) unless Qbo.exists? BillIssueTimeJob.perform_later(issue.id) - redirect_to issue, flash: { - notice: "#{I18n.t(:label_billing_enqueued)} #{issue.customer.name}" - } + redirect_to issue, flash: { notice: "#{I18n.t(:label_billing_enqueued)} #{issue.customer.name}"} rescue StandardError => e redirect_to issue || root_path, flash: { error: e.message } diff --git a/config/locales/en.yml b/config/locales/en.yml index 96e808d..9b372c9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -27,10 +27,6 @@ en: label_balance_with_jobs: "Balance With Jobs" label_bill_time: "Bill Time" label_billing_address: "Billing Address" - label_billing_error: "Customer could not be billed. Check for Customer or Assignee and try again." - label_billing_error_no_customer: "Cannot bill without an assigned customer." - label_billing_error_no_employee: "Cannot bill without an assigned employee." - label_billing_error_no_qbo: "Cannot bill without a QuickBooks connection. Please connect to QuickBooks and try again." label_billing_enqueued: "Billing has been enqueued for issue" label_billed_success: "Successfully billed " label_client_id: "Intuit QBO OAuth2 Client ID" @@ -91,6 +87,9 @@ en: label_webhook_token: "Intuit QBO Webhook Token" label_week: "Week" label_year: "Year" + notice_billing_error_no_customer: "Cannot bill without an assigned customer." + notice_billing_error_no_employee: "Cannot bill without an assigned employee." + notice_billing_error_no_qbo: "Cannot bill without a QuickBooks connection. Please connect to QuickBooks and try again." notice_customer_created: "Customer created in QuickBooks" notice_customer_deleted: "Customer deleted in QuickBooks" notice_customer_not_deleted: "Customer could not be deleted in QuickBooks"