Bug 34894

Summary: Convert OpacSuppressionMessage system preference to HTML customization
Product: Koha Reporter: Owen Leonard <oleonard>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: enhancement    
Priority: P5 - low CC: caroline.cyr-la-rose, david, fridolin.somers, testopia, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Caroline Cyr La Rose Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/777
Text to go in the release notes:
Version(s) released in:
23.11.00
Circulation function:
Bug Depends on: 31383, 34889    
Bug Blocks: 26050, 35048, 35952    
Attachments: Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization
Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization
Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization
Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization
Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization
Bug 34894: (follow-up) Add entry to HTML customization help include
Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization
Bug 34894: (follow-up) Add entry to HTML customization help include
Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization
Bug 34894: (follow-up) Add entry to HTML customization help include
Bug 34894: (follow-up) Fix id for HTML customization help
Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization
Bug 34894: (follow-up) Add entry to HTML customization help include
Bug 34894: (follow-up) Fix id for HTML customization help

Description Owen Leonard 2023-09-22 18:53:09 UTC
Building on 22318, the OpacSuppressionMessage system preference should be converted to an HTML customization option.
Comment 1 Owen Leonard 2023-09-29 14:45:00 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2023-09-29 14:55:08 UTC Comment hidden (obsolete)
Comment 3 Owen Leonard 2023-10-19 17:55:23 UTC Comment hidden (obsolete)
Comment 4 David Nind 2023-10-21 21:25:26 UTC
I'm getting an error when running the database update:

kohadev-koha@kohadevbox:koha(bz34894)$ updatedatabase
DEV atomic update /kohadevbox/koha/installer/data/mysql/atomicupdate/bug-34894-move-OpacSuppressionMessage-to-additional-contents.pl  [21:23:45]: Bug 34894 - Move OpacSuppressionMessage to additional contents
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Unknown column 'title' in 'field list' at /kohadevbox/koha/C4/Installer.pm line 741
Comment 5 David Nind 2023-10-21 21:30:28 UTC
Something to do with Bug 31383?
Comment 6 David Nind 2023-10-23 20:36:17 UTC
I tried again after the follow-ups to bug 31383.

The database update runs if there is no previous content.

However, if I add some content, apply the patch, then run the database update I get the same error:

kohadev-koha@kohadevbox:koha(bz34894)$ updatedatabase
DEV atomic update /kohadevbox/koha/installer/data/mysql/atomicupdate/bug-34894-move-OpacSuppressionMessage-to-additional-contents.pl  [20:32:14]: Bug 34894 - Move OpacSuppressionMessage to additional contents
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Unknown column 'title' in 'field list' at /kohadevbox/koha/C4/Installer.pm line 741
Comment 7 Owen Leonard 2023-10-25 14:22:48 UTC Comment hidden (obsolete)
Comment 8 Owen Leonard 2023-10-25 16:03:03 UTC
Created attachment 157829 [details] [review]
Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization

This patch moves the OpacSuppressionMessage system preference into HTML
customizations, making it possible to have language- and library-specific
content.

To test you should have some content in the OpacSuppressionMessage
system preference before applying the patch. Apply the patch and run the
database update process.

- In the staff interface, locate a bibliographic record and open it for
  editing.
- Under tab 9, tag 942, change subfield n, "Suppress in OPAC", to "Yes"
  and save the record.

- Go to the OPAC and try to navigate directly to the bibliographic
  detail page for that record:
  /cgi-bin/koha/opac-detail.pl?biblionumber=X
- You should be redirectd to the "Blocked" page. Under the message "You
  are not authorized to view this record" you should see the content
  which was previously in the OpacSuppressionMessage system preference.

- In the staff client, go to Tools -> HTML customizations and verify
  that the content from OpacSuppressionMessage is now stored there.
- The HTML customization entry form should offer OpacSuppressionMessage
  as a choice under "Display location."
