lib/kpm/account.rb in kpm-0.7.1 vs lib/kpm/account.rb in kpm-0.7.2

- old
+ new

@@ -37,11 +37,11 @@ REMOVE_DATA_FROM = {:accounts => [:name, :address1, :address2, :city, :state_or_province, :phone, :email], :account_history => [:name, :address1, :address2, :city, :state_or_province, :phone, :email]} DATE_COLUMNS_TO_FIX = ['created_date','updated_date','processing_available_date','effective_date', 'boot_date','start_timestamp','last_access_time','payment_date','original_created_date', - 'last_sys_update_date','charged_through_date','bundle_start_date','start_date'] + 'last_sys_update_date','charged_through_date','bundle_start_date','start_date', 'reference_time'] # round trip constants duplicate record ROUND_TRIP_EXPORT_IMPORT_MAP = {:accounts => {:id => :accounts_id, :external_key => :accounts_id}, :all => {:account_id => :accounts_id}, :account_history => {:id => :account_history_id, :external_key => :accounts_id, :payment_method_id => :payment_methods_id}, :account_emails => {:id => :account_emails_id}, :account_email_history => {:id => :account_email_history_id}, @@ -107,21 +107,22 @@ export_file end def import_data(source_file, tenant_record_id, skip_payment_methods, round_trip_export_import = false, generate_record_id = false) + source_file = File.expand_path(source_file) @generate_record_id = generate_record_id @tenant_record_id = tenant_record_id @round_trip_export_import = round_trip_export_import if source_file === :import.to_s raise Interrupt, 'Need to specify a file' end unless File.exist?(source_file) - raise Interrupt, 'Need to specify a valid file' + raise Interrupt, "File #{source_file} does not exist" end @delimiter = sniff_delimiter(source_file) || @delimiter sanitize_and_import(source_file, skip_payment_methods) @@ -273,9 +274,10 @@ return nil end row = [] + @logger.debug "Processing table_name=#{table_name}, line=#{line}" cols_names.each_with_index do |col_name, index| sanitized_value = sanitize(table_name,col_name,cols[index], skip_payment_methods) unless sanitized_value.nil? row << sanitized_value \ No newline at end of file