Bug 26797 - Error when trying to access Relative Checkouts between Professional and Organizational patron categories
Summary: Error when trying to access Relative Checkouts between Professional and Organ...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
: 26796 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-10-23 12:37 UTC by Kelly McElligott
Modified: 2021-06-14 21:35 UTC (History)
9 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.02


Attachments
Bug 26797: Escape firstname to prevent relative's checkouts to crash (1.81 KB, patch)
2020-12-02 10:28 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 26797: Escape firstname to prevent relative's checkouts to crash (1.87 KB, patch)
2020-12-02 15:00 UTC, Kelly McElligott
Details | Diff | Splinter Review
Bug 26797: Escape firstname to prevent relative's checkouts to crash (2.12 KB, patch)
2021-01-08 19:07 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kelly McElligott 2020-10-23 12:37:59 UTC
In Koha 20.05 and 19.11, when a Professional Patron Category patron and an Organizational patron category patron are linked, from the Professional patron, there is a tab to see the 'Relative Checkouts', but Koha just will spin and say processing.  

Koha is looking for a first name to link the relative checkouts from a professional to the linked Organizational patron.  On an organizational patron, there is no first name and therefore Koha can not do the link.
Comment 1 Jonathan Druart 2020-12-02 10:12:02 UTC
*** Bug 26796 has been marked as a duplicate of this bug. ***
Comment 2 Jonathan Druart 2020-12-02 10:25:29 UTC
Confirmed on master.
Comment 3 Jonathan Druart 2020-12-02 10:28:28 UTC
Created attachment 114091 [details] [review]
Bug 26797: Escape firstname to prevent relative's checkouts to crash

If no firstname is defined for a relative, the "Relative's checkouts"
tab will be "processing" forever.
JS error:
  TypeError: oObj.borrower.firstname is null

Test plan:
Patron A is Org and guarantor of patron B
Check an item out to B
Go to the details page of A, click "Relative's checkouts"
Comment 4 Jonathan Druart 2020-12-02 10:31:03 UTC
Note that there is a UI issue display (header number mismatch).
See bug 27133.
Comment 5 Kelly McElligott 2020-12-02 15:00:00 UTC
Created attachment 114099 [details] [review]
Bug 26797: Escape firstname to prevent relative's checkouts to crash

If no firstname is defined for a relative, the "Relative's checkouts"
tab will be "processing" forever.
JS error:
  TypeError: oObj.borrower.firstname is null

Test plan:
Patron A is Org and guarantor of patron B
Check an item out to B
Go to the details page of A, click "Relative's checkouts"

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 6 Victor Grousset/tuxayo 2020-12-12 14:32:56 UTC
I have an organization (school) with a guarantee that doesn't have a firstname. (empty string, also tested with a patron created without firstname)
But I don't have an error in the console and the table loads.
What is missing in my test plan?

https://picat.drycat.fr/aXxAy7eU.png

I even tried with a library being the guarantee of a school.
Comment 7 Nick Clemens 2021-01-08 19:07:25 UTC
Created attachment 114977 [details] [review]
Bug 26797: Escape firstname to prevent relative's checkouts to crash

If no firstname is defined for a relative, the "Relative's checkouts"
tab will be "processing" forever.
JS error:
  TypeError: oObj.borrower.firstname is null

Test plan:
1 - Create a patron (PatronA) in a category with type 'Org'
    'School' in sample data works
2 - Add a guarantee (Patron B)
3 - Check out an item to PatronA
4 - Go to PatronB's record and click relativwe's checkouts
5 - There is an error and the table doe snot load
6 - Apply patch
7 - Reload
8 - Table loads correctly

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 8 Nick Clemens 2021-01-08 19:08:06 UTC
(In reply to Victor Grousset/tuxayo from comment #6)
> I have an organization (school) with a guarantee that doesn't have a
> firstname. (empty string, also tested with a patron created without
> firstname)
> But I don't have an error in the console and the table loads.
> What is missing in my test plan?
> 
> https://picat.drycat.fr/aXxAy7eU.png
> 
> I even tried with a library being the guarantee of a school.

The patch was correct, the test plan was wrong - the guarantee could not load the checkouts for the guarantor
Comment 9 Jonathan Druart 2021-01-11 09:30:06 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 10 Fridolin Somers 2021-01-11 13:01:15 UTC
Pushed to 20.11.x for 20.11.02
Comment 11 Andrew Fuerste-Henry 2021-01-20 01:09:15 UTC
This doesn't fix the issue for me in 20.05. Patch applies fine, but I get this error when trying to see the Org's checkoouts in the prof's record:

checkouts_20.0507002.js:785 Uncaught TypeError: Cannot read property 'escapeHtml' of null
    at mDataProp (checkouts_20.0507002.js:785)
    at datatables.min_20.0507002.js:57
    at Object.b.fnGetData (datatables.min_20.0507002.js:51)
    at B (datatables.min_20.0507002.js:56)
    at Ha (datatables.min_20.0507002.js:64)
    at O (datatables.min_20.0507002.js:55)
    at datatables.min_20.0507002.js:88
    at i (datatables.min_20.0507002.js:74)
    at Object.success (checkouts_20.0507002.js:802)
    at i (jquery-2.2.3.min_20.0507002.js:2)

Jonathan, any ideas?
Comment 12 Jonathan Druart 2021-01-20 08:31:25 UTC
Andrew, it looks like a cache issue, can you confirm the cache has been correctly flushed?