The patron search for a library was failing to return and was hung on "processing" what I found was that the patron's email address had a tab and a space at the end. When these were outputted in the json template members/tables/members_results.tt my browser ( chrome ) was unable to process the data giving a syntax error. I found this be recreating the query and calling svc/member/search directly from my browser.
Kyle, I don't reproduce: update borrowers set email="my@email.com\t " where borrowernumber=42; Then the results are displayed correctly. Moreover the email value is not displayed in the table. Could you detail please?
Here is a screencast of me reproducing the issue: http://screencast.com/t/ew0siMJQU I used Sequel Pro to insert the tab and space.
We have encountered this problem too in data loaded that came with unexpected tabs in the borrower data. It was very difficult to track down. Exactly the symptoms seen by Kyle. No errors that we could see and nothing in the koha error logs that we could find.
Created attachment 48786 [details] [review] Bug 15722: Escape patron infos for JSON in patron searches If patron infos contain invalid JSON chars (\t for instance), the results won't appear. The solution is to escape these info. Test plan: Edit patron infos in DB (update borrowers set surname="foobar\t" where borrowernumber=42) Search for foobar (you should have more than 1 result) Without this patch, DT retrieves a bad formatted JSON and the results won't appear. With this patch, the table result appears
Created attachment 48789 [details] [review] Bug 15722: Escape patron infos for JSON in patron searches If patron infos contain invalid JSON chars (\t for instance), the results won't appear. The solution is to escape these info. Test plan: Edit patron infos in DB (update borrowers set surname="foobar\t" where borrowernumber=42) Search for foobar (you should have more than 1 result) Without this patch, DT retrieves a bad formatted JSON and the results won't appear. With this patch, the table result appears Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 49517 [details] [review] k
Created attachment 49518 [details] [review] [PASSED QA] Bug 15722: Escape patron infos for JSON in patron searches If patron infos contain invalid JSON chars (\t for instance), the results won't appear. The solution is to escape these info. Test plan: Edit patron infos in DB (update borrowers set surname="foobar\t" where borrowernumber=42) Search for foobar (you should have more than 1 result) Without this patch, DT retrieves a bad formatted JSON and the results won't appear. With this patch, the table result appears Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to Master - Should be in May 2016 release. Thanks!
Note to myself: waiting for bug 16214 to be pushed to master, so I can push them both into 3.22.x at the same time
Patch pushed to 3.22.x, will be in 3.22.6
Pushed to 3.20.x, will be in 3.20.11.