Parameterize civicrm dump directory

This commit is contained in:
Hugo Peixoto 2022-09-29 18:27:30 +01:00
parent 0950c0dbb0
commit 897b48e377

View File

@ -38,14 +38,15 @@ namespace :saucy do
list[0] list[0]
end end
addresses = sql_resultset_to_hashes('civicrm-dump/address.xml').select { |a| a["is_primary"] == "1" } dir = ENV.fetch('CIVICRM_DUMP_DIRECTORY')
contacts = sql_resultset_to_hashes('civicrm-dump/contact.xml') addresses = sql_resultset_to_hashes("#{dir}/address.xml").select { |a| a["is_primary"] == "1" }
contributions = sql_resultset_to_hashes('civicrm-dump/contribution.xml') contacts = sql_resultset_to_hashes("#{dir}/contact.xml")
emails = sql_resultset_to_hashes('civicrm-dump/email.xml').select { |a| a["is_primary"] == "1" } contributions = sql_resultset_to_hashes("#{dir}/contribution.xml")
memberships = sql_resultset_to_hashes('civicrm-dump/membership.xml').select { |m| Date.parse(m['end_date']).year >= 2020 } emails = sql_resultset_to_hashes("#{dir}/email.xml").select { |a| a["is_primary"] == "1" }
payment_instruments = sql_resultset_to_hashes('civicrm-dump/payment_instrument.xml') memberships = sql_resultset_to_hashes("#{dir}/membership.xml").select { |m| Date.parse(m['end_date']).year >= 2020 }
statuses = sql_resultset_to_hashes('civicrm-dump/status.xml') payment_instruments = sql_resultset_to_hashes("#{dir}/payment_instrument.xml")
types = sql_resultset_to_hashes('civicrm-dump/type.xml') statuses = sql_resultset_to_hashes("#{dir}/status.xml")
types = sql_resultset_to_hashes("#{dir}/type.xml")
members = contacts.map do |contact| members = contacts.map do |contact|