Bugzilla – Attachment 161513 Details for
Bug 26597
Transfer information from guarantor when adding a guarantor to an existing patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26597: (Fix) remove REST API call and retrieve the patron's data from borrower_data input
Bug-26597-Fix-remove-REST-API-call-and-retrieve-th.patch (text/plain), 4.44 KB, created by
Kyle M Hall (khall)
on 2024-01-26 12:05:26 UTC
(
hide
)
Description:
Bug 26597: (Fix) remove REST API call and retrieve the patron's data from borrower_data input
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-01-26 12:05:26 UTC
Size:
4.44 KB
patch
obsolete
>From 826bd44b53a731a2768bad0cdefa4e6502cb1b76 Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Tue, 30 May 2023 21:41:14 +0000 >Subject: [PATCH] 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> >--- > .../prog/en/modules/members/memberentrygen.tt | 6 ++--- > koha-tmpl/intranet-tmpl/prog/js/members.js | 26 +++++-------------- > members/memberentry.pl | 2 +- > 3 files changed, 11 insertions(+), 23 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 02b67b36e24..ea1a218623d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1968,10 +1968,10 @@ legend:hover { > }); > [% END %] > $("#guarantor_template").hide(); >- var guarantor_attributes; >+ var prefill_fields; > var to_api_mapping; >- [% IF guarantor_attributes %] >- guarantor_attributes = [% To.json(guarantor_attributes) %]; >+ [% IF prefill_fields %] >+ prefill_fields = [% To.json(prefill_fields)%]; > [% END %] > [% IF to_api_mapping %] > to_api_mapping = [% To.json(to_api_mapping) %]; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index ca4daaf287e..576353400c9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -122,26 +122,14 @@ function select_user(borrowernumber, borrower, relationship) { > fieldset.find('.new_guarantor_relationship').val(relationship); > } > >- if(guarantor_attributes && to_api_mapping) { >- $('#saverecord').prop('disabled', true); >- $.ajax({ >- url: '/api/v1/patrons/'+borrowernumber, >- method: "GET", >- dataType: 'json', >- success: function(data){ >- for (let i = 0; i < parseInt(guarantor_attributes.length, 10); i++) { >- let attribute = guarantor_attributes[i]; >- let key_data = to_api_mapping[attribute] || attribute; >- if(data[key_data] != null && attribute in document.forms.entryform && document.forms.entryform[attribute].value == ""){ >- document.forms.entryform[attribute].value = data[key_data]; >- } >- } >- $('#saverecord').prop('disabled', false); >- }, >- error:function(){ >- $('#saverecord').prop('disabled', false); >+ if ( prefill_fields && to_api_mapping) { >+ for (let i = 0; i < parseInt(prefill_fields.length, 10); i++) { >+ let field_name = prefill_fields[i]; >+ let attribute = to_api_mapping[field_name] || field_name; >+ if ( borrower[attribute] != null && document.forms.entryform[field_name] && document.forms.entryform[field_name].value == "" ) { >+ document.forms.entryform[field_name].value = borrower[attribute]; > } >- }); >+ } > } > } > >diff --git a/members/memberentry.pl b/members/memberentry.pl >index cfebe7a6d18..62abd3a03cf 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -626,7 +626,7 @@ if (C4::Context->preference("IndependentBranches")) { > my $prefillguarantorfields=C4::Context->preference("PrefillGuaranteeField"); > my @prefill_fields=split(/\,/,$prefillguarantorfields); > $template->param( >- guarantor_attributes => \@prefill_fields, >+ prefill_fields => \@prefill_fields, > to_api_mapping => Koha::Patron->new->to_api_mapping > ); > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26597
:
111054
|
111319
|
112196
|
142443
|
144475
|
144560
|
148564
|
148597
|
148598
|
148599
|
151850
|
151851
|
151878
|
154501
|
154503
|
154504
|
154505
|
154506
|
158119
|
158300
|
161510
|
161511
|
161512
| 161513 |
161514
|
161515
|
161516