Bug 31123 - Add a simple way to add 'Harmful content warnings' to catalogue records
Summary: Add a simple way to add 'Harmful content warnings' to catalogue records
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low new feature (vote)
Assignee: Martin Renvoize
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks: 31551 36370 36375
  Show dependency treegraph
 
Reported: 2022-07-08 13:48 UTC by Martin Renvoize
Modified: 2024-03-20 15:29 UTC (History)
6 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact: Caroline Cyr La Rose
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/685
Text to go in the release notes:
**Sponsored by** *Tavistock & Portman Library* This new feature allows librarians to pick a note field to use to store 'Content warnings' about biblio records. The new `ContentWarningField` system preference can be set to any MARC field, though for MARC21 an 59X is recommended. One can add said field to the frameworks and it will be displayed appropriately with the label 'Content warning:' in OPAC and staff interface on both detail and results pages. We hide subfield x from the OPAC as it is often used as a 'private note' in other note fields and we also handle turning the content of a 'u' subfield into a clickable link if you wish to use that. Other subfields as just displayed in line when present.
Version(s) released in:
23.05.00


Attachments
Bug 31123: Add `ContentWarningField` preference (3.28 KB, patch)
2022-09-08 15:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31123: Display content warnings on the intranet (5.38 KB, patch)
2022-09-08 15:56 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31123: Display content warnings in OPAC (3.96 KB, patch)
2022-09-08 15:56 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31123: Add `ContentWarningField` preference (3.33 KB, patch)
2022-09-08 20:57 UTC, David Nind
Details | Diff | Splinter Review
Bug 31123: Display content warnings on the intranet (5.42 KB, patch)
2022-09-08 20:57 UTC, David Nind
Details | Diff | Splinter Review
Bug 31123: Display content warnings in OPAC (3.98 KB, patch)
2022-09-08 20:57 UTC, David Nind
Details | Diff | Splinter Review
Bug 31123: Add `ContentWarningField` preference (3.34 KB, patch)
2022-11-14 22:11 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 31123: Display content warnings on the intranet (5.42 KB, patch)
2022-11-14 22:11 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 31123: Display content warnings in OPAC (3.98 KB, patch)
2022-11-14 22:12 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 31123: Add `ContentWarningField` preference (3.34 KB, patch)
2023-02-24 15:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31123: Display content warnings on the intranet (5.47 KB, patch)
2023-02-24 15:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31123: Display content warnings in OPAC (4.11 KB, patch)
2023-02-24 15:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31123: Update Staff XSLT to include all subfields (5.47 KB, patch)
2023-02-24 15:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31123: Add all subfields to OPAC stylsheet (5.49 KB, patch)
2023-02-24 15:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31123: Add `ContentWarningField` preference (3.39 KB, patch)
2023-03-30 14:16 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 31123: Display content warnings on the intranet (5.53 KB, patch)
2023-03-30 14:16 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 31123: Display content warnings in OPAC (4.16 KB, patch)
2023-03-30 14:16 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 31123: Update Staff XSLT to include all subfields (5.53 KB, patch)
2023-03-30 14:16 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 31123: Add all subfields to OPAC stylsheet (5.54 KB, patch)
2023-03-30 14:16 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 31123: Fix file permission (595 bytes, patch)
2023-03-30 14:16 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2022-07-08 13:48:36 UTC
I propose adding a new 'quick add' button into the biblio toolbar that would trigger a modal where staff can enter a short content warning note to be added to a designated 59X field (MARC21).

I would then modify the default XSLTs to display the note highlighted to draw the users attention.
Comment 1 Martin Renvoize 2022-09-08 15:55:57 UTC
Created attachment 140345 [details] [review]
Bug 31123: Add `ContentWarningField` preference

This patch adds a new `ContentWarningField` preference allowing the
library to define which 59X field to use to store harmful content
warning notes.
Comment 2 Martin Renvoize 2022-09-08 15:56:01 UTC
Created attachment 140346 [details] [review]
Bug 31123: Display content warnings on the intranet

This patch adds handling to our XSLT processing to pass the new
`ContentWarningField` preference value to the stylesheets and then uses
that variable to add content warning notes to both the detail and search
result displays of the staff client.

Test plan
1) Run the database update to expose the new system preference
2) Set `ContentWarningField` to something sensible, like `599`
3) Add the above select field to one of your frameworks with a subfield
   `a`.
