Bug 22058

Summary: OPAC holdings table shows   instead of blank
Product: Koha Reporter: Mark Alexander <marka>
Component: OPACAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, jesse, katrin.fischer, martin.renvoize, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21279
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 13618    
Bug Blocks:    
Attachments: OPAC MARC view holding detail in 18.11
Bug 22058: Fix display of empty table cells in OPAC MARC view holdings
Bug 22058: Fix display of empty table cells in OPAC MARC view holdings
Bug 22058: Fix display of empty table cells in OPAC MARC view holdings

Description Mark Alexander 2019-01-02 11:19:27 UTC
Created attachment 83573 [details]
OPAC MARC view holding detail in 18.11

In the OPAC, when looking at the MARC view for an item, there is a
table at the bottom of the page showing some holding information.
Those table fields that used to be blank in 18.05 are now displaying
as "&nbsp;" (without the quotes) in 18.11.  In my particular case, the
fields that are displayed this way are:

* Withdrawn status
* Lost status
* Damaged status
* Not for loan
Comment 1 Katrin Fischer 2019-01-02 22:44:47 UTC
Maybe a similar fix as bug 21279?
Comment 2 Katrin Fischer 2019-01-02 23:13:38 UTC
It's line 320 in opac-MARCDetail.pl:
        $item_data->{$subfield_code} ||= "&nbsp;"

If you change that to " " or "" it will display correctly.

But: I compared the display to staff and there we actually use a $raw filter on the template which will also display correctly. It has the added benefit that HTML used in note fields (I know, we do that) will display correctly.

So I will propose a patch making staff and OPAC match.
Comment 3 Katrin Fischer 2019-01-02 23:19:25 UTC
Created attachment 83609 [details] [review]
Bug 22058: Fix display of empty table cells in OPAC MARC view holdings

I compared the template logic to the MARC detail page in staff.
We use $raw there instead of html, which will also make notes and other
fields with HTML in them display correctly. I am proposing to use the
$raw filter in OPAC as well.

To test:
- Go to the OPAC
- Search for a record with items
- Switch to the MARC view
- Verify empty cells show &nbsp; (html entity for space)
- Apply patch
- Repeat test
- Verify empty table cells now show as empty
Comment 4 Owen Leonard 2019-01-03 15:44:54 UTC
Created attachment 83621 [details] [review]
Bug 22058: Fix display of empty table cells in OPAC MARC view holdings

I compared the template logic to the MARC detail page in staff.
We use $raw there instead of html, which will also make notes and other
fields with HTML in them display correctly. I am proposing to use the
$raw filter in OPAC as well.

To test:
- Go to the OPAC
- Search for a record with items
- Switch to the MARC view
- Verify empty cells show &nbsp; (html entity for space)
- Apply patch
- Repeat test
- Verify empty table cells now show as empty

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Tomás Cohen Arazi 2019-01-07 10:07:29 UTC
This one probably deserves a t/db_dependent/selenium/regressions.t test. Specially if we allow HTML in note fields.
Comment 6 Tomás Cohen Arazi 2019-01-09 10:39:44 UTC
Created attachment 83736 [details] [review]
Bug 22058: Fix display of empty table cells in OPAC MARC view holdings

I compared the template logic to the MARC detail page in staff.
We use $raw there instead of html, which will also make notes and other
fields with HTML in them display correctly. I am proposing to use the
$raw filter in OPAC as well.

To test:
- Go to the OPAC
- Search for a record with items
- Switch to the MARC view
- Verify empty cells show &nbsp; (html entity for space)
- Apply patch
- Repeat test
- Verify empty table cells now show as empty

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 7 Nick Clemens 2019-01-18 20:59:22 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize 2019-01-23 12:43:07 UTC
Pushed to 18.11.x for 18.11.03
Comment 9 Jesse Maseto 2019-01-23 19:12:27 UTC
Merge conflicts with 18.05. Will not be backported.
Comment 10 Fridolin Somers 2019-02-25 07:03:34 UTC
(In reply to Jesse Maseto from comment #9)
> Merge conflicts with 18.05. Will not be backported.

This patch is not needed for 18.05.x since the var is not escaped :
[% item.$sf_code %]