Bug 24769

Summary: DataTable error on patron hold page when hold placed (ILS-DI and other bugs)
Product: Koha Reporter: David Nind <david>
Component: Web servicesAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: major    
Priority: P5 - low CC: 1joynelson, arthur.suzuki, jonathan.druart, katrin.fischer, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes a problem introduced by another patch in this release cycle. The patron's hold page now correctly lists holds where holds are placed using ILS-DI (and in some other situations).
Version(s) released in:
20.05.00
Bug Depends on: 14711    
Bug Blocks:    
Attachments: Screenshots - DataTable error on patron hold page when hold placed using ILS-DI
Bug 24769: (bug 14711 follow-up) Fix typo in parameter name for AddReserve
Bug 24769: (bug 14711 follow-up) Fix typo in parameter name for AddReserve
Bug 24769: (bug 14711 follow-up 2) Fix typo in parameter name for AddReserve
Bug 24769: (bug 14711 follow-up) Fix typo in parameter name for AddReserve
Bug 24769: (bug 14711 follow-up 2) Fix typo in parameter name for AddReserve
Bug 24769: Regression tests
Bug 24769: (bug 14711 follow-up) Fix typo in parameter name for AddReserve
Bug 24769: (bug 14711 follow-up 2) Fix typo in parameter name for AddReserve
Better tests...

Description David Nind 2020-02-29 19:54:49 UTC
Created attachment 99820 [details]
Screenshots - DataTable error on patron hold page when hold placed using ILS-DI

After placing a hold for a patron using ILS-DI an error occurs on the staff interface. 

After the hold is placed used ILS-DI, when clicking on the holds tab on a patron's details page:
- an error message pops up; and
- it no longer lists any holds.

To replicate:
1) Place a hold for a patron.
2) Check the patron's details page and holds tab, the hold is listed.
3) Enable the ILS-DI system preference.
4) Use ILS-DI to place a hold for a patron, for example:
   http://127.0.0.1:8080/cgi-bin/koha/ilsdi.pl?service=HoldTitle&patron_id=19&bib_id=12&request_location='27.0.0.1'
   (where: 19 = a patron id and bib_id = 12 a bibliographical record)
5) On the staff client go to Patrons > [Patron hold placed for] > Details > Holds tab.
6) An error is displayed in a pop-up window:
 DataTables warning: table id=holds-table - Ajax error. For more information about this error, please see http://datatables.net/tn/7
7) After clicking on OK for the error message, the holds tab no longer lists any holds - even though 2 should be listed.

This occurs on master, but doesn't occur on 19.11.x

It was discovered when testing bug 17229.

See the attached screenshots.
Comment 1 David Nind 2020-03-01 03:54:41 UTC
Error also showed up when testing bug 23531
Comment 2 David Nind 2020-03-03 09:38:25 UTC
Error also happening on bug 22806 before patch applied.
Comment 3 David Nind 2020-03-03 18:22:05 UTC
Error also happening on bug 11999 before patch applied.
Comment 4 David Nind 2020-04-22 09:16:25 UTC
Error also occurring after applying the patches for bug 24718 

That is not an ILS-DI related bug, so seems wider. 