- Update and reinstall active translations (for instance fr-FR):
  - perl misc/translator/translate update fr-FR
  - perl misc/translator/translate install fr-FR
- Enable the translation if necessary under Administration -> System
  preferences -> language.
- Enable the "opaclanguagesdisplay" preference if necessary.
- Edit the OpacSuppressionMessage HTML customization and add unique
  content to the "fr-FR" tab.

- Go to the OPAC and switch to your updated translation. Try to view
  the suppressed record again and confirm that the content you added
  for your translation shows up correctly.
- Go to Administration -> System preferences and search for
  "OpacSuppression." The description of these preferences should show an
  updated message about using HTML customizations to create
  OpacSuppressionMessage content.
Comment 9 Owen Leonard 2023-10-25 16:03:05 UTC
Created attachment 157830 [details] [review]
Bug 34894: (follow-up) Add entry to HTML customization help include
Comment 10 Owen Leonard 2023-10-26 12:08:15 UTC
Created attachment 157916 [details] [review]
Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization

This patch moves the OpacSuppressionMessage system preference into HTML
customizations, making it possible to have language- and library-specific
content.

To test you should have some content in the OpacSuppressionMessage
system preference before applying the patch. Apply the patch and run the
database update process.

- In the staff interface, locate a bibliographic record and open it for
  editing.
- Under tab 9, tag 942, change subfield n, "Suppress in OPAC", to "Yes"
  and save the record.

- Go to the OPAC and try to navigate directly to the bibliographic
  detail page for that record:
  /cgi-bin/koha/opac-detail.pl?biblionumber=X
- You should be redirectd to the "Blocked" page. Under the message "You
  are not authorized to view this record" you should see the content
  which was previously in the OpacSuppressionMessage system preference.

- In the staff client, go to Tools -> HTML customizations and verify
  that the content from OpacSuppressionMessage is now stored there.
- The HTML customization entry form should offer OpacSuppressionMessage
  as a choice under "Display location."
- Update and reinstall active translations (for instance fr-FR):
  - perl misc/translator/translate update fr-FR
  - perl misc/translator/translate install fr-FR
- Enable the translation if necessary under Administration -> System
  preferences -> language.
- Enable the "opaclanguagesdisplay" preference if necessary.
- Edit the OpacSuppressionMessage HTML customization and add unique
  content to the "fr-FR" tab.

- Go to the OPAC and switch to your updated translation. Try to view
  the suppressed record again and confirm that the content you added
  for your translation shows up correctly.
- Go to Administration -> System preferences and search for
  "OpacSuppression." The description of these preferences should show an
  updated message about using HTML customizations to create
  OpacSuppressionMessage content.
Comment 11 Owen Leonard 2023-10-26 12:08:18 UTC
Created attachment 157917 [details] [review]
Bug 34894: (follow-up) Add entry to HTML customization help include
Comment 12 David Nind 2023-10-26 20:25:58 UTC
Created attachment 157958 [details] [review]
Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization

This patch moves the OpacSuppressionMessage system preference into HTML
customizations, making it possible to have language- and library-specific
content.

To test you should have some content in the OpacSuppressionMessage
system preference before applying the patch. Apply the patch and run the
database update process.

- In the staff interface, locate a bibliographic record and open it for
  editing.
- Under tab 9, tag 942, change subfield n, "Suppress in OPAC", to "Yes"
  and save the record.

- Go to the OPAC and try to navigate directly to the bibliographic
  detail page for that record:
  /cgi-bin/koha/opac-detail.pl?biblionumber=X
- You should be redirectd to the "Blocked" page. Under the message "You
  are not authorized to view this record" you should see the content
  which was previously in the OpacSuppressionMessage system preference.

- In the staff client, go to Tools -> HTML customizations and verify
  that the content from OpacSuppressionMessage is now stored there.
- The HTML customization entry form should offer OpacSuppressionMessage
  as a choice under "Display location."