4) Edit a record with that framework to add a content warning into the
   record
5) Search for the record and confirm you now see `Content warning: Your
   test text`
6) Click into the record detail and confirm you see the content warning
   text there too
7) Bonus points: Assign a new authorized value category to the chosen
   field and subfield and confirm the staff client display text is used
   in the above tests.
Comment 3 Martin Renvoize 2022-09-08 15:56:05 UTC
Created attachment 140347 [details] [review]
Bug 31123: Display content warnings in OPAC

This patch adds handling of content warning display to the OPAC for both
detail and search result views

Test plan
1) Work through the test plan for the previous patch
2) Confirm that the same text now also displays on the equivilent OPAC
   pages.
Comment 4 Martin Renvoize 2022-09-08 15:57:34 UTC
OK.. so this patchset just allows for adding the designated content_warning fields to display on OPAC and Staff interfaces without having to customise your local XSLT stylesheets.

The 'quick add' functionality is still a work in progress and is likely to move to it's own bug now.
Comment 5 David Nind 2022-09-08 20:57:30 UTC
Created attachment 140356 [details] [review]
Bug 31123: Add `ContentWarningField` preference

This patch adds a new `ContentWarningField` preference allowing the
library to define which 59X field to use to store harmful content
warning notes.

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2022-09-08 20:57:34 UTC
Created attachment 140357 [details] [review]
Bug 31123: Display content warnings on the intranet

This patch adds handling to our XSLT processing to pass the new
`ContentWarningField` preference value to the stylesheets and then uses
that variable to add content warning notes to both the detail and search
result displays of the staff client.

Test plan
1) Run the database update to expose the new system preference
2) Set `ContentWarningField` to something sensible, like `599`
3) Add the above select field to one of your frameworks with a subfield
   `a`.
4) Edit a record with that framework to add a content warning into the
   record
5) Search for the record and confirm you now see `Content warning: Your
   test text`
6) Click into the record detail and confirm you see the content warning
   text there too
7) Bonus points: Assign a new authorized value category to the chosen
   field and subfield and confirm the staff client display text is used
   in the above tests.

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2022-09-08 20:57:39 UTC
Created attachment 140358 [details] [review]
Bug 31123: Display content warnings in OPAC

This patch adds handling of content warning display to the OPAC for both
detail and search result views

Test plan
1) Work through the test plan for the previous patch
2) Confirm that the same text now also displays on the equivilent OPAC
   pages.

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2022-09-08 20:59:36 UTC
I have signed off, but noted that when using authorized values the authorized value code is displayed in the OPAC and staff interface, but not the text from the descriptions.
Comment 9 Katrin Fischer 2022-09-11 13:27:23 UTC
(In reply to David Nind from comment #8)
> I have signed off, but noted that when using authorized values the
> authorized value code is displayed in the OPAC and staff interface, but not
> the text from the descriptions.

Hi Martin, could you have a look at this, before we continue here?
Comment 10 Martin Renvoize 2022-09-12 12:40:06 UTC
Interesting, I can't replicate that issue.. perhaps caching related?

We don't really touch any of the AV in XSLT handling code in here, so I can't see how it would fail here but not elsewhere?
Comment 11 David Nind 2022-09-12 17:53:25 UTC
(In reply to Martin Renvoize from comment #10)
> Interesting, I can't replicate that issue.. perhaps caching related?

It was some sort of caching issue - apologies for the false alarm!

I retested again, and then did a flush_memcached, restart_all, and cleared the browser cache - the descriptions for the authorised values now display instead of the authorised value codes.
Comment 12 Martin Renvoize 2022-09-13 12:40:07 UTC
Awesome, thanks for retesting David :)
Comment 13 Katrin Fischer 2022-10-07 12:59:48 UTC
Hi Martin, 

I have questions :)

Can you how you chose the subfields? Will this be documented somewhere, maybe in the pref?

It looks like $z is displayed first, separated by a space and then followed by abcdefgijklnou, but this is not a "complete" list of subfields either. 

+                    <xsl:when test="marc:subfield[@code='z']">
+                        <xsl:value-of select="marc:subfield[@code='z']"/><xsl:text> </xsl:text>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:call-template name="subfieldSelect">
+                            <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param>
+                        </xsl:call-template>
+                    </xsl:otherwise>
+                </xsl:choose>
Comment 14 Katrin Fischer 2022-10-07 13:00:32 UTC
Failing, but just to get your attention, overall this looks good.
Comment 15 Martin Renvoize 2022-10-12 10:17:17 UTC
I think my choice of subfields and z was a bit arbitrary.. I used the 'action note', 583, as a basis.

