envato/double_entry

Importing Legacy Transactions

drush opened this issue · 5 comments

drush commented

Does anyone have a good pattern for importing legacy transactions into DE? This would require recording a transfer at a specific time in the past.

It looks like there are two options:

  1. Modifications to transfer/process/create_lines in order to override default dates

  2. Override Time.now or AR setters for created_at/updated_at in a block outside the transfer creation.

Any ideas, thoughts, gists welcome.

drush commented

@orien Do you have any thoughts on this?

orien commented

hi @drush, I can't say I've ever done this. I wonder if the DoubleEntry.transfer method should accept a timestamp option for this use case.

FUT commented

@drush Hello! What solution did you choose? I am in the same situation currently :)

drush commented

You should test this approach thoroughly for your use case, but you can try time travel: https://github.com/travisjeffery/timecop to set the time of the transaction. Your intermediate balances will all have to be recalculated if you do this, so beware.

orien commented

Thanks for sharing @drush.

I'll close this issue now.