- Update and reinstall active translations (for instance fr-FR):
  - perl misc/translator/translate update fr-FR
  - perl misc/translator/translate install fr-FR
- Enable the translation if necessary under Administration -> System
  preferences -> language.
- Enable the "opaclanguagesdisplay" preference if necessary.
- Edit the OpacSuppressionMessage HTML customization and add unique
  content to the "fr-FR" tab.

- Go to the OPAC and switch to your updated translation. Try to view
  the suppressed record again and confirm that the content you added
  for your translation shows up correctly.
- Go to Administration -> System preferences and search for
  "OpacSuppression." The description of these preferences should show an
  updated message about using HTML customizations to create
  OpacSuppressionMessage content.

Signed-off-by: David Nind <david@davidnind.com>
Comment 13 David Nind 2023-10-26 20:26:01 UTC
Created attachment 157959 [details] [review]
Bug 34894: (follow-up) Add entry to HTML customization help include

Signed-off-by: David Nind <david@davidnind.com>
Comment 14 David Nind 2023-10-26 20:26:03 UTC
Created attachment 157960 [details] [review]
Bug 34894: (follow-up) Fix id for HTML customization help

Signed-off-by: David Nind <david@davidnind.com>
Comment 15 Katrin Fischer 2023-11-05 11:12:27 UTC
Created attachment 158450 [details] [review]
Bug 34894: Convert OpacSuppressionMessage system preference to HTML customization

This patch moves the OpacSuppressionMessage system preference into HTML
customizations, making it possible to have language- and library-specific
content.

To test you should have some content in the OpacSuppressionMessage
system preference before applying the patch. Apply the patch and run the
database update process.

- In the staff interface, locate a bibliographic record and open it for
  editing.
- Under tab 9, tag 942, change subfield n, "Suppress in OPAC", to "Yes"
  and save the record.

- Go to the OPAC and try to navigate directly to the bibliographic
  detail page for that record:
  /cgi-bin/koha/opac-detail.pl?biblionumber=X
- You should be redirectd to the "Blocked" page. Under the message "You
  are not authorized to view this record" you should see the content
  which was previously in the OpacSuppressionMessage system preference.

- In the staff client, go to Tools -> HTML customizations and verify
  that the content from OpacSuppressionMessage is now stored there.
- The HTML customization entry form should offer OpacSuppressionMessage
  as a choice under "Display location."
- Update and reinstall active translations (for instance fr-FR):
  - perl misc/translator/translate update fr-FR
  - perl misc/translator/translate install fr-FR
- Enable the translation if necessary under Administration -> System
  preferences -> language.
- Enable the "opaclanguagesdisplay" preference if necessary.
- Edit the OpacSuppressionMessage HTML customization and add unique
  content to the "fr-FR" tab.

- Go to the OPAC and switch to your updated translation. Try to view
  the suppressed record again and confirm that the content you added
  for your translation shows up correctly.
- Go to Administration -> System preferences and search for
  "OpacSuppression." The description of these preferences should show an
  updated message about using HTML customizations to create
  OpacSuppressionMessage content.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 16 Katrin Fischer 2023-11-05 11:12:30 UTC
Created attachment 158451 [details] [review]
Bug 34894: (follow-up) Add entry to HTML customization help include

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 17 Katrin Fischer 2023-11-05 11:12:33 UTC
Created attachment 158452 [details] [review]
Bug 34894: (follow-up) Fix id for HTML customization help

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 18 Tomás Cohen Arazi (tcohen) 2023-11-09 12:56:02 UTC
Hi. Just a note for QA: I'm tweaking the atomic update for all this bugs. I do it inline on the DBRev commit. As-is, it is leaving the syspref around on the DB if it is not set to a value, as the if condition is false when there's no syspref, but also when the value is NULL or ''.
Comment 19 Tomás Cohen Arazi (tcohen) 2023-11-09 13:15:35 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 20 Fridolin Somers 2023-11-11 07:12:06 UTC
Enhancement not pushed to 23.05.x