From 0727257d72bf58a2564542cb63b375340963a407 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Wed, 1 Jun 2016 12:01:51 -0400 Subject: [PATCH] Update issues_save_hook_listener.rb --- lib/issues_save_hook_listener.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/issues_save_hook_listener.rb b/lib/issues_save_hook_listener.rb index e5479c3..2f9f5a5 100644 --- a/lib/issues_save_hook_listener.rb +++ b/lib/issues_save_hook_listener.rb @@ -55,11 +55,14 @@ class IssuesSaveHookListener < Redmine::Hook::ViewListener # Called After Issue Saved def controller_issues_edit_after_save(context={}) issue = context[:issue] - employee_id = issue.assigned_to.qbo_employee_id + + if issue.assigned_to + employee_id = issue.assigned_to.qbo_employee_id - # Check to see if we have registered with QBO and if the issue is closed. - # If so then we need to create a new billable time activity for the customer - bill_time(issue, employee_id) if Qbo.first && issue.customer && issue.qbo_item && employee_id && issue.status.is_closed? + # Check to see if we have registered with QBO and if the issue is closed. + # If so then we need to create a new billable time activity for the customer + bill_time(issue, employee_id) if Qbo.first && issue.customer && issue.qbo_item && employee_id && issue.status.is_closed? + end end # Create billable time entries