Bug 5471 - Quotes in tags cause moderation approval/rejection to fail
Summary: Quotes in tags cause moderation approval/rejection to fail
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Owen Leonard
QA Contact: Bugs List
Depends on:
Reported: 2010-12-03 21:42 UTC by Liz Rea
Modified: 2017-11-15 20:30 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:

Bug 5471 - Quotes in tags cause moderation approval/rejection to fail (24.43 KB, patch)
2017-06-09 13:15 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED OFF] Bug 5471 - Quotes in tags fail (24.55 KB, patch)
2017-06-12 15:02 UTC, Lee Jamison
Details | Diff | Splinter Review
Bug 5471 - Quotes in tags fail (24.59 KB, patch)
2017-07-31 10:54 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 5471: Use uri_escape_utf8 to handle utf8 chars correctly (1.54 KB, patch)
2017-08-10 16:15 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Liz Rea 2010-12-03 21:42:38 UTC
A tag such as "reality television" causes the approval or rejection of that tag to fail. The tag is simply never approved, no matter how many times you click the approve or reject button, or check the box and click approve. 

It does NOT affect any other tags, or affect batch processing of the other tags.
Comment 1 Ian Walls 2011-12-07 00:32:09 UTC
looks like it might be an issue with Lingua::Ispell...
Comment 2 Marc Véron 2015-06-02 14:07:03 UTC
Reproduced with following tags on current master:
"Reality TV"
Thema "Pinguin"

No errors, table says approved but they are not after reload of page or new search for tags.

Approving tags with single quotes results to an alert box: "AJAX error (1 alert)"
e.g. for 
'Pinguin Movies' 
Kinderbücher 'Pinguin'

but they appear as approved after reload of page or new search for tags.
Comment 3 Owen Leonard 2017-06-09 13:15:46 UTC Comment hidden (obsolete)
Comment 4 Lee Jamison 2017-06-12 15:02:15 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2017-06-15 18:55:48 UTC
Kyle, did you forget to attach your signoff patch?
Comment 6 Nick Clemens 2017-07-31 10:54:48 UTC
Created attachment 65334 [details] [review]
Bug 5471 - Quotes in tags fail

This patch makes changes to the tag moderation template and JavaScript
to fix handling of tags with double or single quotes. This patch also
moves the tags moderation JavaScript out of the template and into a
separate JS file.

To test you should have multiple tags awaiting moderation, including
tags which contain double and single quotes.

- Go to Tools -> Tags.
- In the list of tags pending approval, test approving and rejecting
  tags, including those containing single or double quotes.
  - The state of the "Approve" or "Reject" buttons should correctly
    change according to the action you chose.
  - The label in the status column should update correctly.
- In the "Check lists" form, submitting approved, rejected, and
  unclassified terms should result in the correct message.

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Works correctly based on test plan. Tested using single- and
double-quoted tags. Passes QA Tools.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Nick Clemens 2017-07-31 10:57:43 UTC
All buttons work as expected and quotes no longer cause errors.

In terms of usability I think there may be a little more to do here on a new bug:
1 - Approve a term - it remains on the screen - click 'Reject' at the bottom and the tag is approved and cleared
2 - Repeat qabove but also check the checkbox - tag is reject (though it said approved)

Would be nice to possibly have an 'Apply' button and then only show 'reject/approve' if some boxes are checked?  Adding an 'undo' might be nice as well in case you click on a tag you aren't ready to approve or reject yet

Not failing but leaving those comments for consideration
Comment 8 Jonathan Druart 2017-08-10 16:15:53 UTC
Created attachment 65831 [details] [review]
Bug 5471: Use uri_escape_utf8 to handle utf8 chars correctly

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Jonathan Druart 2017-08-10 16:53:51 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 10 Fridolin SOMERS 2017-09-29 09:25:27 UTC
Pushed to 17.05.x, will be in 17.05.05.
Comment 11 Katrin Fischer 2017-10-01 21:28:02 UTC
Patches don't apply cleanly to 16.11.x for the template changes to review.tt.
Please provide a patch for 16.11.x if you want this included.