====== Adding a Subfield to the Record Display Fields ====== Note: These instructions assume you are making a local change, and not one you intend to submit to the community. They could be adapted or expanded so that these changes could be included in a patch. ===== In the OPAC ===== ==== 1. Figure out the attribute you need to alter. ==== In this example, we’re looking at adding subfield f from MARC tag 300 to the physical description in the record summary. Thie physical description is defined in Open-ILS\src\templates-bootstrap\opac\parts\record\summary.tt2
  • [% l("Physical Description:") %] [% filtered_hl_phys_desc.join('
    ') %]
  • [%- ELSIF attrs.phys_desc %]
  • [% l("Physical Description:") %] [% attrs.phys_desc | html %]
  • The OPAC is looking for the attribute “phys_desc” to define the value of the Physical Description. ==== 2. Change the configuration of the attribute. ==== Configuration for display fields can be found in this file: Open-ILS\src\templates-bootstrap\opac\parts\misc_util.tt2 If we search this file for “phys_desc” we find this clause: phys_content = []; FOR sub IN xml.findnodes( '//*[@tag="300"]/*[@code="a" or @code="b" or @code="c" or @code="e"]' ); phys_content.push(sub.textContent); END; args.phys_desc = phys_content.join(" "); What you end up changing will depend on how the attribute is defined. In this case, we can just add the subfield so that it appears like the others listed here, like so: phys_content = []; FOR sub IN xml.findnodes( '//*[@tag="300"]/*[@code="a" or @code="b" or @code="c" or @code="e" or @code="f"]' ); phys_content.push(sub.textContent); END; args.phys_desc = phys_content.join(" "); Subfield f should now display in the OPAC. A more complex attribute may require more testing. ===== In the Staff Catalog ===== ==== 1. Figure out the metabib field for the attribute you want to alter ==== You can confirm the metabib field that is being consulted by looking at the code in this file: Open-ILS\src\eg2\src\app\staff\catalog\result\record.component.html Again, we’ll be looking at adding subfield f from tag 300 to the Physical Description (Phys. Description) in the Angular catalog search results in this example. When searching the file for “physical” we find the code that defines the value:
    Phys. Desc.:
    So the metabib field we’ll be looking at is “physical_description” ==== 2. Check the format for the metabib field ==== In the GUI under Server Administration > MARC Search Facets/ Field or in the database in the config.metabib_field table, look for the entry with the name that matches what you found in step 1. In this case, the format is “mods33.” If it was “marcxml”, we could alter the XPATH to include the code we want to display. === a. (For format type “marcxml” only) Change the XPATH === Add the subfield you want to display to the XPATH. See other marcxml entries for guidance on what this should look like. === b. (For MODS formats only). Alter the stylesheet for the version of MODS that corresponds to the format of the entry you want to change. === i. In the database, look for the name that matches the format of the entry you want to change in the config.xml_transform table. In this case, we’re looking at mods33. ii. Look at the contents of the xslt field. It may be easiest to copy the text and paste it into a text editing program iii. Look for the tag you want to add the subfield to. In this example, we find the following when searching for “300”: abce The following change is enough to make sure subfield f is consulted: abcef Note: You may want to add a comment to indicate this was added as a customization. If you made the change in an outside text editing program, you can update the row with your changes. ==== 3. Reingest affected records ==== To make sure all records get the change, you’ll want to run a partial reingest. This query will reingest all affected records for our example. It may take a while to run depending on how many records are affected. SELECT metabib.reingest_metabib_field_entries(id) FROM biblio.record_entry WHERE id in (SELECT mrfr.record FROM metabib.real_full_rec mrfr JOIN biblio.record_entry bre ON mrfr.record = bre.id WHERE mrfr.tag = '300' AND mrfr.subfield = 'f' and bre.deleted = FALSE);