Happy to be guided.
Comment 16 Martin Renvoize 2022-10-12 10:22:15 UTC
Subfield `z` is often 'public note' and subfield `x` is often 'nonpublic note' for other fields.. I did wonder about supporting subfield `u` specifically for a 'uri' to allow for linking to more details or a content policy or some such.
Comment 17 Katrin Fischer 2022-11-14 22:04:12 UTC
(In reply to Martin Renvoize from comment #16)
> Subfield `z` is often 'public note' and subfield `x` is often 'nonpublic
> note' for other fields.. I did wonder about supporting subfield `u`
> specifically for a 'uri' to allow for linking to more details or a content
> policy or some such.

a, x an z certainly make sense. Not sure what is better: keep it simple or make it a complete list. Both could be options.

The 5xx vary a lot in the number of subfields, 500 for example has almost none/just the basics: https://www.loc.gov/marc/bibliographic/bd500.html
Comment 18 Katrin Fischer 2022-11-14 22:11:50 UTC
Created attachment 143880 [details] [review]
Bug 31123: Add `ContentWarningField` preference

This patch adds a new `ContentWarningField` preference allowing the
library to define which 59X field to use to store harmful content
warning notes.

Signed-off-by: David Nind <david@davidnind.com>
Comment 19 Katrin Fischer 2022-11-14 22:11:55 UTC
Created attachment 143881 [details] [review]
Bug 31123: Display content warnings on the intranet

This patch adds handling to our XSLT processing to pass the new
`ContentWarningField` preference value to the stylesheets and then uses
that variable to add content warning notes to both the detail and search
result displays of the staff client.

Test plan
1) Run the database update to expose the new system preference
2) Set `ContentWarningField` to something sensible, like `599`
3) Add the above select field to one of your frameworks with a subfield
   `a`.
4) Edit a record with that framework to add a content warning into the
   record
5) Search for the record and confirm you now see `Content warning: Your
   test text`
6) Click into the record detail and confirm you see the content warning
   text there too
7) Bonus points: Assign a new authorized value category to the chosen
   field and subfield and confirm the staff client display text is used
   in the above tests.

Signed-off-by: David Nind <david@davidnind.com>
Comment 20 Katrin Fischer 2022-11-14 22:12:00 UTC
Created attachment 143882 [details] [review]
Bug 31123: Display content warnings in OPAC

This patch adds handling of content warning display to the OPAC for both
detail and search result views

Test plan
1) Work through the test plan for the previous patch
2) Confirm that the same text now also displays on the equivilent OPAC
   pages.

Signed-off-by: David Nind <david@davidnind.com>
Comment 21 Katrin Fischer 2022-11-14 22:13:08 UTC
(In reply to Katrin Fischer from comment #17)
> (In reply to Martin Renvoize from comment #16)
> > Subfield `z` is often 'public note' and subfield `x` is often 'nonpublic
> > note' for other fields.. I did wonder about supporting subfield `u`
> > specifically for a 'uri' to allow for linking to more details or a content
> > policy or some such.
> 
> a, x an z certainly make sense. Not sure what is better: keep it simple or
> make it a complete list. Both could be options.
> 
> The 5xx vary a lot in the number of subfields, 500 for example has almost
> none/just the basics: https://www.loc.gov/marc/bibliographic/bd500.html

Rebased. Suggestion: let's use a complete list? That way libraries can use whatever. Also maybe good in case of UNIMARC?

Did a tiny rebase: conflict in .pref
Comment 22 Martin Renvoize 2023-02-24 15:43:35 UTC
Created attachment 147342 [details] [review]
Bug 31123: Add `ContentWarningField` preference

This patch adds a new `ContentWarningField` preference allowing the
library to define which 59X field to use to store harmful content
warning notes.

Signed-off-by: David Nind <david@davidnind.com>
Comment 23 Martin Renvoize 2023-02-24 15:43:37 UTC
Created attachment 147343 [details] [review]
Bug 31123: Display content warnings on the intranet

This patch adds handling to our XSLT processing to pass the new
`ContentWarningField` preference value to the stylesheets and then uses
that variable to add content warning notes to both the detail and search
result displays of the staff client.

Test plan
1) Run the database update to expose the new system preference
2) Set `ContentWarningField` to something sensible, like `599`
3) Add the above select field to one of your frameworks with a subfield
   `a`.
