Bug 26597 - Transfer information from guarantor when adding a guarantor to an existing patron
Summary: Transfer information from guarantor when adding a guarantor to an existing pa...
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Hammat wele
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-02 04:14 UTC by Maryse Simard
Modified: 2024-01-26 12:05 UTC (History)
13 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron (9.68 KB, patch)
2020-10-02 04:22 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron (9.77 KB, patch)
2020-10-06 19:12 UTC, David Nind
Details | Diff | Splinter Review
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron (9.80 KB, patch)
2020-10-22 13:41 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron (37.56 KB, patch)
2022-10-21 20:04 UTC, geraud.frappier
Details | Diff | Splinter Review
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron (3.47 KB, patch)
2022-12-07 16:52 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 26597: Fixing the populate of fields when using the REST API route (3.54 KB, patch)
2022-12-13 22:28 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 26597: (follow-up) Add disabling / enabled the save button while waiting from api to respond (2.76 KB, patch)
2023-03-22 15:49 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron (3.69 KB, patch)
2023-03-23 10:21 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 26597: Fixing the populate of fields when using the REST API route (3.76 KB, patch)
2023-03-23 10:21 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 26597: (follow-up) Add disabling / enabled the save button while waiting from api to respond (2.82 KB, patch)
2023-03-23 10:21 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 26597: (Fix) remove REST API call and retrieve the patron's data from borrower_data input (4.32 KB, patch)
2023-05-30 22:10 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 26597: (QA follow-up) Remane select_user and add missing filters (3.06 KB, patch)
2023-05-30 22:10 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 26597: (QA follow-up) Add missing filters (1.23 KB, patch)
2023-05-31 13:19 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron (3.75 KB, patch)
2023-08-17 08:58 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 26597: Fixing the populate of fields when using the REST API route (3.82 KB, patch)
2023-08-17 08:59 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 26597: (follow-up) Add disabling / enabled the save button while waiting from api to respond (2.89 KB, patch)
2023-08-17 09:00 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 26597: (Fix) remove REST API call and retrieve the patron's data from borrower_data input (4.39 KB, patch)
2023-08-17 09:00 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 26597: (QA follow-up) Add missing filters (1.30 KB, patch)
2023-08-17 09:01 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 26597: Update the description of the PrefillGuaranteeField system preference (1.45 KB, patch)
2023-10-31 13:23 UTC, Emily-Rose Francoeur
Details | Diff | Splinter Review
Bug 26597: Update the description of the PrefillGuaranteeField system preference (1.51 KB, patch)
2023-11-03 07:34 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron (3.81 KB, patch)
2024-01-26 12:05 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 26597: Fixing the populate of fields when using the REST API route (3.87 KB, patch)
2024-01-26 12:05 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 26597: (follow-up) Add disabling / enabled the save button while waiting from api to respond (2.94 KB, patch)
2024-01-26 12:05 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 26597: (Fix) remove REST API call and retrieve the patron's data from borrower_data input (4.44 KB, patch)
2024-01-26 12:05 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 26597: (QA follow-up) Add missing filters (1.35 KB, patch)
2024-01-26 12:05 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 26597: Update the description of the PrefillGuaranteeField system preference (1.56 KB, patch)
2024-01-26 12:05 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 26597: (QA follow-up) Tidy code (1.09 KB, patch)
2024-01-26 12:05 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Maryse Simard 2020-10-02 04:14:41 UTC
When creating a new guarantee from the guarantor, the preference PrefillGuaranteeField dictates some fields to be transfered from guarantor to guarantee. We want to transfer those informations also when adding a new guarantor relationship to an existing patron.

Note: This was first introduced as part of Bug 12446, but ultimately was split into it's own bug.
Comment 1 Maryse Simard 2020-10-02 04:22:29 UTC
Created attachment 111054 [details] [review]
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron

