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

(-)a/koha-tmpl/intranet-tmpl/prog/js/catalog.js (-19 / +15 lines)
Lines 124-143 $(document).ready(function() { Link Here
124
        })
124
        })
125
        .tooltip();
125
        .tooltip();
126
126
127
    $("#populate-callnumbers-biblio")
127
        $("#populate-callnumbers-biblio")
128
        .on('click', function() {
128
        .on('click', function() {
129
            $.getJSON( `/api/v1/biblios/${biblionumber}/default_item_callnumber`, function( cn ) {
129
            const biblionumber = $(this).data('biblionumber');
130
            $.getJSON(`/api/v1/biblios/${biblionumber}/default_item_callnumber`, function(cn) {
130
                const callnumber = cn.callnumber;
131
                const callnumber = cn.callnumber;
131
                if ( confirm(__(`Are you sure you want to populate call numbers for all items without a call number on this record to the following value: ${callnumber}`)) ) {
132
                if (confirm(__(`Are you sure you want to populate call numbers for all items without a call number on this record to the following value: ${callnumber}`))) {
132
                    const biblionumber = $(this).data('biblionumber');
133
                    $.post(`/api/v1/biblios/${biblionumber}/items/populate_empty_callnumbers`, function(data) {
133
                    $.post( `/api/v1/biblios/${biblionumber}/items/populate_empty_callnumbers`, function( data ) {
134
                        const items_updated = data.items_updated;
134
                        const items_updated = data.items_updated;
135
                        const callnumber = data.callnumber;
135
                        const callnumber = data.callnumber;
136
                        let msg = __('Items populated with the call number "%s": %s').format(callnumber, items_updated);
136
                        let msg = __('Items populated with the call number "%s": %s').format(callnumber, items_updated);
137
137
138
                        if ( items_updated ) {
138
                        if (items_updated) {
139
                            msg += " " + __('Reload the page?');
139
                            msg += "\n" + __('Reload the page?');
140
                            if( confirm(msg) ) {
140
                            if (confirm(msg)) {
141
                                location.reload(true);
141
                                location.reload(true);
142
                            }
142
                            }
143
                        } else {
143
                        } else {
Lines 150-169 $(document).ready(function() { Link Here
150
150
151
    $(".populate-callnumber-item")
151
    $(".populate-callnumber-item")
152
        .on('click', function() {
152
        .on('click', function() {
153
            $.getJSON( `/api/v1/biblios/${biblionumber}/default_item_callnumber`, function( cn ) {
153
            const biblionumber = $(this).data('biblionumber');
154
            const itemnumber = $(this).data('itemnumber');
155
            $.getJSON(`/api/v1/biblios/${biblionumber}/default_item_callnumber`, function(cn) {
154
                const callnumber = cn.callnumber;
156
                const callnumber = cn.callnumber;
155
                if ( confirm(__(`Are you sure you want to populate the call number for this item to the following value: ${callnumber}`)) ) {
157
                if (confirm(__(`Are you sure you want to populate the call number for this item to the following value: ${callnumber}`))) {
156
                    const biblionumber = $(this).data('biblionumber');
158
                    $.post(`/api/v1/biblios/${biblionumber}/items/${itemnumber}/populate_empty_callnumbers`, function(data) {
157
                    const itemnumber  = $(this).data('itemnumber');
158
                    const button = $(this);
159
                    $.post( `/api/v1/biblios/${biblionumber}/items/${itemnumber}/populate_empty_callnumbers`, function( data ) {
160
                        const callnumber = data.callnumber;
159
                        const callnumber = data.callnumber;
161
                        let msg = __('Item populated with the call number "%s"').format(callnumber);
160
                        let msg = __('Item populated with the call number "%s"').format(callnumber);
162
                        msg += " " + __('Reload the page?');
161
                        msg += "\n" + __('Reload the page?');
163
                        if( confirm(msg) ) {
162
                        if (confirm(msg)) {
164
                            location.reload(true);
163
                            location.reload(true);
165
                        } else {
166
                            button.hide();
167
                        }
164
                        }
168
                    });
165
                    });
169
                }
166
                }
170
- 

Return to bug 34784