Bug 21279

Summary: Transport cost matrix shows html entity in all empty cells
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: System AdministrationAssignee: Marcel de Rooy <m.de.rooy>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, gmcharlt, jonathan.druart, m.de.rooy, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13618
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22058
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 21279: (bug 13618 follow-up) Do not escape &nbsp; in "Transport cost matrix"
Bug 21279: (bug 13618 follow-up) Do not escape &nbsp; in "Transport cost matrix"
Bug 21279: [COUNTERPATCH] Fix &nbsp; in transport cost matrix
Bug 21279: Fix &nbsp; in transport cost matrix
Bug 21279: Fix &nbsp; in transport cost matrix

Description Katrin Fischer 2018-08-27 20:03:12 UTC
The transport cost matrix now shows &nbsp; in all empty cells. Cells should be empty.
Comment 1 Jonathan Druart 2018-08-29 19:53:05 UTC
Created attachment 78290 [details] [review]
Bug 21279: (bug 13618 follow-up) Do not escape &nbsp; in "Transport cost matrix"

Test plan:
On Home › Administration › Transport cost matrix you should no longer
see "&nbsp;".
Fill some values and save, you should see the correct values.
Comment 2 Katrin Fischer 2018-08-29 19:58:16 UTC
Created attachment 78291 [details] [review]
Bug 21279: (bug 13618 follow-up) Do not escape &nbsp; in "Transport cost matrix"

Test plan:
On Home › Administration › Transport cost matrix you should no longer
see "&nbsp;".
Fill some values and save, you should see the correct values.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 3 Marcel de Rooy 2018-08-31 06:00:44 UTC
-                            <div class="enable_cost_input" data-cost-id="[% bt.id | html %]">[% bt.disabled ? '&nbsp;' : bt.value | html %]</div>
+                            [% SET bt_value = '&nbsp;' %]
+                            [% UNLESS bt.disabled %][% bt_value = BLOCK %][% bt.value | html %][% END %][% END %]
+                            <div class="enable_cost_input" data-cost-id="[% bt.id | html %]">[% bt_value | $raw %]</div>

Looks overcomplicated to me. Assigning &nbsp; to template vars does not seem the way to go imo. No need to pass &nbsp; to raw too. This is just regular template contents.
Why not:

<div ..> [% IF bt.disabled %]&nbsp;[% ELSE %][% bt.value | html %]</div>

Looks simpler to me :) What do you think?
Comment 4 Jonathan Druart 2018-10-09 21:26:22 UTC
(In reply to Marcel de Rooy from comment #3)
> Looks simpler to me :) What do you think?

That's sounds simpler indeed, could you provide an alternative patch?
Comment 5 Marcel de Rooy 2018-10-10 11:46:59 UTC
Created attachment 80334 [details] [review]
Bug 21279: [COUNTERPATCH] Fix &nbsp; in transport cost matrix

Test plan:
On Home › Administration › Transport cost matrix you should no longer
see "&nbsp;".
Fill some values and save, you should see the correct values.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Jonathan Druart 2018-10-10 12:58:43 UTC
Created attachment 80338 [details] [review]
Bug 21279: Fix &nbsp; in transport cost matrix

Test plan:
On Home › Administration › Transport cost matrix you should no longer
see "&nbsp;".
Fill some values and save, you should see the correct values.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2018-10-10 12:59:03 UTC
Thanks Marcel!
Comment 8 Martin Renvoize 2018-10-10 13:43:37 UTC
Created attachment 80351 [details] [review]
Bug 21279: Fix &nbsp; in transport cost matrix

Test plan:
On Home › Administration › Transport cost matrix you should no longer
see "&nbsp;".
Fill some values and save, you should see the correct values.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2018-10-10 13:43:55 UTC
Nice simple fix, passing qa.
Comment 10 Nick Clemens 2018-10-15 17:03:13 UTC
Awesome work all!

Pushed to master for 18.11
Comment 11 Martin Renvoize 2018-10-17 10:28:26 UTC
Pushed to 18.05.x for 18.05.05
Comment 12 Fridolin Somers 2018-11-09 07:59:53 UTC
Pushed to 17.11.x for 17.11.12