diff --git a/app/jobs/update_account_invoices.rb b/app/jobs/update_account_invoices.rb index 70ba5e53c1..4f53bec6ee 100644 --- a/app/jobs/update_account_invoices.rb +++ b/app/jobs/update_account_invoices.rb @@ -38,7 +38,7 @@ class UpdateAccountInvoices oldest_enterprise = billable_periods.first.enterprise address = oldest_enterprise.address.dup first, space, last = (oldest_enterprise.contact || "").partition(' ') - address.update_attributes(phone: oldest_enterprise.phone || "none") + address.update_attributes(phone: oldest_enterprise.phone) if oldest_enterprise.phone.present? address.update_attributes(firstname: first, lastname: last) if first.present? && last.present? account_invoice.order.update_attributes(bill_address: address, ship_address: address) end diff --git a/app/models/billable_period.rb b/app/models/billable_period.rb index 062f70dde8..d66c51aa48 100644 --- a/app/models/billable_period.rb +++ b/app/models/billable_period.rb @@ -44,6 +44,7 @@ class BillablePeriod < ActiveRecord::Base def ensure_correct_adjustment_for(invoice) if adjustment # adjustment.originator = enterprise.package + adjustment.adjustable = invoice adjustment.update_attributes( label: adjustment_label, amount: bill ) else self.adjustment = invoice.adjustments.new( adjustment_attrs, :without_protection => true )