app/models/visma/customer_order_copy.rb
def to_pdf
      return nil unless File.directory?(Rails.root.join('tmp'))
      return nil if emails.blank?
      file = "tmp/#{self.InvoiceNo}.pdf"
      File.open(Rails.root.join(*file), 'w:ASCII-8BIT') do |pdf|
        pdf.write emails.first.attachment.Data
      end
      self.InvoiceNo
    end
# Fetch the email attached PDF invoice
Fetch the email attached PDF invoice
Fetch the email attached PDF invoice
def to_pdf
      return nil unless File.directory?(Rails.root.join('tmp'))
      return nil if emails.blank?
      file = "tmp/#{self.InvoiceNo}.pdf"
      File.open(Rails.root.join(*file), 'w:ASCII-8BIT') do |pdf|
        pdf.write emails.first.attachment.Data
      end
      self.InvoiceNo
    end
def to_pdf return nil unless File . directory? ( Rails . root . join ( 'tmp' ) ) return nil if emails . blank? file = "tmp/#{self.InvoiceNo}.pdf" File . open ( Rails . root . join ( * file ) , 'w:ASCII-8BIT' ) do | pdf | pdf . write emails . first . attachment . Data end self . InvoiceNo end
Fetch the email attached PDF invoice
Fetch the email attached PDF invoice