|
|
|
|
@ -150,9 +150,19 @@ module Exports
|
|
|
|
|
attribute_hash |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def is_omitted_field?(field_name, _sales_log) |
|
|
|
|
!EXPORT_FIELDS.include?(field_name) || |
|
|
|
|
(!_sales_log.form.start_year_2026_or_later? && POST_2026_EXPORT_FIELDS.include?(field_name)) |
|
|
|
|
def is_included_field?(field_name, included_fields) |
|
|
|
|
included_fields.include?(field_name) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def get_included_fields(sales_log) |
|
|
|
|
included_fields = Set[] |
|
|
|
|
included_fields.merge(EXPORT_FIELDS) |
|
|
|
|
|
|
|
|
|
if sales_log.form.start_year_2026_or_later? |
|
|
|
|
included_fields.merge(POST_2026_EXPORT_FIELDS) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
return included_fields |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def build_export_xml(sales_logs) |
|
|
|
|
@ -162,11 +172,12 @@ module Exports
|
|
|
|
|
attribute_hash = apply_cds_transformation(sales_log, EXPORT_MODE[:xml]) |
|
|
|
|
form = doc.create_element("form") |
|
|
|
|
doc.at("forms") << form |
|
|
|
|
included_fields = get_included_fields(sales_log) |
|
|
|
|
attribute_hash.each do |key, value| |
|
|
|
|
if is_omitted_field?(key, sales_log) |
|
|
|
|
next |
|
|
|
|
else |
|
|
|
|
if is_included_field?(key, included_fields) |
|
|
|
|
form << doc.create_element(key, value) |
|
|
|
|
else |
|
|
|
|
next |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|