diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index 12458ea9..e83c146d 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -217,6 +217,7 @@ class CatalogController < ApplicationController config.add_show_field "other_authors", label: "Other authors/contributors", accessor: :other_authors, helper_method: :other_author_search_list config.add_show_field "also_titled", label: "Also Titled", accessor: :also_titled, helper_method: :list config.add_show_field "terms_of_use", label: "Terms of Use", accessor: :terms_of_use, helper_method: :emphasized_list + config.add_show_field "copyright_info", label: "Copyright Information", accessor: :copyright_info, helper_method: :emphasized_list config.add_show_field "available_from", label: "Available From", accessor: :available_from, helper_method: :unstyled_list config.add_show_field "acknowledgement", label: "Acknowledgement", accessor: :acknowledgement, helper_method: :unstyled_list config.add_show_field "exhibited", label: "Exhibited", accessor: :exhibited, helper_method: :list @@ -224,7 +225,7 @@ class CatalogController < ApplicationController config.add_show_field "music_publisher_number", label: "Music Publisher Number", accessor: :music_publisher_number, helper_method: :list config.add_show_field "related_records", label: "Related Records", accessor: :related_records, helper_method: :render_related_records_component config.add_show_field "rights_information", label: "Rights information", accessor: :rights_information, helper_method: :url_list, component: StaffOnlyComponent - config.add_show_field "copyright_info", label: "Copyright", accessor: :copyright_status, helper_method: :render_copyright_component, if: ->(_controller, _config, document) do + config.add_show_field "copyright", label: "Copyright", accessor: :copyright_status, helper_method: :render_copyright_component, if: ->(_controller, _config, document) do value = document.copyright_status # if there is no contextMsg, there is no rights information from the copyright service value.present? && value["contextMsg"].present? diff --git a/app/models/solr_document.rb b/app/models/solr_document.rb index a53cdffd..3954f601 100644 --- a/app/models/solr_document.rb +++ b/app/models/solr_document.rb @@ -139,11 +139,9 @@ def notes memo_wise :notes def copyright_status - copyright_info ||= get_copyright_status - # If no copyright info returned from the SOA # don't show the component. - copyright_info.presence + get_copyright_status.presence end memo_wise :copyright_status @@ -367,6 +365,10 @@ def terms_of_use get_marc_derived_field("5403abcd", options: {alternate_script: false}) end + def copyright_info + get_marc_derived_field("542abcdefghijkmnopqrsu368", options: {alternate_script: false}) + end + def other_authors fetch("additional_author_with_relator_ssim", nil) rescue KeyError diff --git a/spec/files/marc/8663054.marcxml b/spec/files/marc/8663054.marcxml new file mode 100644 index 00000000..d79fe906 --- /dev/null +++ b/spec/files/marc/8663054.marcxml @@ -0,0 +1 @@ +02384ckc a2200469 i 4500866305420230622101802.0m o c cr cn |||||n|n220714s2022 xx nnn o inzxx (AuCNL)8663054ANLengrdaANLanucu-at-viHenningham, Leigh,1960-photographer.Australian federal election campaign and polling places in Melbourne, Victoria, May 2022 / Leigh Henningham.2022.1 online resource (30 photographs) :TIFF files, colourstill imagerdacontentcomputerrdamediaonline resourcerdacarrierTitle devised by cataloguer based on information provided by photographer.Collection documenting polling places, election signage, candidates, campaign events, volunteers and voters in Melbourne, Victoria for the 2022 Australian federal election.Commissioned by the National Library of Australia, 2022.ANLCopyright held by the National Library of Australia.Australia.ParliamentElections, 2022Photographs.Australian GreensVictoriaMelbournePhotographs.Australian Labor PartyVictoriaMelbournePhotographs.Liberal Party of AustraliaVictoriaMelbournePhotographs.Pauline Hanson's One NationVictoriaMelbournePhotographs.United Australia PartyVictoriaMelbournePhotographs.Polling placesVictoriaMelbournePhotographs.Political postersVictoriaMelbournePhotographs.Signs and signboardsVictoriaMelbournePhotographs.VotingVictoriaMelbournePhotographs.ElectionsVictoriaMelbournePhotographs.Political candidatesVictoriaMelbournePhotographs.Political campaignsVictoriaMelbournePhotographs.Political partiesVictoriaMelbournePhotographs.Melbourne (Victoria)Photographs.National Library of Australia digital collection item.https://nla.gov.au/nla.obj-3075796665fulltextFinding aid at National Library of Australiahttps://nla.gov.au/nla.obj-3075796665/findingaid35df1d16-b7ab-525c-b586-dac248f3ddaa60c66e24-6389-54fa-b12f-980fe3aecad2National Library of AustraliaParkesParkesUse 'Online Access' link in record (PICD)PIC Online access #PIC/21070/1-30Other scheme013bb14d-1b1a-572e-a56d-a1b62273a9b2 \ No newline at end of file diff --git a/spec/models/solr_document_spec.rb b/spec/models/solr_document_spec.rb index c6717c04..d6458975 100644 --- a/spec/models/solr_document_spec.rb +++ b/spec/models/solr_document_spec.rb @@ -202,8 +202,8 @@ end end - describe "#copyright_info" do - subject(:copyright_info_value) do + describe "#copyright_status" do + subject(:copyright_status) do document.copyright_status end @@ -221,8 +221,8 @@ ) .to_return(status: 200, body: IO.read("spec/files/copyright/service_response.xml").to_s, headers: {}) - expect(copyright_info_value).not_to be_nil - expect(copyright_info_value["contextMsg"]).to eq "1.1" + expect(copyright_status).not_to be_nil + expect(copyright_status["contextMsg"]).to eq "1.1" end context "when no copyright info is returned by the SOA" do @@ -238,7 +238,7 @@ ) .to_return(status: 502, body: "", headers: {}) - expect(copyright_info_value).to be_nil + expect(copyright_status).to be_nil end end end @@ -1755,6 +1755,30 @@ end end + describe "#copyright_info" do + context "when there is copyright information" do + subject(:copyright_info_value) do + document = described_class.new(marc_ss: copyright_info) + document.copyright_info + end + + it "returns the copyright information" do + expect(copyright_info_value).to eq ["Copyright held by the National Library of Australia."] + end + end + + context "when there is no copyright information" do + subject(:copyright_info_value) do + document = described_class.new(marc_ss: publication_date) + document.copyright_info + end + + it "returns nil" do + expect(copyright_info_value).to be_nil + end + end + end + private def single_series @@ -2056,4 +2080,8 @@ def publication_date def alternate_publication_date load_marc_from_file 5976915 end + + def copyright_info + load_marc_from_file 8663054 + end end