Sha256: 7fa59d64de349fdf4c7f6f4ffa7143f0f8824504b797465b38c098043fb0b561

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 Bytes

Contents

require "economic/proxies/entity_proxy"
require "economic/proxies/actions/find_by_date_interval"

module Economic
  class CurrentInvoiceProxy < EntityProxy
    include FindByDateInterval

    private

    # Initialize properties in invoice with values from owner
    def initialize_properties_with_values_from_owner(invoice)
      if owner.is_a?(Debtor)
        invoice.debtor = owner

        invoice.debtor_name         ||= owner.name
        invoice.debtor_address      ||= owner.address
        invoice.debtor_postal_code  ||= owner.postal_code
        invoice.debtor_city         ||= owner.city

        invoice.term_of_payment_handle  ||= owner.term_of_payment_handle
        invoice.layout_handle           ||= owner.layout_handle
        invoice.currency_handle         ||= owner.currency_handle
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rconomic-0.7.0 lib/economic/proxies/current_invoice_proxy.rb
rconomic-0.6.1 lib/economic/proxies/current_invoice_proxy.rb
rconomic-0.6.0 lib/economic/proxies/current_invoice_proxy.rb