lib/intacctrb/journal_entry.rb in intacctrb-0.4 vs lib/intacctrb/journal_entry.rb in intacctrb-0.4.1
- old
+ new
@@ -155,12 +155,12 @@
end
def je_xml xml
xml.recordno object.intacct_id if object.intacct_id
xml.journal object.journal_id
- xml.batch_date (object.date.try(:strftime, '%Y-%m-%d')) if object.date
- xml.reverse_date (object.reverse_date.try(:strftime, '%Y-%m-%d')) if object.reverse_date
+ xml.batch_date date_string(object.date) if object.date
+ xml.reverse_date date_string(object.reverse_date) if object.reverse_date
xml.batch_title object.description
xml.referenceno object.reference_number
je_item_fields(xml)
end
@@ -180,9 +180,17 @@
xml.item row[:item_id] if row[:itemid]
xml.classid row[:class_id] if row[:class_id]
}
end
}
+ end
+
+ def date_string(date)
+ if date.is_a?(Date) || date.is_a?(DateTime)
+ date.strftime('%Y-%m-%d')
+ elsif date.is_a? String
+ date
+ end
end
end
end