Skip to content

Commit

Permalink
Merge pull request #2640 from archivesspace/ANW-1276
Browse files Browse the repository at this point in the history
ANW-1276: bugfix for include_unpublished flag not passed to ead agent export
  • Loading branch information
Brian Hoffman committed Mar 1, 2022
2 parents c70d5e2 + 2489ebe commit 2bf1699
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions backend/app/exporters/lib/export_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ def index_item_type_map
}
end

def controlaccess_linked_agents
def controlaccess_linked_agents(include_unpublished = false)
unless @controlaccess_linked_agents
results = []
linked = self.linked_agents || []
linked.each_with_index do |link, i|
next if link['role'] == 'creator' || (link['_resolved']['publish'] == false && !@include_unpublished)
next if link['role'] == 'creator' || (link['_resolved']['publish'] == false && !include_unpublished)
role = link['relator'] ? link['relator'] : (link['role'] == 'source' ? 'fmo' : nil)

agent = link['_resolved'].dup
Expand Down
4 changes: 2 additions & 2 deletions backend/app/exporters/serializers/ead.rb
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,15 @@ def serialize_origination(data, xml, fragments)
end

def serialize_controlaccess(data, xml, fragments)
if (data.controlaccess_subjects.length + data.controlaccess_linked_agents.length) > 0
if (data.controlaccess_subjects.length + data.controlaccess_linked_agents(@include_unpublished).length) > 0
xml.controlaccess {
data.controlaccess_subjects.each do |node_data|
xml.send(node_data[:node_name], node_data[:atts]) {
sanitize_mixed_content( node_data[:content], xml, fragments, ASpaceExport::Utils.include_p?(node_data[:node_name]) )
}
end

data.controlaccess_linked_agents.each do |node_data|
data.controlaccess_linked_agents(@include_unpublished).each do |node_data|
xml.send(node_data[:node_name], node_data[:atts]) {
sanitize_mixed_content( node_data[:content], xml, fragments, ASpaceExport::Utils.include_p?(node_data[:node_name]) )
}
Expand Down
4 changes: 2 additions & 2 deletions backend/app/exporters/serializers/ead3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@ def handle_arks(data, xml)


def serialize_controlaccess(data, xml, fragments)
if (data.controlaccess_subjects.length + data.controlaccess_linked_agents.length) > 0
if (data.controlaccess_subjects.length + data.controlaccess_linked_agents(@include_unpublished).length) > 0
xml.controlaccess {

data.controlaccess_subjects.each do |node_data|
Expand All @@ -1265,7 +1265,7 @@ def serialize_controlaccess(data, xml, fragments)
}
end

data.controlaccess_linked_agents.each do |node_data|
data.controlaccess_linked_agents(@include_unpublished).each do |node_data|

if node_data[:atts][:role]
node_data[:atts][:relator] = node_data[:atts][:role]
Expand Down

0 comments on commit 2bf1699

Please sign in to comment.