mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Update qbo_invoice.rb
This commit is contained in:
@@ -57,9 +57,10 @@ class QboInvoice < ActiveRecord::Base
|
|||||||
line.description.scan(/#(\w+)/).flatten.each { |issue|
|
line.description.scan(/#(\w+)/).flatten.each { |issue|
|
||||||
i = Issue.find_by_id(issue.to_i)
|
i = Issue.find_by_id(issue.to_i)
|
||||||
begin
|
begin
|
||||||
i.qbo_invoices << QboInvoice.find_by_id(invoice.id.to_i)
|
i.qbo_invoices << QboInvoice.find_by_id(invoice.id)
|
||||||
i.save!
|
i.save
|
||||||
rescue
|
rescue
|
||||||
|
puts "Something when wrong..."
|
||||||
# do nothing, the reccord exists
|
# do nothing, the reccord exists
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -70,8 +71,11 @@ class QboInvoice < ActiveRecord::Base
|
|||||||
if cf.name.eql? "VIN"
|
if cf.name.eql? "VIN"
|
||||||
vin = Vehicle.find(i.vehicles_id).vin
|
vin = Vehicle.find(i.vehicles_id).vin
|
||||||
break if vin.blank?
|
break if vin.blank?
|
||||||
cf.string_value = vin if not cf.string_value.to_s.eql? vin
|
if not cf.string_value.to_s.eql? vin
|
||||||
break
|
cf.string_value = vin
|
||||||
|
is_changed = true
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
#do nothing
|
#do nothing
|
||||||
@@ -90,11 +94,13 @@ class QboInvoice < ActiveRecord::Base
|
|||||||
# Nothing to do here, there is no match
|
# Nothing to do here, there is no match
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
# Push updates
|
|
||||||
get_base.update(invoice) if is_changed
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Push updates
|
||||||
|
get_base.update(invoice) if is_changed
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user