Bug 8948

Summary: MARC21 field 787 doesn't display
Product: Koha Reporter: Jared Camins-Esakov <jcamins>
Component: OPACAssignee: Nick Clemens (kidclamp) <nick>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 - high CC: ablewicz, arthur.suzuki, david, dcook, gitbot, HeinrichJBHeidenreich, lucas, lucy.vaux-harvey, martin.renvoize, mtompset, nick, nunyo.lopez, tomascohen, verolencinas, veron, wainuiwitikapark
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00,22.05.10,21.11.16
Circulation function:
Attachments: Bug 8948: MARC21 field 787 doesn't display
Bug 8948: MARC21 field 787 doesn't display
Bug 8948: Display MARC 787 relationship field
Bug 8948: Display MARC 787 relationship field
Bug 8948: Display MARC 787 relationship field
Bug 8948: Display MARC 787 relationship field
Bug 8948: Changes for OPAC
Bug 8948 (follow-up) Correct OPAC link
Bug 8948: Display MARC 787 relationship field
Bug 8948: Changes for OPAC
Bug 8948 (follow-up) Correct OPAC link
Bug 8948: Display MARC 787 relationship field
Bug 8948: Changes for OPAC
Bug 8948: (follow-up) Correct OPAC link
Bug 8948: (follow-up) Remove 580 display from 787
Bug 8948: Display MARC 787 relationship field
Bug 8948: Changes for OPAC
Bug 8948: (follow-up) Correct OPAC link
Bug 8948: (follow-up) Remove 580 display from 787

Description Jared Camins-Esakov 2012-10-19 17:10:32 UTC
Facebook may not like unspecified relationships, but rare books catalogers do!
Comment 1 Nuño López Ansótegui 2013-08-27 10:42:52 UTC Comment hidden (obsolete)
Comment 2 I'm just a bot 2013-09-18 11:29:09 UTC Comment hidden (obsolete)
Comment 3 Mark Tompsett 2014-04-10 05:01:41 UTC Comment hidden (obsolete)
Comment 4 Mark Tompsett 2014-04-10 05:02:05 UTC Comment hidden (obsolete)
Comment 5 Jared Camins-Esakov 2014-04-10 12:51:26 UTC Comment hidden (obsolete)
Comment 6 Mark Tompsett 2014-04-10 18:40:51 UTC Comment hidden (obsolete)
Comment 7 Jared Camins-Esakov 2014-04-18 18:22:21 UTC Comment hidden (obsolete)
Comment 8 Marc Véron 2014-04-21 06:59:50 UTC Comment hidden (obsolete)
Comment 9 David Cook 2014-04-24 04:12:20 UTC Comment hidden (obsolete)
Comment 10 Marc Véron 2016-10-04 16:18:59 UTC Comment hidden (obsolete)
Comment 11 David Cook 2017-05-04 00:01:25 UTC Comment hidden (obsolete)
Comment 12 David Cook 2017-07-13 04:12:54 UTC
A quick look at ./koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl and ./koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl suggests that this is still valid.
Comment 13 David Cook 2017-07-13 04:14:11 UTC
I mean that the 787 is missing from the detail page. As for the patch, I imagine my comments from the past are also still valid, but I haven't reviewed the patch recently.
Comment 14 Lucy Vaux-Harvey 2021-01-07 13:07:08 UTC
Still valid.  It would be great to see 787 added to the details page for both OPAC and intranet.  We have needed to customise the xslt files to add this for several libraries.
Comment 15 verolencinas 2021-05-06 15:23:09 UTC
We are beginning to use this field to record instrument relationships. The idea behind is that a catalog should be capable to show the network of relationships between people, organizations, things, ideas, etc. But MARC21 reserves agency only to persons and organizations. In a lot of fields (science, art, etc.) instruments, tools, recording devices and other technical individuals have strong agencies and it should be possible to relate them to a resource.
For example, we are starting to link publications and archival resources (photographs, logbooks, notebooks, etc.) to the telescopes that were used in their creation. For the telescopes we are using uniform title authority records. Publications, logbooks and data recording notebooks will receive links to the authority records.
This practice could also be useful to link recording devices for older recordings in addition to notes (5XX fields).
In a future maybe we can have a more inclusive, simple but also granular data model. But for now we are stuck with MARC and should be able to get the best out of this situation.
Comment 16 Nick Clemens (kidclamp) 2022-10-28 16:45:17 UTC Comment hidden (obsolete)
Comment 17 Nick Clemens (kidclamp) 2022-10-28 16:46:04 UTC
Created attachment 142782 [details] [review]
Bug 8948: Display MARC 787 relationship field

This field is defined similar to 775, as a related work:
https://www.loc.gov/marc/bibliographic/bd787.html

