View | Details | Raw Unified | Return to bug 26597
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+3 lines)
Lines 1932-1937 legend:hover { Link Here
1932
        [% IF guarantor_attributes %]
1932
        [% IF guarantor_attributes %]
1933
            guarantor_attributes = [% To.json(guarantor_attributes) %];
1933
            guarantor_attributes = [% To.json(guarantor_attributes) %];
1934
        [% END %]
1934
        [% END %]
1935
        [% IF to_api_mapping %]
1936
            to_api_mapping = [% To.json(to_api_mapping) %];
1937
        [% END %]
1935
1938
1936
        var TalkingTechItivaPhoneNotification = [% Koha.Preference('TalkingTechItivaPhoneNotification') || 0 | html %];
1939
        var TalkingTechItivaPhoneNotification = [% Koha.Preference('TalkingTechItivaPhoneNotification') || 0 | html %];
1937
        var PhoneNotification = [% Koha.Preference('PhoneNotification') || 0 | html %];
1940
        var PhoneNotification = [% Koha.Preference('PhoneNotification') || 0 | html %];
(-)a/koha-tmpl/intranet-tmpl/prog/js/members.js (-5 / +6 lines)
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
                }
(-)a/members/memberentry.pl (-2 / +4 lines)
Lines 597-603 if (C4::Context->preference("IndependentBranches")) { Link Here
597
# Define the fields to be pre-filled in guarantee records
597
# Define the fields to be pre-filled in guarantee records
598
my $prefillguarantorfields=C4::Context->preference("PrefillGuaranteeField");
598
my $prefillguarantorfields=C4::Context->preference("PrefillGuaranteeField");
599
my @prefill_fields=split(/\,/,$prefillguarantorfields);
599
my @prefill_fields=split(/\,/,$prefillguarantorfields);
600
$template->param( guarantor_attributes => \@prefill_fields );
600
$template->param(
601
    guarantor_attributes => \@prefill_fields,
602
    to_api_mapping => Koha::Patron->new->to_api_mapping
603
 );
601
604
602
if ($op eq 'add'){
605
if ($op eq 'add'){
603
    if ($guarantor_id) {
606
    if ($guarantor_id) {
604
- 

Return to bug 26597