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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_modify_holds.tt (-565 / +552 lines)
Lines 42-668 Link Here
42
    [% END #/ WRAPPER breadcrumbs %]
42
    [% END #/ WRAPPER breadcrumbs %]
43
[% END #/ WRAPPER sub-header.inc %]
43
[% END #/ WRAPPER sub-header.inc %]
44
44
45
<div class="main container-fluid">
45
[% WRAPPER "main-container.inc" aside="tools-menu" %]
46
    <div class="row">
46
    [% IF view == "cud-form" %]
47
        <div class="col-sm-10 col-sm-push-2 order-sm-1">
47
        <h1>Batch modify holds</h1>
48
            <main>
48
        <div id="modify_holds_search">
49
                [% IF view == "cud-form" %]
49
            <form method="get" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form">
50
                    <h1>Batch modify holds</h1>
50
                <fieldset class="rows">
51
                    <div id="modify_holds_search">
51
                    <legend>Hold search criteria:</legend>
52
                        <form method="get" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form">
52
                    <ol>
53
                            <fieldset class="rows">
53
                        <li>
54
                                <legend>Hold search criteria:</legend>
54
                            <label for="expirationdate_from">Expiration date from:</label>
55
                                <ol>
55
                            <input type="text" size="10" id="expirationdate_from" name="expirationdate_from" class="flatpickr" />
56
                                    <li>
56
                        </li>
57
                                        <label for="expirationdate_from">Expiration date from:</label>
57
                        <li>
58
                                        <input type="text" size="10" id="expirationdate_from" name="expirationdate_from" class="flatpickr" />
58
                            <label for="expirationdate_to">Expiration date to:</label>
59
                                    </li>
59
                            <input type="text" size="10" id="expirationdate_to" name="expirationdate_to" class="flatpickr" />
60
                                    <li>
60
                        </li>
61
                                        <label for="expirationdate_to">Expiration date to:</label>
61
                        <li>
62
                                        <input type="text" size="10" id="expirationdate_to" name="expirationdate_to" class="flatpickr" />
62
                            <label for="branchcodes">Libraries:</label>
63
                                    </li>
63
                            <select name="branchcodes" id="branchcodes" multiple="multiple">
64
                                    <li>
64
                                [% PROCESS options_for_libraries libraries => Branches.all(selected => "") %]
65
                                        <label for="branchcodes">Libraries:</label>
65
                            </select>
66
                                        <select name="branchcodes" id="branchcodes" multiple="multiple">
66
                        </li>
67
                                            [% PROCESS options_for_libraries libraries => Branches.all(selected => "") %]
67
                        <li>
68
                                        </select>
68
                            <label for="found_status">Found status:</label>
69
                                    </li>
69
                            <select name="found_status" id="found_status" multiple="multiple">
70
                                    <li>
70
                                <option value="NULL">No status</option>
71
                                        <label for="found_status">Found status:</label>
71
                                <option value="T">In transit</option>
72
                                        <select name="found_status" id="found_status" multiple="multiple">
72
                                <option value="P">In processing</option>
73
                                            <option value="NULL">No status</option>
73
                                <option value="W">Waiting</option>
74
                                            <option value="T">In transit</option>
74
                            </select>
75
                                            <option value="P">In processing</option>
75
                        </li>
76
                                            <option value="W">Waiting</option>
76
                        <li>
77
                                        </select>
77
                            <label for="suspend_status">Suspended:</label>
78
                                    </li>
78
                            <select name="suspend_status" id="suspend_status">
79
                                    <li>
79
                                <option value="none" selected="selected"></option>
80
                                        <label for="suspend_status">Suspended:</label>
80
                                <option value="0">Not suspended</option>
81
                                        <select name="suspend_status" id="suspend_status">
81
                                <option value="1">Suspended</option>
82
                                            <option value="none" selected="selected"></option>
82
                            </select>
83
                                            <option value="0">Not suspended</option>
83
                        </li>
84
                                            <option value="1">Suspended</option>
84
                        <li>
85
                                        </select>
85
                            <label for="suspend_until_from">Suspended until from:</label>
86
                                    </li>
86
                            <input type="text" size="10" id="suspend_until_from" name="suspend_until_from" class="flatpickr" data-date_to="suspend_until_to" />
87
                                    <li>
87
                        </li>
88
                                        <label for="suspend_until_from">Suspended until from:</label>
88
                        <li>
89
                                        <input type="text" size="10" id="suspend_until_from" name="suspend_until_from" class="flatpickr" data-date_to="suspend_until_to" />
89
                            <label for="suspend_until_to">Suspended until to:</label>
90
                                    </li>
90
                            <input type="text" size="10" id="suspend_until_to" name="suspend_until_to" class="flatpickr" />
91
                                    <li>
91
                        </li>
92
                                        <label for="suspend_until_to">Suspended until to:</label>
92
                        <li>
93
                                        <input type="text" size="10" id="suspend_until_to" name="suspend_until_to" class="flatpickr" />
93
                            <label for="holdnotes">Hold note:</label>
94
                                    </li>
94
                            <input type="text" id="holdnotes" name="holdnotes" />
95
                                    <li>
95
                        </li>
96
                                        <label for="holdnotes">Hold note:</label>
96
                    </ol>
97
                                        <input type="text" id="holdnotes" name="holdnotes" />
97
                </fieldset>
98
                                    </li>
98
                <fieldset class="action">
99
                                </ol>
99
                    <input type="submit" class="btn btn-primary" value="Search" />
100
                            </fieldset>
100
                </fieldset>
101
                            <fieldset class="action">
101
            </form>
102
                                <input type="submit" class="btn btn-primary" value="Search" />
102
            <!-- /#modify_holds_form -->
103
                            </fieldset>
103
        </div>
104
                        </form>
104
        <!-- /#modify_holds_search -->
105
                        <!-- /#modify_holds_form -->
105
    [% ELSIF view == "report" %]
106
                    </div>
106
        <h1>Modified holds</h1>
107
                    <!-- /#modify_holds_search -->
107
        <div id="modified_holds_results-wrapper">
108
                [% ELSIF view == "report" %]
108
            <div id="modified_holds_results" class="page-section">
109
                    <h1>Modified holds</h1>
109
                <table id="modified_holds">
110
                    <div id="modified_holds_results-wrapper">
110
                    <thead>
111
                        <div id="modified_holds_results" class="page-section">
111
                        <tr>
112
                            <table id="modified_holds">
112
                            <th>Title</th>
113
                                <thead>
113
                            <th>Patron</th>
114
                                    <tr>
114
                            <th>Pickup location</th>
115
                                        <th>Title</th>
115
                            <th>Priority</th>
116
                                        <th>Patron</th>
116
                            <th>Expiration date</th>
117
                                        <th>Pickup location</th>
117
                            <th>Status</th>
118
                                        <th>Priority</th>
118
                            <th>Suspended</th>
119
                                        <th>Expiration date</th>
119
                            <th>Suspended until</th>
120
                                        <th>Status</th>
120
                            <th>Notes</th>
121
                                        <th>Suspended</th>
121
                            <!-- Add other columns as needed -->
122
                                        <th>Suspended until</th>
122
                        </tr>
123
                                        <th>Notes</th>
123
                    </thead>
124
                                        <!-- Add other columns as needed -->
124
                    <tbody>
125
                                    </tr>
125
                        [% FOREACH hold IN updated_holds_obj %]
126
                                </thead>
126
                            <tr>
127
                                <tbody>
127
                                <td>[% INCLUDE 'biblio-title.inc' biblio=hold.biblio link = 1 %]</td>
128
                                    [% FOREACH hold IN updated_holds_obj %]
128
                                <td>[% INCLUDE 'patron-title.inc' invert_name=1 patron=hold.borrower hide_patron_infos_if_needed=1 link_to="circulation_reserves" %]</td>
129
                                        <tr>
129
                                <td>[% hold.branch.branchname | html %]</td>
130
                                            <td>[% INCLUDE 'biblio-title.inc' biblio=hold.biblio link = 1 %]</td>
130
                                <td>[% hold.priority | html %]</td>
131
                                            <td>[% INCLUDE 'patron-title.inc' invert_name=1 patron=hold.borrower hide_patron_infos_if_needed=1 link_to="circulation_reserves" %]</td>
131
                                <td>[% hold.expirationdate | $KohaDates %]</td>
132
                                            <td>[% hold.branch.branchname | html %]</td>
132
                                <td>
133
                                            <td>[% hold.priority | html %]</td>
133
                                    [% IF hold.found == 'F' %]
134
                                            <td>[% hold.expirationdate | $KohaDates %]</td>
134
                                        <span>Fulfilled</span>
135
                                            <td>
135
                                    [% ELSIF hold.cancellationdate %]
136
                                                [% IF hold.found == 'F' %]
136
                                        <span>Cancelled</span>
137
                                                    <span>Fulfilled</span>
137
                                    [% ELSIF hold.found == 'W' %]
138
                                                [% ELSIF hold.cancellationdate %]
138
                                        [% IF hold.cancellation_requests.count == 0 %]
139
                                                    <span>Cancelled</span>
139
                                            <span>Waiting</span>
140
                                                [% ELSIF hold.found == 'W' %]
140
                                        [% ELSE %]
141
                                                    [% IF hold.cancellation_requests.count == 0 %]
141
                                            <span>Cancelled</span>
142
                                                        <span>Waiting</span>
142
                                        [% END %]
143
                                                    [% ELSE %]
143
                                    [% ELSIF hold.found == 'T' %]
144
                                                        <span>Cancelled</span>
144
                                        <span>In transit</span>
145
                                                    [% END %]
145
                                    [% ELSE %]
146
                                                [% ELSIF hold.found == 'T' %]
146
                                        <span>Pending</span>
147
                                                    <span>In transit</span>
148
                                                [% ELSE %]
149
                                                    <span>Pending</span>
150
                                                [% END %]
151
                                            </td>
152
                                            <td>[% IF hold.suspend %]Yes[% ELSE %]No[% END %]</td>
153
                                            <td>[% IF hold.suspend_until %][% hold.suspend_until | $KohaDates %][% ELSE %]-[% END %]</td>
154
                                            <td>[% hold.reservenotes | html %]</td>
155
                                        </tr>
156
                                    [% END %]
147
                                    [% END %]
157
                                </tbody>
148
                                </td>
158
                            </table>
149
                                <td>[% IF hold.suspend %]Yes[% ELSE %]No[% END %]</td>
159
                        </div>
150
                                <td>[% IF hold.suspend_until %][% hold.suspend_until | $KohaDates %][% ELSE %]-[% END %]</td>
160
                        <!-- /#modified_holds_results -->
151
                                <td>[% hold.reservenotes | html %]</td>
161
                        <fieldset class="action">
152
                            </tr>
162
                            <a href="/cgi-bin/koha/tools/batch_modify_holds.pl">Return to batch hold modification</a>
153
                        [% END %]
163
                        </fieldset>
154
                    </tbody>
164
                    </div>
155
                </table>
165
                    <!-- /#modified_holds_results-wrapper -->
156
            </div>
166
                [% END %]
157
            <!-- /#modified_holds_results -->
167
                <div id="modify_holds_results-wrapper" style="display:none;">
158
            <fieldset class="action">
168
                    <div id="toolbar" class="btn-toolbar">
159
                <a href="/cgi-bin/koha/tools/batch_modify_holds.pl">Return to batch hold modification</a>
169
                        <a href="#" id="edit_search" class="btn btn-default"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit search</a>
160
            </fieldset>
170
                    </div>
171
                    <!-- /#toolbar -->
172
                    <form action="/cgi-bin/koha/tools/batch_modify_holds.pl" method="post" id="process_mods">
173
                        [% INCLUDE 'csrf-token.inc' %]
174
                        <div id="modify_holds_results" class="page-section">
175
                            <div id="searchheader" class="searchheader">
176
                                <a id="select_all" href="#" class="btn btn-link"><i class="fa fa-check"></i> Select all visible rows</a>
177
                                | <a id="clear_all" href="#" class="btn btn-link"><i class="fa fa-times"></i> Clear selections</a>
178
                                <div id="table_search_selections" class="btn-group" style="display:none;">
179
                                    <span></span>
180
                                    <a href="#" id="clear-row-selection"><i class="fa fa-times"></i> Clear</a>
181
                                </div>
182
                            </div>
183
                            <!-- /#searchheader -->
184
                            <h3>Holds found for: <span class="searchpattern"></span></h3>
185
                            <table id="holds_to_modify"></table>
186
                        </div>
187
                        <!-- /#modify_holds_results -->
188
                        <div id="modify_holds_form_options" class="page-section">
189
                            <h2>Modify holds</h2>
190
                            <table id="modify_holds_options">
191
                                <thead>
192
                                    <tr>
193
                                        <th>New expiration date</th>
194
                                        <th>New pickup library</th>
195
                                        <th>Suspend holds</th>
196
                                        <th>Suspend until</th>
197
                                        <th>New hold note</th>
198
                                        <th>Clear hold notes</th>
199
                                    </tr>
200
                                </thead>
201
                                <tbody>
202
                                    <tr>
203
                                        <td>
204
                                            <input type="text" id="new_expiration_date" name="new_expiration_date" class="flatpickr" data-flatpickr-futuredate="true" />
205
                                        </td>
206
                                        <td>
207
                                            <select name="new_pickup_loc" id="new_pickup_loc">
208
                                                <option value="" selected="selected"></option>
209
                                                [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ selected => "" }) %]
210
                                            </select>
211
                                        </td>
212
                                        <td>
213
                                            <select id="new_suspend_status" name="new_suspend_status">
214
                                                <option value="" selected="selected"></option>
215
                                                <option value="0">Not suspended</option>
216
                                                <option value="1">Suspend</option>
217
                                            </select>
218
                                        </td>
219
                                        <td>
220
                                            <input type="text" id="new_suspend_date" name="new_suspend_date" class="flatpickr" data-flatpickr-futuredate="true" />
221
                                        </td>
222
                                        <td>
223
                                            <input type="text" id="new_hold_note" name="new_hold_note" />
224
                                        </td>
225
                                        <td>
226
                                            <input class="selection" type="checkbox" id="clear_hold_notes" name="clear_hold_notes" value="1" />
227
                                        </td>
228
                                    </tr>
229
                                </tbody>
230
                            </table>
231
                            <!-- /#modify_holds_options -->
232
                        </div>
233
                        <!-- /#modify_holds_options -->
234
                        <fieldset class="action">
235
                            <input type="hidden" name="op" value="cud-modify" />
236
                            <input type="submit" class="btn btn-primary" value="Modify holds" />
237
                            <a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Cancel</a>
238
                        </fieldset>
239
                    </form>
240
                    <!-- /#process_mods -->
241
                </div>
242
                <!-- /#modify_holds_results-wrapper -->
243
            </main>
244
        </div>
161
        </div>
245
        <!-- /.col-sm-10 col-sm-push-2 -->
162
        <!-- /#modified_holds_results-wrapper -->
246
        <div class="col-sm-2 col-sm-pull-10">
163
    [% END %]
247
            <aside> [% INCLUDE 'tools-menu.inc' %] </aside>
164
    <div id="modify_holds_results-wrapper" style="display:none;">
165
        <div id="toolbar" class="btn-toolbar">
166
            <a href="#" id="edit_search" class="btn btn-default"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit search</a>
248
        </div>
167
        </div>
249
        <!-- /.col-sm-2 col-sm-pull-10 -->
168
        <!-- /#toolbar -->
169
        <form action="/cgi-bin/koha/tools/batch_modify_holds.pl" method="post" id="process_mods">
170
            [% INCLUDE 'csrf-token.inc' %]
171
            <div id="modify_holds_results" class="page-section">
172
                <div id="searchheader" class="searchheader">
173
                    <a id="select_all" href="#" class="btn btn-link"><i class="fa fa-check"></i> Select all visible rows</a>
174
                    | <a id="clear_all" href="#" class="btn btn-link"><i class="fa fa-times"></i> Clear selections</a>
175
                    <div id="table_search_selections" class="btn-group" style="display:none;">
176
                        <span></span>
177
                        <a href="#" id="clear-row-selection"><i class="fa fa-times"></i> Clear</a>
178
                    </div>
179
                </div>
180
                <!-- /#searchheader -->
181
                <h3>Holds found for: <span class="searchpattern"></span></h3>
182
                <table id="holds_to_modify"></table>
183
            </div>
184
            <!-- /#modify_holds_results -->
185
            <div id="modify_holds_form_options" class="page-section">
186
                <h2>Modify holds</h2>
187
                <table id="modify_holds_options">
188
                    <thead>
189
                        <tr>
190
                            <th>New expiration date</th>
191
                            <th>New pickup library</th>
192
                            <th>Suspend holds</th>
193
                            <th>Suspend until</th>
194
                            <th>New hold note</th>
195
                            <th>Clear hold notes</th>
196
                        </tr>
197
                    </thead>
198
                    <tbody>
199
                        <tr>
200
                            <td>
201
                                <input type="text" id="new_expiration_date" name="new_expiration_date" class="flatpickr" data-flatpickr-futuredate="true" />
202
                            </td>
203
                            <td>
204
                                <select name="new_pickup_loc" id="new_pickup_loc">
205
                                    <option value="" selected="selected"></option>
206
                                    [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ selected => "" }) %]