This patch adds a display of this field, linking to the referenced record as the 775 does

It also tests for 580 field, and displays the text there if present, using the 787 a and t subfields otherwise

To test:
1 - Edit the default framework to make 787atw and 580a visible in editor
2 - Add a 787 to a record:
    $aThe ideas behind the chess openings
    $w2470231
3 - Confirm there is no display
4 - Apply patch / restart all
5 - 'Other related works' now shows
6 - Link should be using title of record
7 - Set system preference UseControlNumber to Use
8 - Reload details, link should now use control number
9 - Add a 580 to the record:
    $a This is a friendly work to this one
10 - Confirm the text of the link now displays the text etnered above
Comment 18 David Nind 2022-10-28 21:11:36 UTC
Created attachment 142791 [details] [review]
Bug 8948: Display MARC 787 relationship field

This field is defined similar to 775, as a related work:
https://www.loc.gov/marc/bibliographic/bd787.html

This patch adds a display of this field, linking to the referenced record as the 775 does

It also tests for 580 field, and displays the text there if present, using the 787 a and t subfields otherwise

To test:
1 - Edit the default framework to make 787atw and 580a visible in editor
2 - Add a 787 to a record:
    $aThe ideas behind the chess openings
    $w2470231
3 - Confirm there is no display
4 - Apply patch / restart all
5 - 'Other related works' now shows
6 - Link should be using title of record
7 - Set system preference UseControlNumber to Use
8 - Reload details, link should now use control number
9 - Add a 580 to the record:
    $a This is a friendly work to this one
10 - Confirm the text of the link now displays the text etnered above

Signed-off-by: David Nind <david@davidnind.com>
Comment 19 David Nind 2022-10-28 21:13:39 UTC
Have signed off as this works in the staff interface.

Are there any plans to add this to the OPAC as well? (see comment #14).
Comment 20 Katrin Fischer 2022-10-30 10:47:21 UTC
This looks pretty good and happy to see this tackled, but I have some comments:

1) This copies an old mistake we made in the beginning by using $a and $t for the title search. This often won't work. We need to split these up ti=t and au=a, like we have done now for 773 and should also correct in other templates:

<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f787, '()', ''), true())"/></xsl:attribute>

2) We should add this to OPAC and staff interface at the same time.

3) 580 is an issue. 

a) There can be mulitple 580 and you only display the first.
b) It might belong to a totally different 7xx linking field, creating a false display.

https://www.loc.gov/marc/bibliographic/bd580.html
Description of the complex relationship between the item described in the record and other items that cannot be adequately generated from the linking entry fields 760-787. 

I am not sure how this is supposed to be done... show only if it actually directly preceeds the first 787 we are looking at here? (is this even possible?) Show the 580 separately? Leave it off for now and deal with it later?

