Lines 122-137
function select_user(borrowernumber, borrower, relationship) {
Link Here
|
122 |
fieldset.find('.new_guarantor_relationship').val(relationship); |
122 |
fieldset.find('.new_guarantor_relationship').val(relationship); |
123 |
} |
123 |
} |
124 |
|
124 |
|
125 |
if(typeof guarantor_attributes !== 'undefined') { |
125 |
if(typeof guarantor_attributes !== 'undefined' && to_api_mapping) { |
126 |
$.ajax({ |
126 |
$.ajax({ |
127 |
url: '/api/v1/patrons/'+borrowernumber, |
127 |
url: '/api/v1/patrons/'+borrowernumber, |
128 |
method: "GET", |
128 |
method: "GET", |
129 |
dataType: 'json', |
129 |
dataType: 'json', |
130 |
success: function(data){ |
130 |
success: function(data){ |
131 |
for (var i = 0; i < parseInt(guarantor_attributes.length, 10); i++) { |
131 |
for (let i = 0; i < parseInt(guarantor_attributes.length, 10); i++) { |
132 |
var attribute = guarantor_attributes[i]; |
132 |
let attribute = guarantor_attributes[i]; |
133 |
if ( data[attribute] != null && document.forms.entryform[attribute].value == "" ) { |
133 |
let key_data = to_api_mapping[attribute] || attribute; |
134 |
document.forms.entryform[attribute].value = data[attribute]; |
134 |
if(data[key_data] != null && attribute in document.forms.entryform && document.forms.entryform[attribute].value == ""){ |
|
|
135 |
document.forms.entryform[attribute].value = data[key_data]; |
135 |
} |
136 |
} |
136 |
} |
137 |
} |
137 |
} |
138 |
} |