207
                                </select>
208
                            </td>
209
                            <td>
210
                                <select id="new_suspend_status" name="new_suspend_status">
211
                                    <option value="" selected="selected"></option>
212
                                    <option value="0">Not suspended</option>
213
                                    <option value="1">Suspend</option>
214
                                </select>
215
                            </td>
216
                            <td>
217
                                <input type="text" id="new_suspend_date" name="new_suspend_date" class="flatpickr" data-flatpickr-futuredate="true" />
218
                            </td>
219
                            <td>
220
                                <input type="text" id="new_hold_note" name="new_hold_note" />
221
                            </td>
222
                            <td>
223
                                <input class="selection" type="checkbox" id="clear_hold_notes" name="clear_hold_notes" value="1" />
224
                            </td>
225
                        </tr>
226
                    </tbody>
227
                </table>
228
                <!-- /#modify_holds_options -->
229
            </div>
230
            <!-- /#modify_holds_options -->
231
            <fieldset class="action">
232
                <input type="hidden" name="op" value="cud-modify" />
233
                <input type="submit" class="btn btn-primary" value="Modify holds" />
234
                <a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Cancel</a>
235
            </fieldset>
236
        </form>
237
        <!-- /#process_mods -->
250
    </div>
238
    </div>
251
    [% MACRO jsinclude BLOCK %]