3) I believe there was some change to the separators between fields in OPAC at least sometime ago, or maybe it got stuck? I was not able to find the bug :(

I know in our records there are often a lot of 787 so we changed it to a list with separate lines for each entry. A class for the separator would help a lot here.

In patch:
+            <xsl:choose>
+                <xsl:when test="position()=last()"></xsl:when>
+                <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
+            </xsl:choose>

In other instances in the XSLT file:
<xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
Comment 21 Nick Clemens (kidclamp) 2022-11-03 12:07:05 UTC
Created attachment 143083 [details] [review]
Bug 8948: Display MARC 787 relationship field

This field is defined similar to 775, as a related work:
https://www.loc.gov/marc/bibliographic/bd787.html

This patch adds a display of this field, linking to the referenced record as the 775 does

It also tests for 580 field, and displays the text there if present, using the 787 a and t subfields otherwise

To test:
1 - Edit the default framework to make 787atw and 580a visible in editor
2 - Add a 787 to a record:
    $tThe ideas behind the chess openings
    $aFine, Reuben<
    $w2470231
3 - Confirm there is no display
4 - Apply patch / restart all
5 - 'Other related works' now shows
6 - Link should be using title of record
7 - Set system preference UseControlNumber to Use
8 - Reload details, link should now use control number
9 - Add a 580 to the record:
    $a This is a friendly work to this one
10 - Confirm the text of the link now displays before the link
11 - Add a second 580, confirm it displays as well
   - there is no seperator as each should end with a period or other punctuation according to MARC
   - there is a dpan with a class surrounding each so styling can be added as desired
12 - Add a second 787
   - confirm seperator present and wrapped in a span with a class
   - confirm each 787 is shown with a span/class for styling
Comment 22 Nick Clemens (kidclamp) 2022-11-03 12:07:10 UTC
Created attachment 143084 [details] [review]
Bug 8948: Changes for OPAC

Test with same record, confirm OPAC view is as expected
Comment 23 David Nind 2022-11-03 12:57:39 UTC
The link for the OPAC results in a 404 error.

The link should start with ../cgi-bin/koha/opac-search.pl?.. instead of ../cgi-bin/koha/catalogue/search.pl?.. ?
Comment 24 Nick Clemens (kidclamp) 2022-11-03 13:09:20 UTC
Created attachment 143111 [details] [review]
Bug 8948 (follow-up) Correct OPAC link
Comment 25 Andrew Fuerste-Henry 2022-11-03 17:13:40 UTC
Created attachment 143141 [details] [review]
Bug 8948: Display MARC 787 relationship field

This field is defined similar to 775, as a related work:
https://www.loc.gov/marc/bibliographic/bd787.html

This patch adds a display of this field, linking to the referenced record as the 775 does

It also tests for 580 field, and displays the text there if present, using the 787 a and t subfields otherwise

To test:
1 - Edit the default framework to make 787atw and 580a visible in editor
2 - Add a 787 to a record:
    $tThe ideas behind the chess openings
    $aFine, Reuben<
    $w2470231
3 - Confirm there is no display
4 - Apply patch / restart all
5 - 'Other related works' now shows
6 - Link should be using title of record
7 - Set system preference UseControlNumber to Use
8 - Reload details, link should now use control number
9 - Add a 580 to the record:
    $a This is a friendly work to this one
10 - Confirm the text of the link now displays before the link
11 - Add a second 580, confirm it displays as well
   - there is no seperator as each should end with a period or other punctuation according to MARC
   - there is a dpan with a class surrounding each so styling can be added as desired
12 - Add a second 787
   - confirm seperator present and wrapped in a span with a class
   - confirm each 787 is shown with a span/class for styling

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 26 Andrew Fuerste-Henry 2022-11-03 17:13:45 UTC
Created attachment 143142 [details] [review]
Bug 8948: Changes for OPAC

Test with same record, confirm OPAC view is as expected

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 27 Andrew Fuerste-Henry 2022-11-03 17:13:49 UTC
Created attachment 143143 [details] [review]
Bug 8948 (follow-up) Correct OPAC link

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 28 Tomás Cohen Arazi (tcohen) 2022-11-09 17:53:34 UTC
Created attachment 143562 [details] [review]
Bug 8948: Display MARC 787 relationship field

This field is defined similar to 775, as a related work:
https://www.loc.gov/marc/bibliographic/bd787.html

This patch adds a display of this field, linking to the referenced record as the 775 does

It also tests for 580 field, and displays the text there if present, using the 787 a and t subfields otherwise

To test:
1 - Edit the default framework to make 787atw and 580a visible in editor
2 - Add a 787 to a record:
    $tThe ideas behind the chess openings
    $aFine, Reuben<
    $w2470231
3 - Confirm there is no display
4 - Apply patch / restart all
5 - 'Other related works' now shows
6 - Link should be using title of record
7 - Set system preference UseControlNumber to Use
8 - Reload details, link should now use control number
9 - Add a 580 to the record:
    $a This is a friendly work to this one
10 - Confirm the text of the link now displays before the link
11 - Add a second 580, confirm it displays as well
   - there is no seperator as each should end with a period or other punctuation according to MARC
   - there is a dpan with a class surrounding each so styling can be added as desired
12 - Add a second 787
   - confirm seperator present and wrapped in a span with a class
   - confirm each 787 is shown with a span/class for styling

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 29 Tomás Cohen Arazi (tcohen) 2022-11-09 17:53:40 UTC
Created attachment 143563 [details] [review]
Bug 8948: Changes for OPAC

Test with same record, confirm OPAC view is as expected

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 30 Tomás Cohen Arazi (tcohen) 2022-11-09 17:53:48 UTC
Created attachment 143564 [details] [review]
Bug 8948: (follow-up) Correct OPAC link

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 31 Tomás Cohen Arazi (tcohen) 2022-11-09 18:29:38 UTC Comment hidden (obsolete)
Comment 32 Katrin Fischer 2022-11-09 22:40:43 UTC
This wasn't PQA for a reason. Displaying 580 in context of 787 is not correct, I'd even say it can lead to things looking quite wrong. Please see comment#20.
Comment 33 Katrin Fischer 2022-11-09 22:41:16 UTC
(In reply to Katrin Fischer from comment #32)
> This wasn't PQA for a reason. Displaying 580 in context of 787 is not
> correct, I'd even say it can lead to things looking quite wrong. Please see
> comment#20.

We should remove 580 display for the time being.
Comment 34 Nick Clemens (kidclamp) 2022-11-09 22:48:07 UTC
(In reply to Katrin Fischer from comment #33)
> (In reply to Katrin Fischer from comment #32)
> > This wasn't PQA for a reason. Displaying 580 in context of 787 is not
> > correct, I'd even say it can lead to things looking quite wrong. Please see
> > comment#20.
> 
> We should remove 580 display for the time being.

I did move the 580, they display after the 787

While they could mismatch, in general the documentation makes it seem it will be clear which note relates to which link. The 580 can now also be easily styled
Comment 35 Katrin Fischer 2022-11-09 22:52:28 UTC
Hm, but: 

+        <!--  787 Other Relationship Entry  -->
+        <xsl:if test="marc:datafield[@tag=787]">
+        <span class="results_summary other_relationship_entry"><span class="label">Other related works: </span>
+        <xsl:for-each select="marc:datafield[@tag=580]">
+            <span class="linking_complexity_note">
+                <xsl:call-template name="subfieldSelect">
+                    <xsl:with-param name="codes">a</xsl:with-param>
+                </xsl:call-template>
+                <xsl:text> </xsl:text>
+            </span>
+        </xsl:for-each>

You only display the 580 of a 787 exists and it displays after the "Other related works" which is the 787 label.

The problem is: 580 might belong to ANY 7xx field, not just the 787. In the documentation there are examples for 773 and 785 respectively. 

The problem is not if there are mulitple 787, but if we give a totally wrong context here.
Comment 36 Nick Clemens (kidclamp) 2022-11-10 11:37:30 UTC
Created attachment 143642 [details] [review]
Bug 8948: (follow-up) Remove 580 display from 787
Comment 37 Tomás Cohen Arazi (tcohen) 2022-11-10 12:20:27 UTC
Katrin, does the follow-up answer your concerns?
Comment 38 Tomás Cohen Arazi (tcohen) 2022-11-10 13:14:35 UTC
My mistake, I hadn't pushed this. Waiting for Katrin to answer.
Comment 39 Katrin Fischer 2022-11-10 16:17:05 UTC
Created attachment 143684 [details] [review]
Bug 8948: Display MARC 787 relationship field

This field is defined similar to 775, as a related work:
https://www.loc.gov/marc/bibliographic/bd787.html

This patch adds a display of this field, linking to the referenced record as the 775 does

It also tests for 580 field, and displays the text there if present, using the 787 a and t subfields otherwise

To test:
1 - Edit the default framework to make 787atw and 580a visible in editor
2 - Add a 787 to a record:
    $tThe ideas behind the chess openings
    $aFine, Reuben<
    $w2470231
3 - Confirm there is no display
4 - Apply patch / restart all
5 - 'Other related works' now shows
6 - Link should be using title of record
7 - Set system preference UseControlNumber to Use
8 - Reload details, link should now use control number
9 - Add a 580 to the record:
    $a This is a friendly work to this one
10 - Confirm the text of the link now displays before the link
11 - Add a second 580, confirm it displays as well
   - there is no seperator as each should end with a period or other punctuation according to MARC
   - there is a dpan with a class surrounding each so styling can be added as desired
12 - Add a second 787
   - confirm seperator present and wrapped in a span with a class
   - confirm each 787 is shown with a span/class for styling

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 40 Katrin Fischer 2022-11-10 16:17:11 UTC
Created attachment 143685 [details] [review]
Bug 8948: Changes for OPAC

Test with same record, confirm OPAC view is as expected

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 41 Katrin Fischer 2022-11-10 16:17:17 UTC
Created attachment 143686 [details] [review]
Bug 8948: (follow-up) Correct OPAC link

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 42 Katrin Fischer 2022-11-10 16:17:23 UTC
Created attachment 143687 [details] [review]
Bug 8948: (follow-up) Remove 580 display from 787

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 43 Katrin Fischer 2022-11-10 17:29:55 UTC
Thanks for your patience and the follow-up, Nick :)
Comment 44 Tomás Cohen Arazi (tcohen) 2022-11-10 17:51:20 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 45 Nick Clemens (kidclamp) 2023-02-14 14:34:40 UTC
Marking as a bug - this field should be displayed - I think this is eligible for backport
Comment 46 Lucas Gass (lukeg) 2023-02-14 22:36:38 UTC
Backported to 22.05.x for upcoming 22.05.10
Comment 47 Arthur Suzuki 2023-02-17 11:18:28 UTC
applied to 21.11.x for 21.11.16
Comment 48 Wainui Witika-Park 2023-03-15 01:46:47 UTC
Not backported to 21.05.x
Comment 49 Jacek Ablewicz 2023-04-17 10:17:00 UTC
In 21.11.x it has an unexpected side effect (commit 21ea11ff49a8564c09cb310fc77b471265722cfc), "OPAC view: " is displayed twice.
Comment 50 Martin Renvoize (ashimema) 2023-09-27 20:48:28 UTC
Could you report that as a new bug please, I think it's got lost at the end of this resolved older report.