When creating a new guarantee from the guarantor, the preference PrefillGuaranteeField dictates some fields to be transfered from guarantor to guarantee. This patch makes it so those informations are also transfered when adding a new guarantor relationship to an existing patron.

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click "Select"
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten
Comment 2 David Nind 2020-10-06 19:12:33 UTC
Created attachment 111319 [details] [review]
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron

When creating a new guarantee from the guarantor, the preference PrefillGuaranteeField dictates some fields to be transfered from guarantor to guarantee. This patch makes it so those informations are also transfered when adding a new guarantor relationship to an existing patron.

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click "Select"
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Kyle M Hall 2020-10-22 13:41:31 UTC
Created attachment 112196 [details] [review]
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron

When creating a new guarantee from the guarantor, the preference PrefillGuaranteeField dictates some fields to be transfered from guarantor to guarantee. This patch makes it so those informations are also transfered when adding a new guarantor relationship to an existing patron.

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click "Select"
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Kyle M Hall 2020-10-22 13:43:24 UTC
RM Note: We might possibly want a way to *not* transfer info to existing patrons when guaranteeing them ( possibly another syspref, or a checkbox when adding a guarantor ). The feature does leave existing fields untouched. I will leave that decision to the RM.
Comment 5 Jonathan Druart 2020-11-04 08:31:24 UTC
I have the feeling that the path you chose is way too complicated for what you tried to implement.

The "PrefillGuaranteeField" notion should not appear in the DT patron search module (C4:Utils::DataTables::Members).

A more elegant implementation would be to retrieve the patron's data using the REST API route and keep the logic of "prefilling" JS-side.

What do you think?
Comment 6 Caroline Cyr La Rose 2020-12-09 16:29:08 UTC
What can we do to take this out of the "In Discussion" limbo? It was already signed off twice.
Comment 7 Jonathan Druart 2020-12-10 08:22:15 UTC
(In reply to Caroline Cyr La Rose from comment #6)
> What can we do to take this out of the "In Discussion" limbo? It was already
> signed off twice.

An answer to my comment? :)
Comment 8 Caroline Cyr La Rose 2020-12-10 13:00:22 UTC
Your comment is to redo the patch completely. I was asking because it was already signed off and PQA as it is.
Comment 9 Caroline Cyr La Rose 2020-12-10 13:00:55 UTC
Sorry, not PQA, I was mistaking it for another one
Comment 10 geraud.frappier 2022-10-21 20:04:52 UTC
Created attachment 142443 [details] [review]
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron

When creating a new guarantee from the guarantor, the preference PrefillGuaranteeField dictates some fields to be transfered from guarantor to guarantee. This patch makes it so those informations are also transfered when adding a new guarantor relationship to an existing patron.

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click "Select"
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 11 Hammat wele 2022-12-07 16:52:38 UTC
Created attachment 144475 [details] [review]
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron

When creating a new guarantee from the guarantor, the preference PrefillGuaranteeField dictates some fields to be transfered from guarantor to guarantee. This patch makes it so those informations are also transfered when adding a new guarantor relationship to an existing patron.

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on 'Search to add' in 'Patron guarantor' fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click 'Select'
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten
Comment 12 Lucas Gass 2022-12-12 23:14:17 UTC
For me this is not working. In PrefillGuaranteeField I am adding every Alternate address field. 

Then I make sure my gaurantor has each of those fields filled out. 

If I then "Add gaurantee" the normal way it works. 


But when I go into the Guarantee record, search for a gaurantor , and add them. None of the fields are populated.
Comment 13 Hammat wele 2022-12-13 22:28:23 UTC
Created attachment 144560 [details] [review]
Bug 26597: Fixing the populate of fields when using the REST API route

