mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-04-02 07:01:59 -04:00
updated logging with prefix
This commit is contained in:
@@ -17,13 +17,13 @@ module Vehicles
|
|||||||
|
|
||||||
# Called by Redmine QBO Invoice
|
# Called by Redmine QBO Invoice
|
||||||
def process_invoice_custom_fields(context={})
|
def process_invoice_custom_fields(context={})
|
||||||
Rails.logger.info "redmine_qbo_vehicles.process_invoice_custom_fields"
|
log "Processing invoice custom fields for invoice ##{context[:invoice].id}"
|
||||||
issue = context[:issue]
|
issue = context[:issue]
|
||||||
|
|
||||||
# update the invoive custom fields with infomation from the issue if available
|
# update the invoive custom fields with infomation from the issue if available
|
||||||
context[:invoice].custom_fields.each do |cf|
|
context[:invoice].custom_fields.each do |cf|
|
||||||
|
|
||||||
Rails.logger.info "Checking invoice.custom field: #{cf.name}"
|
log "Checking invoice custom field: #{cf.name}"
|
||||||
|
|
||||||
# VIN from the attached vehicle
|
# VIN from the attached vehicle
|
||||||
begin
|
begin
|
||||||
@@ -32,13 +32,13 @@ module Vehicles
|
|||||||
# TODO check cf_sync_confict flag once implemented
|
# TODO check cf_sync_confict flag once implemented
|
||||||
if cf.string_value.to_s.blank?
|
if cf.string_value.to_s.blank?
|
||||||
|
|
||||||
Rails.logger.info "VIN was blank, updating the invoice vin in quickbooks"
|
log "VIN was blank, updating the invoice vin in quickbooks"
|
||||||
vin = context[:issue].vehicle.vin
|
vin = context[:issue].vehicle.vin
|
||||||
break if vin.nil?
|
break if vin.nil?
|
||||||
|
|
||||||
if not cf.string_value.to_s.eql? vin
|
if not cf.string_value.to_s.eql? vin
|
||||||
cf.string_value = vin.to_s
|
cf.string_value = vin.to_s
|
||||||
Rails.logger.info "VIN has changed"
|
log "VIN has changed"
|
||||||
context[:is_changed] = true
|
context[:is_changed] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ module Vehicles
|
|||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
#do nothing
|
#do nothing
|
||||||
Rails.logger.info "redmine_qbo_vehicles.process_invoice_custom_fields failed, skipping"
|
log "redmine_qbo_vehicles.process_invoice_custom_fields failed, skipping"
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -56,6 +56,12 @@ module Vehicles
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def log(msg)
|
||||||
|
Rails.logger.info "[InvoiceHookListener] #{msg}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user