Check if spent hours is > 0 before billing

This commit is contained in:
2016-01-09 08:56:32 -05:00
parent def2bf068e
commit deb3b7cac5

View File

@@ -43,7 +43,7 @@ class IssuesSaveHookListener < Redmine::Hook::ViewListener
# If the issue is closed, then create a new billable time activty for the customer
# TODO Add configuration settings for employee_id, hourly_rate, item_id
if issue.status.is_closed? and not issue.qbo_customer_id.nil? and not issue.qbo_item_id.nil? and not employee_id.nil? then
if issue.status.is_closed? and not issue.qbo_customer_id.nil? and not issue.qbo_item_id.nil? and not employee_id.nil? and spent_hours > 0 then
time_entry.description = "Ticket ##{issue.id}: #{issue.subject}"
time_entry.employee_id = employee_id
time_entry.customer_id = issue.qbo_customer_id