239
    <!-- /#modify_holds_results-wrapper -->
252
        [% Asset.js("js/tools-menu.js") | $raw %]
240
[% END %]
253
        [% INCLUDE 'calendar.inc' %]
241
[% MACRO jsinclude BLOCK %]
254
        [% INCLUDE 'datatables.inc' %]
242
    [% Asset.js("js/tools-menu.js") | $raw %]
255
        [% INCLUDE 'select2.inc' %]
243
    [% INCLUDE 'calendar.inc' %]
256
        [% INCLUDE 'js-biblio-format.inc' %]
244
    [% INCLUDE 'datatables.inc' %]
257
        [% INCLUDE 'js-patron-format.inc' %]
245
    [% INCLUDE 'select2.inc' %]
258
        [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
246
    [% INCLUDE 'js-biblio-format.inc' %]
259
        <script>
247
    [% INCLUDE 'js-patron-format.inc' %]
260
            let hide_patron_name = [% IF Koha.Preference('HidePatronName') %]true[% ELSE %]false[% END %];
248
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
261
            let hold_ids = [% IF updated_holds %] [% updated_holds | $raw %] [% ELSE %] [] [% END %];
249
    <script>
262
            let hold_ids_from_sql = [% IF reserve_ids_list  %] [% reserve_ids_list  | $raw %] [% ELSE %] [] [% END %];
250
        let hide_patron_name = [% IF Koha.Preference('HidePatronName') %]true[% ELSE %]false[% END %];
263
251
        let hold_ids = [% IF updated_holds %] [% updated_holds | $raw %] [% ELSE %] [] [% END %];
264
            $(document).ready(function() {
252
        let hold_ids_from_sql = [% IF reserve_ids_list  %] [% reserve_ids_list  | $raw %] [% ELSE %] [] [% END %];
265
253
266
                // Apply select2 to all select fields having a "multiple" attribute
254
        $(document).ready(function() {
267
                let selectFields = document.querySelectorAll('select[multiple]');
255
268
                selectFields.forEach((selectField) => {
256
            // Apply select2 to all select fields having a "multiple" attribute
269
                    selectField.style.minWidth = '200px';
257
            let selectFields = document.querySelectorAll('select[multiple]');
270
                    $(selectField).select2();
258
            selectFields.forEach((selectField) => {
271
                });
259
                selectField.style.minWidth = '200px';
260
                $(selectField).select2();
261
            });
272
262
273
                //Empty local storage from previous selections
263
            //Empty local storage from previous selections
274
                localStorage.removeItem("holds_modify_selections");
264
            localStorage.removeItem("holds_modify_selections");
275
265
276
                $("#holds_to_modify").on("change", "input[type='checkbox']", function(){
266
            $("#holds_to_modify").on("change", "input[type='checkbox']", function(){
277
                    var holds_modify_selections = JSON.parse(localStorage.getItem("holds_modify_selections")) || [];
267
                var holds_modify_selections = JSON.parse(localStorage.getItem("holds_modify_selections")) || [];
278
                    var hold_id = $(this).val();
268
                var hold_id = $(this).val();
279
                    if ($(this).prop("checked")) {
269
                if ($(this).prop("checked")) {
280
270
281
                        hold_data = {
271
                    hold_data = {
282
                            hold_id: hold_id,
272
                        hold_id: hold_id,
283
                            found_status: $(this).closest('tr').find('.found_status').children('span').data('found-status'),
273
                        found_status: $(this).closest('tr').find('.found_status').children('span').data('found-status'),
284
                            suspended: $(this).closest('tr').find('.suspended').children('span').data('suspended'),
274
                        suspended: $(this).closest('tr').find('.suspended').children('span').data('suspended'),
285
                        }
275
                    }
286
276
287
                        holds_modify_selections.push(hold_data);
277
                    holds_modify_selections.push(hold_data);
288
                        localStorage.setItem("holds_modify_selections", JSON.stringify(holds_modify_selections));
278
                    localStorage.setItem("holds_modify_selections", JSON.stringify(holds_modify_selections));
289
                        showHoldSelections(holds_modify_selections.length);
279
                    showHoldSelections(holds_modify_selections.length);
280
                } else {
281
                    var filtered = holds_modify_selections.filter(function( hold_obj ){
282
                        return hold_obj.hold_id !== hold_id;
283
                    });
284
                    if( filtered.length > 0 ){
285
                        localStorage.setItem("holds_modify_selections", JSON.stringify( filtered ));
286
                        holds_modify_selections = filtered;
287
                        showHoldSelections( filtered.length );
290
                    } else {
288
                    } else {
291
                        var filtered = holds_modify_selections.filter(function( hold_obj ){
289
                        holds_modify_selections = [];
292
                            return hold_obj.hold_id !== hold_id;
290
                        localStorage.removeItem("holds_modify_selections");
293
                        });
291
                        showHoldSelections( 0 );
294
                        if( filtered.length > 0 ){
295
                            localStorage.setItem("holds_modify_selections", JSON.stringify( filtered ));
296
                            holds_modify_selections = filtered;
297
                            showHoldSelections( filtered.length );
298
                        } else {
299
                            holds_modify_selections = [];
300
                            localStorage.removeItem("holds_modify_selections");
301
                            showHoldSelections( 0 );
302
                        }
303
                    }
292
                    }
304
                });
293
                }
294
            });
305
295
306
                $("#select_all").on("click", function(e){
296
            $("#select_all").on("click", function(e){
307
                    e.preventDefault();
297
                e.preventDefault();
308
                    $("#holds_to_modify input[type='checkbox']").each(function(){
298
                $("#holds_to_modify input[type='checkbox']").each(function(){
309
                        $(this).prop("checked", true).change();
299
                    $(this).prop("checked", true).change();
310
                    });
311
                });
300
                });
301
            });
312
302
313
                $("#clear_all").on("click", function(e){
303
            $("#clear_all").on("click", function(e){
314
                    e.preventDefault();
304
                e.preventDefault();
315
                    $("#holds_to_modify input[type='checkbox']").each(function(){
305
                $("#holds_to_modify input[type='checkbox']").each(function(){
316
                        $(this).prop("checked", false).change();
306
                    $(this).prop("checked", false).change();
317
                    });
318
                });
307
                });
308
            });
319
309
320
                $("#clear-row-selection").on("click", function (e) {
310
            $("#clear-row-selection").on("click", function (e) {
321
                    e.preventDefault();
311
                e.preventDefault();
322
                    $("input[type='checkbox']").prop("checked", false).change();
312
                $("input[type='checkbox']").prop("checked", false).change();
323
                    localStorage.removeItem("holds_modify_selections");
313
                localStorage.removeItem("holds_modify_selections");
324
                    $("#table_search_selections").hide();
314
                $("#table_search_selections").hide();
325
                });
315
            });
326
316
327
                $('#modify_holds_form').submit(function() {
317
            $('#modify_holds_form').submit(function() {
328
                    var modify_holds_form = $(this);
318
                var modify_holds_form = $(this);
329
                    search_holds(modify_holds_form);
319
                search_holds(modify_holds_form);
330
                    $("#modify_holds_search").hide();
320
                $("#modify_holds_search").hide();
331
                    $('#edit_search').show();
321
                $('#edit_search').show();
332
                    return false;
322
                return false;
333
                });
323
            });
334
324
335
                if(hold_ids_from_sql.length > 0){
325
            if(hold_ids_from_sql.length > 0){
336
                    $('#modify_holds_form').trigger('submit');
326
                $('#modify_holds_form').trigger('submit');
327
            }
328
329
            $("#edit_search").on("click", function(e){
330
                e.preventDefault();
331
                $('#modify_holds_search').show();
332
                $('#edit_search').hide();
333
            });
334
335
            function showHoldSelections( number ){
336
                if (number === 0) {
337
                    $("#table_search_selections").hide();
338
                } else {
339
                    $("#table_search_selections")
340
                        .show()
341
                        .find("span")
342
                        .text(_("Holds selected: %s").format(number));
337
                }
343
                }
344
            }
345
346
            function search_holds(modify_holds_form){
347
                var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'batch_hold_modification', 'holds_to_modify', 'json' ) | $raw %];
348
                var searchpattern = "";
349
                var filters = {
350
                    "me.expirationdate": function(){
351
                        var expirationdate_from = modify_holds_form.find("#expirationdate_from").val();
352
                        var expirationdate_to   = modify_holds_form.find("#expirationdate_to").val();
353
354
                        if (expirationdate_from && expirationdate_to){
355
                            searchpattern += _("expiration date between ") + expirationdate_from + " and " + expirationdate_to + " ";
356
                            return {"-between": [expirationdate_from, expirationdate_to]};
357
                        }
358
                        else if (expirationdate_from && !expirationdate_to){
359
                            searchpattern += _("expiration date from ") + expirationdate_from + " ";
360
                            return {">=": expirationdate_from };
361
                        } else if (!expirationdate_from && expirationdate_to){
362
                            searchpattern += _("expiration date to ") + expirationdate_to + " ";
363
                            return {"<=": expirationdate_to };
364
                        }
365
                    },
366
                    "me.branchcode": function(){
367
                        var branchcodes = modify_holds_form.find("#branchcodes").val();
368
                        if( branchcodes.length > 0 ){
369
                            searchpattern += _("from libraries ");
370
                            var selected_libraries = modify_holds_form.find("#branchcodes option:selected");
371
                            $.each(selected_libraries, function(key, value) {
372
                                searchpattern += value.text + " ";
373
                            });
374
                            return {"-in": branchcodes };
375
                        }
376
                    },
377
                    "me.status": function(){
378
                        var found_status = modify_holds_form.find("#found_status").val();
379
                        if( found_status.length > 0 ){
380
                            var filters = [{"-in": found_status}];
381
                            if(jQuery.inArray("NULL", found_status) !== -1){
382
                                filters.push({"=": null});
383
                            }
384
                            searchpattern += _("found status in ");
385
                            $.each(found_status, function(key, value) {
386
                                let status = _("No status ");
387
                                if ( value == "T" ) {
388
                                    status = _("In transit ");
389
                                } else if( value == "P" ) {
390
                                    status = _("In processing ");
391
                                } else if( value == "W" ) {
392
                                    status = _("Waiting ");
393
                                }
394
                                searchpattern += status;
395
                            });
396
                            return filters;
397
                        }
398
                    },
399
                    "me.suspended": function(){
400
                        var suspend_status = modify_holds_form.find("#suspend_status").val();
338
401
339
                $("#edit_search").on("click", function(e){
402
                        if(suspend_status != "none"){
340
                    e.preventDefault();
403
                            var suspended_text = suspend_status == 0 ? _("Not suspended") : _("Suspended");
341
                    $('#modify_holds_search').show();
404
                            searchpattern += _("with suspend status ") + suspended_text;
342
                    $('#edit_search').hide();
343
                });
344
405
345
                function showHoldSelections( number ){
406
                            return {"=": suspend_status};
346
                    if (number === 0) {
407
                        }
347
                        $("#table_search_selections").hide();
408
                    },
348
                    } else {
409
                    "me.suspend_until": function(){
349
                        $("#table_search_selections")
410
                        var suspend_until_from = modify_holds_form.find("#suspend_until_from").val();
350
                            .show()
411
                        var suspend_until_to   = modify_holds_form.find("#suspend_until_to").val();
351
                            .find("span")
412
352
                            .text(_("Holds selected: %s").format(number));
413
                        if (suspend_until_from && suspend_until_to){
414
                            searchpattern += _("suspend date between ") + suspend_until_from + " and " + suspend_until_to + " ";
415
                            return {"-between": [suspend_until_from, suspend_until_to]};
416
                        }
417
                        else if (suspend_until_from && !suspend_until_to){
418
                            searchpattern += _("suspend date from ") + suspend_until_from + " ";
419
                            return {">=": suspend_until_from };
420
                        } else if (!suspend_until_from && suspend_until_to){
421
                            searchpattern += _("suspend date to ") + suspend_until_to + " ";
422
                            return {"<=": suspend_until_to };
423
                        }
424
                    },
425
                    "me.notes": function(){
426
                        var holdnotes = modify_holds_form.find("#holdnotes").val();
427
428
                        searchpattern += holdnotes ? _("hold notes like ") + holdnotes : "";
429
430
                        return holdnotes ? {"-like": "%"+holdnotes+"%"} : "";
431
                    },
432
                    "me.hold_id": function(){
433
                        return hold_ids_from_sql.length > 0 ? { "-in": hold_ids_from_sql } : "";
353
                    }
434
                    }
354
                }
435
                }
355
436
356
                function search_holds(modify_holds_form){
437
                var holds_modify_table = $("#holds_to_modify").kohaTable({
357
                    var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'batch_hold_modification', 'holds_to_modify', 'json' ) | $raw %];
438
                    ajax: {
358
                    var searchpattern = "";
439
                        "url": "/api/v1/holds"
359
                    var filters = {
440
                    },
360
                        "me.expirationdate": function(){
441
                    embed: [
361
                            var expirationdate_from = modify_holds_form.find("#expirationdate_from").val();
442
                        "biblio",
362
                            var expirationdate_to   = modify_holds_form.find("#expirationdate_to").val();
443
                        "item",
363
444
                        "pickup_library",
364
                            if (expirationdate_from && expirationdate_to){
445
                        "patron"
365
                                searchpattern += _("expiration date between ") + expirationdate_from + " and " + expirationdate_to + " ";
446
                    ],
366
                                return {"-between": [expirationdate_from, expirationdate_to]};
447
                    destroy: true,
448
                    autoWidth: false,
449
                    processing: true,
450
                    order: [
451
                        [1, 'asc']
452
                    ],
453
                    columns: [
454
                        {
455
                            "data": "hold_id",
456
                            "name": "checkbox",
457
                            "orderable": false,
458
                            "render": function(data, type, row, meta) {
459
                                return '<input class="selection" type="checkbox" value="'+ encodeURIComponent(data) +'"/>'
367
                            }
460
                            }
368
                            else if (expirationdate_from && !expirationdate_to){
461
                        },
369
                                searchpattern += _("expiration date from ") + expirationdate_from + " ";
462
                        {
370
                                return {">=": expirationdate_from };
463
                            "data": "hold_date",
371
                            } else if (!expirationdate_from && expirationdate_to){
464
                            "name": "hold_date",
372
                                searchpattern += _("expiration date to ") + expirationdate_to + " ";
465
                            "type": "date",
373
                                return {"<=": expirationdate_to };
466
                            "title": _("Hold date"),
467
                            "orderable": true,
468
                            "render": function( data, type, row, meta ) {
469
                                return $date(data);
470
                            }
471
                        },
472
                        {
473
                            "data": "expiration_date",
474
                            "name": "expiration_date",
475
                            "type": "date",
476
                            "title": _("Expiration date"),
477
                            "orderable": true,
478
                            "render": function( data, type, row, meta ) {
479
                                return $date(data);
374
                            }
480
                            }
375
                        },
481
                        },
376
                        "me.branchcode": function(){
482
                        {
377
                            var branchcodes = modify_holds_form.find("#branchcodes").val();
483
                            "data": "biblio.title:biblio.subtitle:biblio.medium",
378
                            if( branchcodes.length > 0 ){
484
                            "title": _("Title"),
379
                                searchpattern += _("from libraries ");
485
                            "searchable": true,
380
                                var selected_libraries = modify_holds_form.find("#branchcodes option:selected");
486
                            "orderable": true,
381
                                $.each(selected_libraries, function(key, value) {
487
                            "render": function(data, type, row, meta) {
382
                                    searchpattern += value.text + " ";
488
                                return $biblio_to_html(row.biblio, { link: 1 });
383
                                });
384
                                return {"-in": branchcodes };
385
                            }
489
                            }
386
                        },
490
                        },
387
                        "me.status": function(){
491
                        {
388
                            var found_status = modify_holds_form.find("#found_status").val();
492
                            "data": "item.external_id",
389
                            if( found_status.length > 0 ){
493
                            "name": "barcode",
390
                                var filters = [{"-in": found_status}];
494
                            "title": _("Barcode"),
391
                                if(jQuery.inArray("NULL", found_status) !== -1){
495
                            "defaultContent": _(""),
392
                                    filters.push({"=": null});
496
                            "orderable": true,
497
                            "render": function( data, type, row, meta ) {
498
                                if( row.item ){
499
                                    let item_id = encodeURIComponent( row.item_id );
500
                                    let biblio_id = encodeURIComponent( row.biblio_id );
501
                                    return '<a href="/cgi-bin/koha/catalogue/moredetail.pl?' +
502
                                    'itemnumber='+ item_id +'&biblionumber='+ biblio_id +'&' +
503
                                    'bi='+ biblio_id +'#item'+ item_id +'">' + escape_str( data ) + '</a>'
393
                                }
504
                                }
394
                                searchpattern += _("found status in ");
395
                                $.each(found_status, function(key, value) {
396
                                    let status = _("No status ");
397
                                    if ( value == "T" ) {
398
                                        status = _("In transit ");
399
                                    } else if( value == "P" ) {
400
                                        status = _("In processing ");
401
                                    } else if( value == "W" ) {
402
                                        status = _("Waiting ");
403
                                    }
404
                                    searchpattern += status;
405
                                });
406
                                return filters;
407
                            }
505
                            }
408
                        },
506
                        },
409
                        "me.suspended": function(){
507
                        {
410
                            var suspend_status = modify_holds_form.find("#suspend_status").val();
508
                            "data": "patron_id",
411
509
                            "name": "patron",
412
                            if(suspend_status != "none"){
510
                            "title": _("Patron"),
413
                                var suspended_text = suspend_status == 0 ? _("Not suspended") : _("Suspended");
511
                            "orderable": true,
414
                                searchpattern += _("with suspend status ") + suspended_text;
512
                            "render": function( data, type, row, meta ) {
415
513
                                let patron_to_html = $patron_to_html(row.patron, { url: true, display_cardnumber: true, hide_patron_name });
416
                                return {"=": suspend_status};
514
                                return patron_to_html;
417
                            }
515
                            }
418
                        },
516
                        },
419
                        "me.suspend_until": function(){
517
                        {
420
                            var suspend_until_from = modify_holds_form.find("#suspend_until_from").val();
518
                            "data": "status",
421
                            var suspend_until_to   = modify_holds_form.find("#suspend_until_to").val();
519
                            "name": "status",
422
520
                            "title": _("Status"),
423
                            if (suspend_until_from && suspend_until_to){
521
                            "className": "found_status",
424
                                searchpattern += _("suspend date between ") + suspend_until_from + " and " + suspend_until_to + " ";
522
                            "orderable": true,
425
                                return {"-between": [suspend_until_from, suspend_until_to]};
523
                            "render": function( data, type, row, meta ) {
524
                                let status = _("No status");
525
                                if ( data == "T" ) {
526
                                    status = _("In transit");
527
                                } else if( data == "P" ) {
528
                                    status = _("In processing");
529
                                } else if( data == "W" ) {
530
                                    status = _("Waiting");
531
                                }
532
                                return "<span data-found-status='" + escape_str( data ) + "'>" + status + "</span>";
426
                            }
533
                            }
427
                            else if (suspend_until_from && !suspend_until_to){
534
                        },
428
                                searchpattern += _("suspend date from ") + suspend_until_from + " ";
535
                        {
429
                                return {">=": suspend_until_from };
536
                            "data": "pickup_library_id",
430
                            } else if (!suspend_until_from && suspend_until_to){
537
                            "name": "pickup_library",
431
                                searchpattern += _("suspend date to ") + suspend_until_to + " ";
538
                            "title": _("Hold pickup library"),
432
                                return {"<=": suspend_until_to };
539
                            "orderable": true,
540
                            "render": function( data, type, row, meta ) {
541
                                return escape_str( row.pickup_library.name );
433
                            }
542
                            }
434
                        },
543
                        },
435
                        "me.notes": function(){
544
                        {
436
                            var holdnotes = modify_holds_form.find("#holdnotes").val();
545
                            "data": "suspended",
437
546
                            "name": "suspended",
438
                            searchpattern += holdnotes ? _("hold notes like ") + holdnotes : "";
547
                            "className": "suspended",
439
548
                            "title": _("Suspended"),
440
                            return holdnotes ? {"-like": "%"+holdnotes+"%"} : "";
549
                            "orderable": true,
550
                            "render": function( data, type, row, meta ) {
551
                                var suspended_string = data == 0 ? _("No") : _("Yes");
552
                                return "<span data-suspended='" + data + "'>" + suspended_string + "</span>";
553
                            }
441
                        },
554
                        },
442
                        "me.hold_id": function(){
555
                        {
443
                            return hold_ids_from_sql.length > 0 ? { "-in": hold_ids_from_sql } : "";
556
                            "data": "suspended_until",
444
                        }
557
                            "name": "suspended_until",
445
                    }
558
                            "title": _("Suspended until"),
446
559
                            "orderable": true,
447
                    var holds_modify_table = $("#holds_to_modify").kohaTable({
560
                            "render": function( data, type, row, meta ) {
448
                        ajax: {
561
                                return $date( data );
449
                            "url": "/api/v1/holds"
562
                            }
450
                        },
563
                        },
451
                        embed: [
564
                        {
452
                            "biblio",
565
                            "data": "notes",
453
                            "item",
566
                            "name": "notes",
454
                            "pickup_library",
567
                            "title": _("Notes"),
455
                            "patron"
568
                            "orderable": true,
456
                        ],
569
                            "render": function( data, type, row, meta ) {
457
                        destroy: true,
570
                                return escape_str( data );
458
                        autoWidth: false,
459
                        processing: true,
460
                        order: [
461
                            [1, 'asc']
462
                        ],
463
                        columns: [
464
                            {
465
                                "data": "hold_id",
466
                                "name": "checkbox",
467
                                "orderable": false,
468
                                "render": function(data, type, row, meta) {
469
                                    return '<input class="selection" type="checkbox" value="'+ encodeURIComponent(data) +'"/>'
470
                                }
471
                            },
472
                            {
473
                                "data": "hold_date",
474
                                "name": "hold_date",
475
                                "type": "date",
476
                                "title": _("Hold date"),
477
                                "orderable": true,
478
                                "render": function( data, type, row, meta ) {
479
                                    return $date(data);
480
                                }
481
                            },
482
                            {
483
                                "data": "expiration_date",
484
                                "name": "expiration_date",
485
                                "type": "date",
486
                                "title": _("Expiration date"),
487
                                "orderable": true,
488
                                "render": function( data, type, row, meta ) {
489
                                    return $date(data);
490
                                }
491
                            },
492
                            {
493
                                "data": "biblio.title:biblio.subtitle:biblio.medium",
494
                                "title": _("Title"),
495
                                "searchable": true,
496
                                "orderable": true,
497
                                "render": function(data, type, row, meta) {
498
                                    return $biblio_to_html(row.biblio, { link: 1 });
499
                                }
500
                            },
501
                            {
502
                                "data": "item.external_id",
503
                                "name": "barcode",
504
                                "title": _("Barcode"),
505
                                "defaultContent": _(""),
506
                                "orderable": true,
507
                                "render": function( data, type, row, meta ) {
508
                                    if( row.item ){
509
                                        let item_id = encodeURIComponent( row.item_id );
510
                                        let biblio_id = encodeURIComponent( row.biblio_id );
511
                                        return '<a href="/cgi-bin/koha/catalogue/moredetail.pl?' +
512
                                        'itemnumber='+ item_id +'&biblionumber='+ biblio_id +'&' +
513
                                        'bi='+ biblio_id +'#item'+ item_id +'">' + escape_str( data ) + '</a>'
514
                                    }
515
                                }
516
                            },
517
                            {
518
                                "data": "patron_id",
519
                                "name": "patron",
520
                                "title": _("Patron"),
521
                                "orderable": true,
522
                                "render": function( data, type, row, meta ) {
523
                                    let patron_to_html = $patron_to_html(row.patron, { url: true, display_cardnumber: true, hide_patron_name });
524
                                    return patron_to_html;
525
                                }
526
                            },
527
                            {
528
                                "data": "status",
529
                                "name": "status",
530
                                "title": _("Status"),
531
                                "className": "found_status",
532
                                "orderable": true,
533
                                "render": function( data, type, row, meta ) {
534
                                    let status = _("No status");
535
                                    if ( data == "T" ) {
536
                                        status = _("In transit");
537
                                    } else if( data == "P" ) {
538
                                        status = _("In processing");
539
                                    } else if( data == "W" ) {
540
                                        status = _("Waiting");
541
                                    }
542
                                    return "<span data-found-status='" + escape_str( data ) + "'>" + status + "</span>";
543
                                }
544
                            },
545
                            {
546
                                "data": "pickup_library_id",
547
                                "name": "pickup_library",
548
                                "title": _("Hold pickup library"),
549
                                "orderable": true,
550
                                "render": function( data, type, row, meta ) {
551
                                    return escape_str( row.pickup_library.name );
552
                                }
553
                            },
554
                            {
555
                                "data": "suspended",
556
                                "name": "suspended",
557
                                "className": "suspended",
558
                                "title": _("Suspended"),
559
                                "orderable": true,
560
                                "render": function( data, type, row, meta ) {
561
                                    var suspended_string = data == 0 ? _("No") : _("Yes");
562
                                    return "<span data-suspended='" + data + "'>" + suspended_string + "</span>";
563
                                }
564
                            },
565
                            {
566
                                "data": "suspended_until",
567
                                "name": "suspended_until",
568
                                "title": _("Suspended until"),
569
                                "orderable": true,
570
                                "render": function( data, type, row, meta ) {
571
                                    return $date( data );
572
                                }
573
                            },
574
                            {
575
                                "data": "notes",
576
                                "name": "notes",
577
                                "title": _("Notes"),
578
                                "orderable": true,
579
                                "render": function( data, type, row, meta ) {
580
                                    return escape_str( data );
581
                                }
582
                            }
571
                            }
583
                        ],
572
                        }
584
                    }, table_settings, 0, filters);
573
                    ],
574
                }, table_settings, 0, filters);
585
575
586
                    $(".searchpattern").text(searchpattern);
576
                $(".searchpattern").text(searchpattern);
587
577
588
                    $("#modify_holds_results-wrapper").show();
578
                $("#modify_holds_results-wrapper").show();
589
                }
579
            }
590
580
591
                $("#process_mods").on('submit', function(e) {
581
            $("#process_mods").on('submit', function(e) {
592
582
593
                    var hold_ids = JSON.parse( localStorage.getItem("holds_modify_selections") ) || [];
583
                var hold_ids = JSON.parse( localStorage.getItem("holds_modify_selections") ) || [];
594
584
595
                    $("#process_mods input[name='hold_id']").remove();
585
                $("#process_mods input[name='hold_id']").remove();
596
586
597
                    hold_ids.forEach(function(hold) {
587
                hold_ids.forEach(function(hold) {
598
                        $('<input>').attr({
588
                    $('<input>').attr({
599
                            type: 'hidden',
589
                        type: 'hidden',
600
                            name: 'hold_id',
590
                        name: 'hold_id',
601
                            value: hold.hold_id
591
                        value: hold.hold_id
602
                        }).appendTo('#process_mods');
592
                    }).appendTo('#process_mods');
603
                    });
593
                });
604
605
                    var errors = [];
606
594
607
                    var new_expiration_date = $("#new_expiration_date").val();
595
                var errors = [];
608
                    var new_pickup_loc      = $("#new_pickup_loc").val();
609
                    var new_suspend_status  = $("#new_suspend_status").val();
610
                    var new_suspend_date    = $("#new_suspend_date").val();
611
                    var new_hold_note       = $("#new_hold_note").val();
612
                    var clear_hold_notes    = $("#clear_hold_notes").val();
613
596
614
                    if ( hold_ids.length == 0 ) {
597
                var new_expiration_date = $("#new_expiration_date").val();
615
                        e.preventDefault();
598
                var new_pickup_loc      = $("#new_pickup_loc").val();
616
                        errors.push(_("Please select at least one hold to process."));
599
                var new_suspend_status  = $("#new_suspend_status").val();
617
                    }
600
                var new_suspend_date    = $("#new_suspend_date").val();
601
                var new_hold_note       = $("#new_hold_note").val();
602
                var clear_hold_notes    = $("#clear_hold_notes").val();
618
603
619
                    if( new_pickup_loc || new_suspend_status || new_suspend_date ){
604
                if ( hold_ids.length == 0 ) {
620
                        var found = false;
605
                    e.preventDefault();
621
                        hold_ids.forEach(function(hold){
606
                    errors.push(_("Please select at least one hold to process."));
622
                            if( hold.found_status ){
607
                }
623
                                e.preventDefault();
624
                                found = true;
625
                            }
626
                        });
627
                        if( ( new_suspend_status || new_suspend_date ) && found ){
628
                            errors.push(_("One or more holds have found status and can't be suspended."));
629
                        }
630
                        if( new_pickup_loc && found ){
631
                            errors.push(_("One or more holds have found status and their pick up location can't be changed."));
632
                        }
633
                    }
634
635
                    var suspended = false;
636
608
609
                if( new_pickup_loc || new_suspend_status || new_suspend_date ){
610
                    var found = false;
637
                    hold_ids.forEach(function(hold){
611
                    hold_ids.forEach(function(hold){
638
                        if( hold.suspened ){
612
                        if( hold.found_status ){
639
                            suspended = true;
613
                            e.preventDefault();
614
                            found = true;
640
                        }
615
                        }
641
                    });
616
                    });
642
617
                    if( ( new_suspend_status || new_suspend_date ) && found ){
643
                    if( ( !new_suspend_status || new_suspend_status == "0" || !suspended ) && new_suspend_date ){
618
                        errors.push(_("One or more holds have found status and can't be suspended."));
644
                        new_suspend_status = 1;
619
                    }
620
                    if( new_pickup_loc && found ){
621
                        errors.push(_("One or more holds have found status and their pick up location can't be changed."));
645
                    }
622
                    }
623
                }
624
625
                var suspended = false;
646
626
647
                    if (errors.length > 0) {
627
                hold_ids.forEach(function(hold){
648
                        e.preventDefault();
628
                    if( hold.suspened ){
649
                        $("#errorList").html(errors.map(error => `<li>${error}</li>`).join(""));
629
                        suspended = true;
650
                        $("#errorModal").modal('show');
651
                        return false;
652
                    }
630
                    }
653
                    return true;
654
                });
631
                });
655
632
656
                //Modified holds table
633
                if( ( !new_suspend_status || new_suspend_status == "0" || !suspended ) && new_suspend_date ){
657
                var table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'modified_holds', 'json' ) | $raw %];
634
                    new_suspend_status = 1;
658
                $("#modified_holds").kohaTable({
635
                }
659
                    pagingType: "full",
660
                    autoWidth: false
661
                }, table_settings);
662
636
637
                if (errors.length > 0) {
638
                    e.preventDefault();
639
                    $("#errorList").html(errors.map(error => `<li>${error}</li>`).join(""));
640
                    $("#errorModal").modal('show');
641
                    return false;
642
                }
643
                return true;
663
            });
644
            });
664
        </script>
665
    [% END %]
666
645
667
    [% INCLUDE 'intranet-bottom.inc' %]
646
            //Modified holds table
668
</div>
647
            var table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'modified_holds', 'json' ) | $raw %];
648
            $("#modified_holds").kohaTable({
649
                pagingType: "full",
650
                autoWidth: false
651
            }, table_settings);
652
653
        });
654
    </script>
655
[% END %]
656
[% INCLUDE 'intranet-bottom.inc' %]
669
- 

Return to bug 38739