mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Prevent billing if issue has no customer assigned
This commit is contained in:
@@ -66,8 +66,12 @@ class QboController < ApplicationController
|
||||
# Manual Billing
|
||||
def bill
|
||||
i = Issue.find_by_id params[:id]
|
||||
i.bill_time
|
||||
redirect_to i, :flash => { :notice => "Successfully Billed #{i.customer.name}" }
|
||||
if i.customer
|
||||
i.bill_time
|
||||
redirect_to i, :flash => { :notice => "Successfully Billed #{i.customer.name}" }
|
||||
else
|
||||
redirect_to i, :flash => { :error => "Cannot bill without a customer assigned" }
|
||||
end
|
||||
end
|
||||
|
||||
# Quickbooks Webhook Callback
|
||||
|
||||
Reference in New Issue
Block a user