Bug 14744 - Cannot select guarantor when quote in one of the fields
Summary: Cannot select guarantor when quote in one of the fields
Status: RESOLVED DUPLICATE of bug 16450
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Blou
QA Contact: Testopia
URL:
Keywords:
Depends on: 13618
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-27 15:41 UTC by Blou
Modified: 2017-05-10 17:58 UTC (History)
11 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
CAM 2145 - Bug 14744 - Fix select guarantor when quote in one of the fields (893 bytes, patch)
2015-09-04 20:44 UTC, Genevieve Plantin
Details | Diff | Splinter Review
CAM 2145 - Bug 14744 - Fix window closing when selecting a guarantor (2.22 KB, patch)
2015-09-04 20:53 UTC, Genevieve Plantin
Details | Diff | Splinter Review
Quotes from guarantor fields show up encoded in patrons address fields (69.50 KB, image/png)
2015-09-05 07:05 UTC, Marc Véron
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Blou 2015-08-27 15:41:42 UTC
If a field (here it's the branch name) contains a quote, the Select button doesn't work in guarantor_search.pl.

For example, if our branch is "Bibliothèque d'Avignon", the resulting json in the link is all broken and the "select" does nothing.

Setup:
- Have a Child patron and Adult patron in your DB.
- In Admin/Libraries and Group, modify the name to add a ' in the middle.

Test:
- Modify your child patron.
  - The second section should be "Guarantor Information"
- Click the "Set to patron" button
- Enter the info to find your adult
- In the resulting list, click the Select at the end of the line
   - Nothing will happen
   - Hover over the link, you'll see the gibberish inside.
- Remove the ' from the branch name.  Do the steps above.  Everything is alright.
Comment 1 Marc Véron 2015-08-31 12:59:43 UTC
Confirmed. 

I tested by having a guarantor with a single quote in his/her branch name.

The same happens if the single quote appears in the guarantor's name (d'Artangnan) or in the address / city (Bourbon-l'Archambault)
Comment 2 Genevieve Plantin 2015-09-04 20:44:11 UTC
Created attachment 42416 [details] [review]
CAM 2145 - Bug 14744 - Fix select guarantor when quote in one of the fields

The quote was wrapping the onclick attribute of the select, so i have replaced all of the quotes in borrower data (only for this section) by ' (single quote for html)
Comment 3 Genevieve Plantin 2015-09-04 20:53:51 UTC
Created attachment 42417 [details] [review]
CAM 2145 - Bug 14744 - Fix window closing when selecting a guarantor

After slecting a guarantor, the window was not closing.

Some parts of the form in the user_select function are not defined yet, so the JavaScript was crashing when it encounters the undefined form fields preventing it from closing the window. I only had if conditions to prevent the script form bugging and to close the window.
Comment 4 Marc Véron 2015-09-05 07:05:41 UTC
Created attachment 42419 [details]
Quotes from guarantor fields show up encoded in patrons address fields

If I select a gaurantor displayed encoded with quotes in the address fields, the patron's address fields are populated with encoded values.

---
BTW: Is it a feature or a bug that the patron main address is changed to the guarantor's main address? (That happens already before applying the patches).
Comment 5 Joonas Kylmälä 2015-09-08 12:09:06 UTC
Not sure if I'm right but I think there has been at least 2 similar bug reports to this but I couldn't find them now... Anyways, there has been already discussion about some general fix for this (and If I remember right there is already some work done). The fix where the work has been done was not that far away from coming to master (maybe couple of months) but there was also another idea to wait ~2 years until template toolkit's newer version comes to different GNU/Linux distros (and it fixes the problem).
Comment 6 Joonas Kylmälä 2015-09-08 12:18:47 UTC
It was Bug 14505 where there was discussion about this kind of bugs.
Comment 7 Marc Véron 2015-09-08 12:25:39 UTC
...and Bug 14691 - Can't delete patron with ' character in cardnumber
Comment 8 Liz Rea 2015-11-06 01:56:39 UTC
I'd love to see these bugs fixed, I think we should put our attention into bug 13618 rather than fixing all of these independent occurrences of the same-ish problem.

13618 will need heaps of testing.
Comment 9 Owen Leonard 2016-05-13 16:38:06 UTC
I believe this is fixed by Bug 16450.

*** This bug has been marked as a duplicate of bug 16450 ***