Bug 33504

Summary: ILS-DI does not record renewer_id for renewals creating issue with renewal history view
Product: Koha Reporter: Martin Renvoize (ashimema) <martin.renvoize>
Component: Web servicesAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: RESOLVED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: major    
Priority: P5 - low CC: arthur.suzuki, david, janet.mcgowan, lucas, matt.blenkinsop
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.06,22.05.13
Circulation function:
Attachments: Bug 33504: Update patron_to_html to deal with null
Bug 33504: Update patron_to_html to deal with null
Bug 33504: Update patron_to_html to deal with null

Description Martin Renvoize (ashimema) 2023-04-12 10:09:37 UTC
With the introduction on new code around renewals, we updated the REST API and other renewal avenues, but neglected ILD-DI
Comment 1 Martin Renvoize (ashimema) 2023-04-12 10:19:41 UTC
Oh.. I'm wrong.. it's not that we don't handle it.... it's that we somehow don't have a userenv for ils-di sessions if I'm not mistaken?
Comment 2 Martin Renvoize (ashimema) 2023-04-12 10:37:04 UTC
The symptom here is that the renewal history modal fails to load as the renewer_id isn't set for ils-di renewals.
Comment 3 Martin Renvoize (ashimema) 2023-04-12 10:51:55 UTC Comment hidden (obsolete)
Comment 4 Martin Renvoize (ashimema) 2023-04-12 10:54:05 UTC
This fixes the symptom, not the cause.

To test.
1) Use ILS-DI to renew an checkout
2) View the circulation history for the item
3) Click the 'View' button next to the count of renewals
4) Note that the modal just stalls at 'Retrieving renewals'
5) Apply the patch
6) Now the 'retrieving renewals' message should list the renewals instead.
Comment 5 Magnus Enger 2023-04-25 11:00:59 UTC
Created attachment 150184 [details] [review]
Bug 33504: Update patron_to_html to deal with null

In the patron_to_html function we were dealing explicitly with the case
where patron may be passed undefined, but forgetting that it may be
returned as 'null' from the api too.  Changing from `( patron ===
undefined )` to `( patron == null )` is the recommended approach for
detecting 'undefined or null' in javascript.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised. Martin's test plan from Bugzilla:

To test.
1) Use ILS-DI to renew an checkout
2) View the circulation history for the item
3) Click the 'View' button next to the count of renewals
4) Note that the modal just stalls at 'Retrieving renewals'
5) Apply the patch
6) Now the 'retrieving renewals' message should list the renewals instead.

Note that step 2 should be something like "Go to the "Circulation
history" of the patron.

https://bugs.koha-community.org/show_bug.cgi?id=22504
Comment 6 David Nind 2023-04-29 19:30:15 UTC
Hi Magnus

You may wish to change the status to signed off. 8-)

And maybe remove the Bugzilla link at the end.

David
Comment 7 Katrin Fischer 2023-05-01 12:51:03 UTC
Created attachment 150451 [details] [review]
Bug 33504: Update patron_to_html to deal with null

In the patron_to_html function we were dealing explicitly with the case
where patron may be passed undefined, but forgetting that it may be
returned as 'null' from the api too.  Changing from `( patron ===
undefined )` to `( patron == null )` is the recommended approach for
detecting 'undefined or null' in javascript.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised. Martin's test plan from Bugzilla:

To test.
1) Use ILS-DI to renew an checkout
2) View the circulation history for the item
3) Click the 'View' button next to the count of renewals
4) Note that the modal just stalls at 'Retrieving renewals'
5) Apply the patch
6) Now the 'retrieving renewals' message should list the renewals instead.

Note that step 2 should be something like "Go to the "Circulation
history" of the patron.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Tomás Cohen Arazi (tcohen) 2023-05-05 12:17:39 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 9 Martin Renvoize (ashimema) 2023-05-11 11:08:13 UTC
Many hands makes light work, thankyou everyone!

Pushed to 22.11.x for the next release
Comment 10 Lucas Gass (lukeg) 2023-05-15 22:08:40 UTC
Backported to 22.05.x for upcoming 22.05.13