4) Edit a record with that framework to add a content warning into the
   record
5) Search for the record and confirm you now see `Content warning: Your
   test text`
6) Click into the record detail and confirm you see the content warning
   text there too
7) Bonus points: Assign a new authorized value category to the chosen
   field and subfield and confirm the staff client display text is used
   in the above tests.

Signed-off-by: David Nind <david@davidnind.com>
Comment 24 Martin Renvoize 2023-02-24 15:43:41 UTC
Created attachment 147344 [details] [review]
Bug 31123: Display content warnings in OPAC

This patch adds handling of content warning display to the OPAC for both
detail and search result views

Test plan
1) Work through the test plan for the previous patch
2) Confirm that the same text now also displays on the equivilent OPAC
   pages.

Signed-off-by: David Nind <david@davidnind.com>
Comment 25 Martin Renvoize 2023-02-24 15:43:44 UTC
Created attachment 147345 [details] [review]
Bug 31123: Update Staff XSLT to include all subfields

This patch updates the XSLT sheets to include all subfields in your
selected ContentWarningField in display and handles converting the
subfield u if present to a hyperlink.
Comment 26 Martin Renvoize 2023-02-24 15:43:47 UTC
Created attachment 147346 [details] [review]
Bug 31123: Add all subfields to OPAC stylsheet

This patch updates the OPAC XSLT's to display all subfields, barring the
'x' field which is often used as a 'private note' in other notes fields.

We also handle converting subfield 'u' to a hyper link if it's found to
be present and use subfield 'a' for the link text if present.
Comment 27 Nick Clemens 2023-03-30 14:16:26 UTC
Created attachment 148992 [details] [review]
Bug 31123: Add `ContentWarningField` preference

This patch adds a new `ContentWarningField` preference allowing the
library to define which 59X field to use to store harmful content
warning notes.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 28 Nick Clemens 2023-03-30 14:16:29 UTC
Created attachment 148993 [details] [review]
Bug 31123: Display content warnings on the intranet

This patch adds handling to our XSLT processing to pass the new
`ContentWarningField` preference value to the stylesheets and then uses
that variable to add content warning notes to both the detail and search
result displays of the staff client.

Test plan
1) Run the database update to expose the new system preference
2) Set `ContentWarningField` to something sensible, like `599`
3) Add the above select field to one of your frameworks with a subfield
   `a`.
4) Edit a record with that framework to add a content warning into the
   record
5) Search for the record and confirm you now see `Content warning: Your
   test text`
6) Click into the record detail and confirm you see the content warning
   text there too
7) Bonus points: Assign a new authorized value category to the chosen
   field and subfield and confirm the staff client display text is used
   in the above tests.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 29 Nick Clemens 2023-03-30 14:16:35 UTC
Created attachment 148994 [details] [review]
Bug 31123: Display content warnings in OPAC

This patch adds handling of content warning display to the OPAC for both
detail and search result views

Test plan
1) Work through the test plan for the previous patch
2) Confirm that the same text now also displays on the equivilent OPAC
   pages.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 30 Nick Clemens 2023-03-30 14:16:39 UTC
Created attachment 148995 [details] [review]
Bug 31123: Update Staff XSLT to include all subfields

This patch updates the XSLT sheets to include all subfields in your
selected ContentWarningField in display and handles converting the
subfield u if present to a hyperlink.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 31 Nick Clemens 2023-03-30 14:16:51 UTC
Created attachment 148996 [details] [review]
Bug 31123: Add all subfields to OPAC stylsheet

This patch updates the OPAC XSLT's to display all subfields, barring the
'x' field which is often used as a 'private note' in other notes fields.

We also handle converting subfield 'u' to a hyper link if it's found to
be present and use subfield 'a' for the link text if present.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 32 Nick Clemens 2023-03-30 14:16:55 UTC
Created attachment 148997 [details] [review]
Bug 31123: Fix file permission

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 33 Tomás Cohen Arazi 2023-04-06 13:40:23 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 34 Jacob O'Mara 2023-04-17 07:21:19 UTC
Enhancement - not backporting to 22.11.x

Nice work everyone!