This attachment correct the populate of fields by using the api mapping.
Now All fields are populated following the selected PrefillGuaranteeField options
Comment 14 Laura Escamilla 2023-03-06 13:19:45 UTC
For me this is not working either. In PrefillGuaranteeField I am adding every Alternate address field. When I search for a guarantor, and then add them to the guarantee, the fields do not populate.
Comment 15 Hammat wele 2023-03-22 15:49:46 UTC
Created attachment 148564 [details] [review]
Bug 26597: (follow-up) Add disabling / enabled the save button while waiting from api to respond

I've updated the test plan since the REST API route takes a little time to respond

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click Select
7) Wait until save button is enabled
8) Confirm guarantee's information is filled from the guarantor's record
9) Check that any preexisting information is not overwritten
Comment 16 Hammat wele 2023-03-22 15:50:17 UTC
(In reply to Laura Escamilla from comment #14)
> For me this is not working either. In PrefillGuaranteeField I am adding
> every Alternate address field. When I search for a guarantor, and then add
> them to the guarantee, the fields do not populate.

Hi Laura, thank you for testing. I've updated the test plan since the guarantee's information take a little time to be filled
Comment 17 PTFS Europe Sandboxes 2023-03-23 10:21:23 UTC
Created attachment 148597 [details] [review]
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron

When creating a new guarantee from the guarantor, the preference PrefillGuaranteeField dictates some fields to be transfered from guarantor to guarantee. This patch makes it so those informations are also transfered when adding a new guarantor relationship to an existing patron.

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on 'Search to add' in 'Patron guarantor' fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click 'Select'
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 18 PTFS Europe Sandboxes 2023-03-23 10:21:26 UTC
Created attachment 148598 [details] [review]
Bug 26597: Fixing the populate of fields when using the REST API route

This attachment correct the populate of fields by using the api mapping.
Now All fields are populated following the selected PrefillGuaranteeField options

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 19 PTFS Europe Sandboxes 2023-03-23 10:21:29 UTC
Created attachment 148599 [details] [review]
Bug 26597: (follow-up) Add disabling / enabled the save button while waiting from api to respond

I've updated the test plan since the REST API route takes a little time to respond

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click Select
7) Wait until save button is enabled
8) Confirm guarantee's information is filled from the guarantor's record
9) Check that any preexisting information is not overwritten

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 20 Sally 2023-03-23 10:23:21 UTC
Works as described, thanks for the patch.
Comment 21 Marcel de Rooy 2023-04-28 07:59:35 UTC
Looking here
Comment 22 Marcel de Rooy 2023-04-28 08:58:08 UTC
 FAIL   koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
   FAIL   filters
                missing_filter at line 1921 (            guarantor_attributes = [% To.json(guarantor_attributes) %];)
                missing_filter at line 1924 (            to_api_mapping = [% To.json(to_api_mapping) %];)
Please fix.

