Bug 23905

Summary: Button "Search to add" doesn't work on Quick add new patron
Product: Koha Reporter: Michal Denar <black23>
Component: PatronsAssignee: Kyle M Hall <kyle>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: black23, gmcharlt, jonathan.druart, katrin.fischer, kyle.m.hall, kyle, martin.renvoize
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00
Bug Depends on: 14570, 23778    
Bug Blocks:    
Attachments: Bug 23905: Button "Search to add" doesn't work on Quick add new patron
Bug 23905: Button "Search to add" doesn't work on Quick add new patron
Bug 23905: Button "Search to add" doesn't work on Quick add new patron
Bug 23905: Button "Search to add" doesn't work on Quick add new patron
Bug 23905: Button "Search to add" doesn't work on Quick add new patron
Bug 23905: Remove extra closing span
Bug 23905: Button "Search to add" doesn't work on Quick add new patron
Bug 23905: Remove extra closing span

Description Michal Denar 2019-10-27 13:53:07 UTC
In current master button "Search to add" in Quick add ne patron page don't open search window.
Comment 1 Katrin Fischer 2019-11-24 13:27:09 UTC
Tested and confirmed on master - you can no longer add guarantors from the quick add form.
Comment 2 Jonathan Druart 2019-11-25 15:22:38 UTC
I think it has been caused by
  commit bc9871f428af323901ebe57a6d0888f1dcf871cf
  Bug 23778: Regression: Guarantor entry section no longer has a unique id
Comment 3 Jonathan Druart 2019-11-25 15:29:27 UTC
But I think it's also broken since bug 14570.

This must be fixed for 19.11.
Comment 4 Kyle M Hall 2019-11-25 16:51:00 UTC
Created attachment 95798 [details] [review]
Bug 23905: Button "Search to add" doesn't work on Quick add new patron
Comment 5 Kyle M Hall 2019-11-25 16:53:03 UTC
This fixes the popup not showing, but after selecting a patron, the info is not added to the page.

the line:
$('#guarantor_relationships').append( fieldset );
simply does nothing. If you add it to something outside of #guarantor_relationships such as 'body' or '#quick_add_form' it shows up! I'm not sure why it refused to append to '#guarantor_relationships'.
Comment 6 Kyle M Hall 2019-11-25 16:53:38 UTC
I have a hunch that it has to do with these elements not existing at the time the page is loaded. These elements are created dynamically via javascript, right?
Comment 7 Kyle M Hall 2019-11-25 16:54:40 UTC
In addition, I just realized the guarantor 'template' is visible on the quick add form, but should not be.
Comment 8 Katrin Fischer 2019-11-25 17:02:27 UTC
(In reply to Kyle M Hall from comment #7)
> In addition, I just realized the guarantor 'template' is visible on the
> quick add form, but should not be.

Are we sure about that? I was wondering too, but there is a note referring quick add and guarantor:

Note: Quick add guarantor form populates address fields in full form
Comment 9 Kyle M Hall 2019-11-25 17:33:56 UTC
Created attachment 95800 [details] [review]
Bug 23905: Button "Search to add" doesn't work on Quick add new patron
Comment 10 Kyle M Hall 2019-11-25 17:50:51 UTC
Created attachment 95803 [details] [review]
Bug 23905: Button "Search to add" doesn't work on Quick add new patron

This issue is caused by duplicating the patron guarantor fieldset.
The solution is to move it between the two forms insetad.
In addition, this patch moves the guarantor information fieldset to the area below the "Quick add" fieldset, instead of *inside* it. This change preserves the correct styling and layout of the Guarantor information fieldset whilst it is moved back and forth by the "quick add"/"full form" toggle.

Test Plan:
1) Quick add a child patron
2) Attempt to use the "Search to add" button
3) Note it does nothing
4) Apply this patch
5) Repeat steps 1 and 2
6) It works now!
7) Test toggling between the quick add and full form views,
   note the "Guarantor information" fieldset shows correctly
   in the full form view.
Comment 11 Kyle M Hall 2019-11-25 18:01:51 UTC
Created attachment 95804 [details] [review]
Bug 23905: Button "Search to add" doesn't work on Quick add new patron

This issue is caused by duplicating the patron guarantor fieldset.
The solution is to move it between the two forms insetad.
In addition, this patch moves the guarantor information fieldset to the area below the "Quick add" fieldset, instead of *inside* it. This change preserves the correct styling and layout of the Guarantor information fieldset whilst it is moved back and forth by the "quick add"/"full form" toggle.

Test Plan:
1) Quick add a child patron
2) Attempt to use the "Search to add" button
3) Note it does nothing
4) Apply this patch
5) Repeat steps 1 and 2
6) It works now!
7) Test toggling between the quick add and full form views,
   note the "Guarantor information" fieldset shows correctly
   in the full form view.
Comment 12 Jonathan Druart 2019-11-26 09:32:30 UTC
Created attachment 95812 [details] [review]
Bug 23905: Button "Search to add" doesn't work on Quick add new patron

This issue is caused by duplicating the patron guarantor fieldset.
The solution is to move it between the two forms insetad.
In addition, this patch moves the guarantor information fieldset to the area below the "Quick add" fieldset, instead of *inside* it. This change preserves the correct styling and layout of the Guarantor information fieldset whilst it is moved back and forth by the "quick add"/"full form" toggle.

Test Plan:
1) Quick add a child patron
2) Attempt to use the "Search to add" button
3) Note it does nothing
4) Apply this patch
5) Repeat steps 1 and 2
6) It works now!
7) Test toggling between the quick add and full form views,
   note the "Guarantor information" fieldset shows correctly
   in the full form view.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 13 Jonathan Druart 2019-11-26 09:32:34 UTC
Created attachment 95813 [details] [review]
Bug 23905: Remove extra closing span

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 14 Martin Renvoize 2019-11-26 11:16:28 UTC
Created attachment 95818 [details] [review]
Bug 23905: Button "Search to add" doesn't work on Quick add new patron

This issue is caused by duplicating the patron guarantor fieldset.
The solution is to move it between the two forms insetad.
In addition, this patch moves the guarantor information fieldset to the area below the "Quick add" fieldset, instead of *inside* it. This change preserves the correct styling and layout of the Guarantor information fieldset whilst it is moved back and forth by the "quick add"/"full form" toggle.

Test Plan:
1) Quick add a child patron
2) Attempt to use the "Search to add" button
3) Note it does nothing
4) Apply this patch
5) Repeat steps 1 and 2
6) It works now!
7) Test toggling between the quick add and full form views,
   note the "Guarantor information" fieldset shows correctly
   in the full form view.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 15 Martin Renvoize 2019-11-26 11:16:32 UTC
Created attachment 95819 [details] [review]
Bug 23905: Remove extra closing span

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 16 Martin Renvoize 2019-11-26 11:16:54 UTC
Looks good to me, thanks guys.. PQA and Pushing.
Comment 17 Martin Renvoize 2019-11-26 11:17:15 UTC
Nice work!

Pushed to master for 19.11.00