Bugzilla – Attachment 144560 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: Fixing the populate of fields when using the REST API route
Bug-26597-Fixing-the-populate-of-fields-when-using.patch (text/plain), 3.54 KB, created by
Hammat wele
on 2022-12-13 22:28:23 UTC
(
hide
)
Description:
Bug 26597: Fixing the populate of fields when using the REST API route
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2022-12-13 22:28:23 UTC
Size:
3.54 KB
patch
obsolete
>From c7feae61c1171888d5d273141316882fc85daef7 Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Tue, 13 Dec 2022 22:27:29 +0000 >Subject: [PATCH] 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 >--- > .../prog/en/modules/members/memberentrygen.tt | 3 +++ > koha-tmpl/intranet-tmpl/prog/js/members.js | 11 ++++++----- > members/memberentry.pl | 5 ++++- > 3 files changed, 13 insertions(+), 6 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 660702dd0f..423256223e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1933,6 +1933,9 @@ legend:hover { > [% IF guarantor_attributes %] > guarantor_attributes = [% To.json(guarantor_attributes) %]; > [% END %] >+ [% IF to_api_mapping %] >+ to_api_mapping = [% To.json(to_api_mapping) %]; >+ [% END %] > > </script> > [% Asset.js("js/members.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index 9195d91ffd..fdd9c728c2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -122,16 +122,17 @@ function select_user(borrowernumber, borrower, relationship) { > fieldset.find('.new_guarantor_relationship').val(relationship); > } > >- if(typeof guarantor_attributes !== 'undefined') { >+ if(typeof guarantor_attributes !== 'undefined' && to_api_mapping) { > $.ajax({ > url: '/api/v1/patrons/'+borrowernumber, > method: "GET", > dataType: 'json', > success: function(data){ >- for (var i = 0; i < parseInt(guarantor_attributes.length, 10); i++) { >- var attribute = guarantor_attributes[i]; >- if ( data[attribute] != null && document.forms.entryform[attribute].value == "" ) { >- document.forms.entryform[attribute].value = data[attribute]; >+ 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]; > } > } > } >diff --git a/members/memberentry.pl b/members/memberentry.pl >index d072602747..c6e7ad6019 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -613,7 +613,10 @@ if (C4::Context->preference("IndependentBranches")) { > # Define the fields to be pre-filled in guarantee records > my $prefillguarantorfields=C4::Context->preference("PrefillGuaranteeField"); > my @prefill_fields=split(/\,/,$prefillguarantorfields); >-$template->param( guarantor_attributes => \@prefill_fields ); >+$template->param( >+ guarantor_attributes => \@prefill_fields, >+ to_api_mapping => Koha::Patron->new->to_api_mapping >+ ); > > if ($op eq 'add'){ > if ($guarantor_id) { >-- >2.34.1
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