Will change title to reflect this.
Comment 5 David Nind 2020-04-23 10:17:06 UTC
(In reply to David Nind from comment #4)
> Error also occurring after applying the patches for bug 24718 
> 
> That is not an ILS-DI related bug, so seems wider. 
> 
> Will change title to reflect this.

Aleisha solved resolved this with a follow-up patch to resolve the JavaScript error, but it still exists for holds placed using ILS-DI.
Comment 6 Jonathan Druart 2020-04-24 09:25:29 UTC
Caused by
  commit 11b44869d95c47a7e6daec8dcb124762a9ee0026
  Bug 14711: Change prototype for AddReserve - pass a hashref
Comment 7 Jonathan Druart 2020-04-24 09:27:05 UTC
Created attachment 103636 [details] [review]
Bug 24769: (bug 14711 follow-up) Fix typo in parameter name for AddReserve

The parameter is branchcode, not branch.

Test plan:
Place a hold on a biblio using ILSDI
Check that the branchcode is correctly filled with the patron's library
Comment 8 Jonathan Druart 2020-04-24 09:28:21 UTC
Created attachment 103637 [details] [review]
Bug 24769: (bug 14711 follow-up) Fix typo in parameter name for AddReserve

The parameter is branchcode, not branch.

Test plan:
Place a hold on a biblio using ILSDI
Check that the branchcode is correctly filled with the patron's library
Comment 9 Jonathan Druart 2020-04-24 09:32:36 UTC
Created attachment 103638 [details] [review]
Bug 24769: (bug 14711 follow-up 2) Fix typo in parameter name for AddReserve

This patch fixes 2 other occurrences. The first one is in POD of
AddReserve, the other one fixes SIP code
Comment 10 David Nind 2020-04-24 10:50:23 UTC
Created attachment 103643 [details] [review]
Bug 24769: (bug 14711 follow-up) Fix typo in parameter name for AddReserve

The parameter is branchcode, not branch.

Test plan:
Place a hold on a biblio using ILSDI
Check that the branchcode is correctly filled with the patron's library

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 David Nind 2020-04-24 10:50:28 UTC
Created attachment 103644 [details] [review]
Bug 24769: (bug 14711 follow-up 2) Fix typo in parameter name for AddReserve

This patch fixes 2 other occurrences. The first one is in POD of
AddReserve, the other one fixes SIP code

Signed-off-by: David Nind <david@davidnind.com>
Comment 12 David Nind 2020-04-24 10:53:53 UTC
Thanks Jonathan for writing the patches to fix this!

This is the test plan I used:
1) Place a hold for a patron.
2) Check the patron's details page and holds tab, the hold is listed.
3) Enable the ILS-DI system preference (ILS-DI).
4) Use ILS-DI to place a hold for a patron, for example:
   http://127.0.0.1:8080/cgi-bin/koha/ilsdi.pl?service=HoldTitle&patron_id=19&bib_id=12&request_location='127.0.0.1'
   (where: 19 = a patron id and bib_id = 12 a bibliographical record)
5) On the staff client go to Patrons > [Patron hold placed for] > Details > Holds tab.
6) An error is displayed in a pop-up window:
 DataTables warning: table id=holds-table - Ajax error. For more information about this error, please see http://datatables.net/tn/7
7) After clicking on OK for the error message, the holds tab no longer lists any holds - even though 2 should be listed.
8) Go to the holds history for the patron and note that the Library for the hold placed using ILS-DI is blank.
9) Go to the bibliographical record and then holds - click update hold(s). Go to the patron's details page and click on the holds tab - this now displays correctly.
10) Apply the patch.
11) Repeat steps 4-5 (place a hold for another item).
12) The list of holds for the patron should display as expected with no errors.
13) Sign-off!
Comment 13 Tomás Cohen Arazi 2020-05-04 14:45:26 UTC
Created attachment 104296 [details] [review]
Bug 24769: Regression tests

When regressions are found, we introduce regression tests :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 14 Tomás Cohen Arazi 2020-05-04 14:45:33 UTC
Created attachment 104297 [details] [review]
Bug 24769: (bug 14711 follow-up) Fix typo in parameter name for AddReserve

The parameter is branchcode, not branch.

Test plan:
Place a hold on a biblio using ILSDI
Check that the branchcode is correctly filled with the patron's library

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 15 Tomás Cohen Arazi 2020-05-04 14:45:41 UTC
Created attachment 104298 [details] [review]
Bug 24769: (bug 14711 follow-up 2) Fix typo in parameter name for AddReserve

This patch fixes 2 other occurrences. The first one is in POD of
AddReserve, the other one fixes SIP code

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 16 Tomás Cohen Arazi 2020-05-04 14:54:03 UTC
Created attachment 104300 [details] [review]
Better tests...
Comment 17 Martin Renvoize 2020-05-05 10:04:28 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 18 Joy Nelson 2020-05-11 21:18:41 UTC
not backported to 19.11.x