+                error:function(){
+                    $('#saverecord').prop('disabled', false);
Shouldnt we do more than that ?

koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc:                select_user( borrowernumber, JSON.parse(borrower_data) );
koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc:        function select_user(borrowernumber, data) {
koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc:                    p.select_user(borrowernumber, data);
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt:            function select_user(borrowernumber, borrower) {
It seems that we are overloading this function name already. So no blocker for this report. Just noting. But might be a chance to rename in members.js? The name is quite obscure for copying guarantor information.

koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt:                    select_user( '[% g.patron.borrowernumber | html %]', [% To.json( g.patron.unblessed ) | $raw %], '[% g.relationship | html %]' );
koha-tmpl/intranet-tmpl/prog/js/members.js:function select_user(borrowernumber, borrower, relationship) {
            [% IF new_guarantors %]
                [% FOREACH g IN new_guarantors %]
                    select_user( '[% g.patron.borrowernumber | html %]', [% To.json( g.patron.unblessed ) | $raw %], '[% g.relationship | html %]' );
                [% END %]
            [% END %]
Please explain why whe should do an ajax GET in select_user when we pass the borrower unblessed hash to this function?
This does not look good.
Comment 23 Hammat wele 2023-05-30 22:10:52 UTC
Created attachment 151850 [details] [review]
Bug 26597: (Fix) remove REST API call and retrieve the patron's data from borrower_data input

This patch remove the REST API call in select_user function and retrieve the patron's data from borrower_data

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click Select
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten
Comment 24 Hammat wele 2023-05-30 22:10:57 UTC
Created attachment 151851 [details] [review]
Bug 26597: (QA follow-up) Remane select_user and add missing filters
Comment 25 Hammat wele 2023-05-30 22:18:56 UTC
(In reply to Marcel de Rooy from comment #22)
>  FAIL   koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
>    FAIL   filters
>                 missing_filter at line 1921 (           
> guarantor_attributes = [% To.json(guarantor_attributes) %];)
>                 missing_filter at line 1924 (            to_api_mapping = [%
> To.json(to_api_mapping) %];)
> Please fix.
Missing_filters added
 
> for this report. Just noting. But might be a chance to rename in members.js?
> The name is quite obscure for copying guarantor information.

I've rename the function to add_guarantor

> Please explain why whe should do an ajax GET in select_user when we pass the
> borrower unblessed hash to this function?
> This does not look good.

It was a suggestion in the comment 5 but you are right, there is no need to use the REST API to retrieve data from the guarantor since we can get it from the borrower hidden input, it is fixed in this patch.
Comment 26 Jonathan Druart 2023-05-31 06:42:53 UTC
(In reply to Hammat wele from comment #24)
> Created attachment 151851 [details] [review] [review]
> Bug 26597: (QA follow-up) Remane select_user and add missing filters

This is wrong. You are mixing different things.

select_user in patron-search.inc cannot be renamed, it's a generic function that is used in other places. If you rename it you are going to break other patron searches.
Comment 27 Jonathan Druart 2023-05-31 06:48:32 UTC
If you are removing the REST API fetch I don't see why you are still passing and using to_api_mapping.
Comment 28 Hammat wele 2023-05-31 12:51:16 UTC
(In reply to Jonathan Druart from comment #27)
> If you are removing the REST API fetch I don't see why you are still passing
> and using to_api_mapping.

With borrower, I get all the guarantor's data i need but it is not associated with the name of the fields of the form. the to_api_mapping allows me to retrieve the name of the fields to be filled.

the data received from borrower is like
{
...
   "altaddress_address": "addressvalue",
   "altaddress_address2": "address2value",
   "altaddress_city": "addressCityvalue",
   "altaddress_country": "addresscontryvalue",
   "altaddress_email": "email@example.com",
...
}

to be able to fill the form with these data i need to get the name of the fields to be filled in and the to_api_mapping help me to get it
{
B_address           => 'altaddress_address',
}
Comment 29 Hammat wele 2023-05-31 13:19:33 UTC
Created attachment 151878 [details] [review]
Bug 26597: (QA follow-up) Add missing filters
Comment 30 Emmi Takkinen 2023-08-17 08:58:59 UTC
Created attachment 154501 [details] [review]
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron

When creating a new guarantee from the guarantor, the preference PrefillGuaranteeField dictates some fields to be transfered from guarantor to guarantee. This patch makes it so those informations are also transfered when adding a new guarantor relationship to an existing patron.

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on 'Search to add' in 'Patron guarantor' fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click 'Select'
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Comment 31 Emmi Takkinen 2023-08-17 08:59:29 UTC
Created attachment 154503 [details] [review]
Bug 26597: Fixing the populate of fields when using the REST API route

This attachment correct the populate of fields by using the api mapping.
Now All fields are populated following the selected PrefillGuaranteeField options

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Comment 32 Emmi Takkinen 2023-08-17 09:00:05 UTC
Created attachment 154504 [details] [review]
Bug 26597: (follow-up) Add disabling / enabled the save button while waiting from api to respond

I've updated the test plan since the REST API route takes a little time to respond

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click Select
7) Wait until save button is enabled
8) Confirm guarantee's information is filled from the guarantor's record
9) Check that any preexisting information is not overwritten

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Comment 33 Emmi Takkinen 2023-08-17 09:00:34 UTC
Created attachment 154505 [details] [review]
Bug 26597: (Fix) remove REST API call and retrieve the patron's data from borrower_data input

This patch remove the REST API call in select_user function and retrieve the patron's data from borrower_data

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click Select
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Comment 34 Emmi Takkinen 2023-08-17 09:01:02 UTC
Created attachment 154506 [details] [review]
Bug 26597: (QA follow-up) Add missing filters

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Comment 35 Kyle M Hall 2023-10-13 13:34:13 UTC
This looks good but the system preference description ( and possibly the name ) needs to be updated to reflect that the information copying will now work in both directions.
Comment 36 Emily-Rose Francoeur 2023-10-31 13:23:03 UTC
Created attachment 158119 [details] [review]
Bug 26597: Update the description of the PrefillGuaranteeField system preference

I updated the system preference description so that we now know this option is working from both the guarantee and guarantor forms.
Comment 37 Emmi Takkinen 2023-11-03 07:34:10 UTC
Created attachment 158300 [details] [review]
Bug 26597: Update the description of the PrefillGuaranteeField system preference

I updated the system preference description so that we now know this option is working from both the guarantee and guarantor forms.

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Comment 38 Kyle M Hall 2024-01-26 12:05:14 UTC
Created attachment 161510 [details] [review]
Bug 26597: Transfer informations from guarantor when adding a guarantor to an existing patron

When creating a new guarantee from the guarantor, the preference PrefillGuaranteeField dictates some fields to be transfered from guarantor to guarantee. This patch makes it so those informations are also transfered when adding a new guarantor relationship to an existing patron.

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on 'Search to add' in 'Patron guarantor' fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click 'Select'
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 39 Kyle M Hall 2024-01-26 12:05:21 UTC
Created attachment 161511 [details] [review]
Bug 26597: Fixing the populate of fields when using the REST API route

This attachment correct the populate of fields by using the api mapping.
Now All fields are populated following the selected PrefillGuaranteeField options

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 40 Kyle M Hall 2024-01-26 12:05:24 UTC
Created attachment 161512 [details] [review]
Bug 26597: (follow-up) Add disabling / enabled the save button while waiting from api to respond

I've updated the test plan since the REST API route takes a little time to respond

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click Select
7) Wait until save button is enabled
8) Confirm guarantee's information is filled from the guarantor's record
9) Check that any preexisting information is not overwritten

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 41 Kyle M Hall 2024-01-26 12:05:26 UTC
Created attachment 161513 [details] [review]
Bug 26597: (Fix) remove REST API call and retrieve the patron's data from borrower_data input

This patch remove the REST API call in select_user function and retrieve the patron's data from borrower_data

To test:
1) Apply patch
2) Search PrefillGuaranteeField preference and make sure some fields are selected
3) Select a user that can have a guarantor
4) In the edit form, click on "Search to add" in "Patron guarantor" fieldset
5) Choose a patron who has at least one of the fields in 1) set
6) Click Select
7) Confirm guarantee's information is filled from the guarantor's record
8) Check that any preexisting information is not overwritten

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 42 Kyle M Hall 2024-01-26 12:05:29 UTC
Created attachment 161514 [details] [review]
Bug 26597: (QA follow-up) Add missing filters

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 43 Kyle M Hall 2024-01-26 12:05:32 UTC
Created attachment 161515 [details] [review]
Bug 26597: Update the description of the PrefillGuaranteeField system preference

I updated the system preference description so that we now know this option is working from both the guarantee and guarantor forms.

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 44 Kyle M Hall 2024-01-26 12:05:35 UTC
Created attachment 161516 [details] [review]
Bug 26597: (QA follow-up) Tidy code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>