Bug 29782

Summary: Additional contents: Fix handling records without title or content
Product: Koha Reporter: Michael Kuhn <mik>
Component: OPACAssignee: Marcel de Rooy <m.de.rooy>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: dcook, fridolin.somers, jonathan.druart, kyle, lucas, m.de.rooy, martin.renvoize, nick, tomascohen, victor
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29778
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30272
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31370
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00,22.05.06,21.11.12
Bug Depends on: 24387    
Bug Blocks:    
Attachments: Bug 29782: Fix handling records without title or content
Bug 29782: Fix handling records without title or content
Bug 29782: Fix handling records without title or content

Description Michael Kuhn 2022-01-03 23:13:15 UTC
In Koha menu "Tools > HTML customizations" it is possible to create new entries for various display locations.

Given the Koha instance has two languages, "English (en)" and "Deutsch Deutschland (de-DE)" an entry will show three tabs:

* Default
* English (en)
* Deutsch Deutschland (de-DE)

If you fill just text into the "Content" field of the actual language tabs you will be prompted with a popup saying "Please specify a title for Default".

In fact I don't know why such a "title" is needed at all (see also bug 29515), but OK I fill one in, but do not fill any content into the "Content" field of the Default tab because I don't want or need no default content. Now it's possible to save.

The content of tab "English (en)" and "Deutsch Deutschland (de-DE)" will show up in the OPAC when changing to the respective language.

But Koha menu "Tools > HTML customizations" will NOT show any entry for the display location you have created! So you are not able to change its content or delete it.

The problem doesn't happen if you enter text in the "Content" field of the Default tab.

This means

1. It is not clear why the default tab is mandatory.

2. It shouldn't be possible to save the entry for a display location without entering text in the "Content" field of the Default tab if the consequence is that there won't be no entry for the display location in the end.
Comment 1 Fridolin Somers 2022-01-04 07:19:19 UTC
Indeed I reproduce the bug.
Comment 2 Fridolin Somers 2022-01-04 07:21:02 UTC
I think it comes from :

https://git.koha-community.org/Koha-community/Koha/src/commit/9a8ea2e46da6c788a633383b81cce70c9323f750/tools/additional-contents.pl#L120

I think we should deleted only if both title and content are empty.
Comment 3 Katrin Fischer 2022-01-04 08:26:20 UTC
We also had agreed that the title should not be mandatory, see:
Bug 29515 - Don't require title for HTML customizations
Comment 4 Fridolin Somers 2022-06-08 02:19:40 UTC
Still valid in master ?
Comment 5 David Cook 2022-07-22 04:44:10 UTC
I'm not sure I follow 100% but I'm not sure that this should be marked as "critical" importance.
Comment 6 Katrin Fischer 2022-07-22 08:04:28 UTC
The problem here is that we might create entries that exist in the database and display, but can't be deleted or edited without using SQL. As this effects the OPAC I think the importance is correct.
Comment 7 Marcel de Rooy 2022-08-16 12:00:20 UTC
*** Bug 30272 has been marked as a duplicate of this bug. ***
Comment 8 Marcel de Rooy 2022-08-16 12:04:22 UTC
Created attachment 139179 [details] [review]
Bug 29782: Fix handling records without title or content

Test plan:
Save a new record with only a title in the non-default tab (english).
Check if you see it on the list. Edit.
Save a new record without title but only content in non-default lang.
Check if you see it.
Do the same 2 edits on the default tab only. Verify too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Marcel de Rooy 2022-08-16 12:07:42 UTC
I notice one little tweak to be solved somewhere else: If you save without any title or content. And you edit the default tab again, a <br> is inserted before the no content comment tag.
Comment 10 Marcel de Rooy 2022-08-16 12:09:38 UTC
(In reply to David Cook from comment #5)
> I'm not sure I follow 100% but I'm not sure that this should be marked as
> "critical" importance.

I dont really think so. Major is enough for me :) Just signoff.
Comment 11 Marcel de Rooy 2022-08-16 12:13:02 UTC
Note for QA: The force a default record is imho an allowable trick to get the page to show the added record. The AC page assumes the presence of a default record, but the code did not enforce it. This is the smallest fix and allows for easier backports.
Comment 12 Caroline Cyr La Rose 2022-08-16 14:24:04 UTC
Created attachment 139209 [details] [review]
Bug 29782: Fix handling records without title or content

Test plan:
Save a new record with only a title in the non-default tab (english).
Check if you see it on the list. Edit.
Save a new record without title but only content in non-default lang.
Check if you see it.
Do the same 2 edits on the default tab only. Verify too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 13 Kyle M Hall 2022-08-17 15:54:38 UTC
Created attachment 139299 [details] [review]
Bug 29782: Fix handling records without title or content

Test plan:
Save a new record with only a title in the non-default tab (english).
Check if you see it on the list. Edit.
Save a new record without title but only content in non-default lang.
Check if you see it.
Do the same 2 edits on the default tab only. Verify too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 14 Tomás Cohen Arazi 2022-08-17 18:52:48 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 15 Lucas Gass 2022-10-03 22:34:53 UTC
Backported to 22.05.x for 22.05.06
Comment 16 Victor Grousset/tuxayo 2022-10-16 21:43:47 UTC
Missing dependencies for 21.05.x, it shouldn't be affected, no backport.

Nothing to document it seems, marking resolved.
Comment 17 Arthur Suzuki 2022-10-22 22:07:46 UTC
Thanks!

Pushed to 21.11 for 21.11.12