Lines 14-67
Link Here
|
14 |
</head> |
14 |
</head> |
15 |
|
15 |
|
16 |
<body id="tools_batch_extend_due_dates" class="tools"> |
16 |
<body id="tools_batch_extend_due_dates" class="tools"> |
17 |
[% WRAPPER 'header.inc' %] |
17 |
[% WRAPPER 'header.inc' %] |
18 |
[% INCLUDE 'cat-search.inc' %] |
18 |
[% INCLUDE 'cat-search.inc' %] |
|
|
19 |
[% INCLUDE modals/batch_modify_hold_errors.inc %] |
19 |
[% END %] |
20 |
[% END %] |
20 |
|
21 |
[% WRAPPER 'sub-header.inc' %] |
21 |
[% WRAPPER 'sub-header.inc' %] |
22 |
[% WRAPPER breadcrumbs %] |
22 |
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> |
23 |
[% WRAPPER breadcrumb_item %] |
23 |
<ol> |
24 |
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> |
24 |
<li> |
25 |
[% END %] |
25 |
<a href="/cgi-bin/koha/mainpage.pl">Home</a> |
26 |
[% IF ( view == 'form' || view == 'report' ) %] |
26 |
</li> |
27 |
[% WRAPPER breadcrumb_item %] |
27 |
<li> |
28 |
<a href="/cgi-bin/koha/tools/batch_modify_holds.pl">Batch modify holds</a> |
28 |
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> |
29 |
[% END %] |
29 |
</li> |
30 |
[% ELSE %] |
30 |
<li> |
31 |
[% WRAPPER breadcrumb_item bc_active= 1 %] |
31 |
<a href="#" aria-current="page">Batch modify holds</a> |
32 |
<span>Batch modify holds</span> |
32 |
</li> |
33 |
[% END %] |
33 |
</ol> |
34 |
[% END %] |
34 |
</nav> |
35 |
[% END #/ WRAPPER breadcrumbs %] |
35 |
[% END %] |
36 |
[% END #/ WRAPPER sub-header.inc %] |
36 |
|
37 |
|
37 |
<div class="main container-fluid"> |
38 |
<div class="main container-fluid"> |
38 |
<div class="row"> |
39 |
<div class="row"> |
39 |
<div class="col-sm-10 col-sm-push-2"> |
40 |
<div class="col-sm-10 order-md-2 order-sm-1"> |
40 |
<main> |
41 |
<main> |
41 |
|
42 |
|
42 |
<h1>Batch modify holds</h1> |
43 |
<h1>Batch modify holds</h1> |
43 |
|
44 |
|
44 |
[% IF view == 'form' %] |
45 |
[% IF view == 'form' %] |
45 |
<form method="post" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form"> |
46 |
<form method="get" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form"> |
46 |
<fieldset class="rows"> |
47 |
<fieldset class="rows"> |
47 |
<legend>Hold search criteria:</legend> |
48 |
<legend>Hold search criteria:</legend> |
48 |
<span class="hint">NOTE! Column patron_expiration_date is used as a main filter for expiration date field. Otherwise column expirationdate is used.</span> |
49 |
<span class="hint">NOTE! Column patron_expiration_date is used as a main filter for expiration date field. Otherwise column expirationdate is used.</span> |
49 |
<ol> |
50 |
<ol> |
50 |
<li> |
51 |
<li> |
51 |
<label for="suspend_until">Expiration date:</label> |
52 |
<label for="expirationdate_from">Expiration date from:</label> |
52 |
<li> |
53 |
<input type="text" size="10" id="expirationdate_from" name="expirationdate_from" class="flatpickr" data-date_to="to" /> |
53 |
<label for="expirationdate_from">From</label> |
54 |
</li> |
54 |
<input type="text" size="10" id="from" name="expirationdate_from" class="flatpickr" data-date_to="to" /> |
55 |
<li> |
55 |
</li> |
56 |
<label for="expirationdate_to">Expiration date to:</label> |
56 |
<li> |
57 |
<input type="text" size="10" id="expirationdate_to" name="expirationdate_to" class="flatpickr"/> |
57 |
<label for="expirationdate_to">To</label> |
|
|
58 |
<input type="text" size="10" id="to" name="expirationdate_to" class="flatpickr"/> |
59 |
</li> |
60 |
</li> |
58 |
</li> |
61 |
<li> |
59 |
<li> |
62 |
<label for="branchcodes">Libraries:</label> |
60 |
<label for="branchcodes">Libraries:</label> |
63 |
<select name="branchcodes" id="branchcodes" multiple="multiple"> |
61 |
<select name="branchcodes" id="branchcodes" multiple="multiple"> |
64 |
[% PROCESS options_for_libraries libraries => Branches.all() %] |
62 |
[% PROCESS options_for_libraries libraries => Branches.all(selected => "") %] |
65 |
</select> |
63 |
</select> |
66 |
</li> |
64 |
</li> |
67 |
<li> |
65 |
<li> |
Lines 82-96
Link Here
|
82 |
</select> |
80 |
</select> |
83 |
</li> |
81 |
</li> |
84 |
<li> |
82 |
<li> |
85 |
<label for="suspend_until">Suspended until:</label> |
83 |
<label for="suspend_until_from">Suspended until from:</label> |
86 |
<li> |
84 |
<input type="text" size="10" id="suspend_until_from" name="suspend_until_from" class="flatpickr" data-date_to="to" /> |
87 |
<label for="suspend_until_from">From</label> |
85 |
</li> |
88 |
<input type="text" size="10" id="from" name="suspend_until_from" class="flatpickr" data-date_to="to" /> |
86 |
<li> |
89 |
</li> |
87 |
<label for="suspend_until_to">Suspended until to:</label> |
90 |
<li> |
88 |
<input type="text" size="10" id="suspend_until_to" name="suspend_until_to" class="flatpickr"/> |
91 |
<label for="suspend_until_to">To</label> |
|
|
92 |
<input type="text" size="10" id="to" name="suspend_until_to" class="flatpickr"/> |
93 |
</li> |
94 |
</li> |
89 |
</li> |
95 |
<li> |
90 |
<li> |
96 |
<label for="reservenotes">Hold note:</label> |
91 |
<label for="reservenotes">Hold note:</label> |
Lines 106-112
Link Here
|
106 |
</form> <!-- /#modify_holds_form --> |
101 |
</form> <!-- /#modify_holds_form --> |
107 |
[% ELSIF view == 'list' %] |
102 |
[% ELSIF view == 'list' %] |
108 |
<form action="/cgi-bin/koha/tools/batch_modify_holds.pl" method="post" id="process"> |
103 |
<form action="/cgi-bin/koha/tools/batch_modify_holds.pl" method="post" id="process"> |
|
|
104 |
[% INCLUDE 'csrf-token.inc' %] |
109 |
[% IF holds.count %] |
105 |
[% IF holds.count %] |
|
|
106 |
<div><p>Found [% holds.count | html %][% IF holds.count > 1 %] holds [% ELSE %] hold [% END %]to modify.</p></div> |
110 |
<div class="page-section"> |
107 |
<div class="page-section"> |
111 |
<div class="btn-toolbar selections-toolbar"> |
108 |
<div class="btn-toolbar selections-toolbar"> |
112 |
<a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a> |
109 |
<a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a> |
Lines 118-123
Link Here
|
118 |
<th> </th> |
115 |
<th> </th> |
119 |
<th>Expiration date</th> |
116 |
<th>Expiration date</th> |
120 |
<th>Patron expiration date</th> |
117 |
<th>Patron expiration date</th> |
|
|
118 |
<th>Title</th> |
119 |
<th>Barcode</th> |
121 |
<th>Status</th> |
120 |
<th>Status</th> |
122 |
<th>Hold pickup library</th> |
121 |
<th>Hold pickup library</th> |
123 |
<th>Suspended</th> |
122 |
<th>Suspended</th> |
Lines 131-136
Link Here
|
131 |
<td><input type="checkbox" name="hold_id" value="[% hold.reserve_id | html %]"/></td> |
130 |
<td><input type="checkbox" name="hold_id" value="[% hold.reserve_id | html %]"/></td> |
132 |
<td>[% hold.expirationdate | $KohaDates %]</td> |
131 |
<td>[% hold.expirationdate | $KohaDates %]</td> |
133 |
<td>[% hold.patron_expiration_date | $KohaDates %]</td> |
132 |
<td>[% hold.patron_expiration_date | $KohaDates %]</td> |
|
|
133 |
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% hold.biblionumber | uri %]">[% hold.biblio.title | html %]</a></td> |
134 |
<td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% hold.itemnumber | uri %]&biblionumber=[% hold.biblionumber | uri %]&bi=[% hold.biblionumber | uri %]#item[% hold.itemnumber | uri %]">[% hold.item.barcode | html %]</a></td> |
134 |
<td class="found_status" data-found="[% hold.found | html %]"> |
135 |
<td class="found_status" data-found="[% hold.found | html %]"> |
135 |
[% IF hold.found == "T" %] |
136 |
[% IF hold.found == "T" %] |
136 |
In transit |
137 |
In transit |
Lines 152-195
Link Here
|
152 |
</table> <!-- /#holds --> |
153 |
</table> <!-- /#holds --> |
153 |
</div> <!-- /.page-section --> |
154 |
</div> <!-- /.page-section --> |
154 |
<h2>Modify holds</h2> |
155 |
<h2>Modify holds</h2> |
155 |
<table id="hold_modifies"> |
156 |
<div class="page-section"> |
156 |
<thead> |
157 |
<table id="hold_modifies"> |
157 |
<tr> |
158 |
<thead> |
158 |
<th>New expiration date</th> |
159 |
<tr> |
159 |
<th>New pickup library</th> |
160 |
<th>New expiration date</th> |
160 |
<th>Suspend holds</th> |
161 |
<th>New pickup library</th> |
161 |
<th>Suspend until</th> |
162 |
<th>Suspend holds</th> |
162 |
<th>New reserve note</th> |
163 |
<th>Suspend until</th> |
163 |
</tr> |
164 |
<th>New reserve note</th> |
164 |
</thead> |
165 |
</tr> |
165 |
<tbody> |
166 |
</thead> |
166 |
<tr> |
167 |
<tbody> |
167 |
<td> |
168 |
<tr> |
168 |
<input type="text" id="new_expiration_date" name="new_expiration_date" class="flatpickr" data-flatpickr-futuredate="true"/> |
169 |
<td> |
169 |
</td> |
170 |
<input type="text" id="new_expiration_date" name="new_expiration_date" class="flatpickr" data-flatpickr-futuredate="true"/> |
170 |
<td> |
171 |
</td> |
171 |
<select name="new_pickup_loc" id="new_pickup_loc"> |
172 |
<td> |
172 |
[% PROCESS options_for_libraries libraries => Branches.pickup_locations({ selected => hold.branchcode }) %] |
173 |
<select id="new_pickup_loc" name="new_pickup_loc"> |
173 |
</select> |
174 |
<option value="" selected="selected"></option> |
174 |
</td> |
175 |
[% PROCESS options_for_libraries libraries => Branches.pickup_locations(selected = "") %] |
175 |
<td> |
176 |
</select> |
176 |
<select id="new_suspend_status" name="new_suspend_status"> |
177 |
</td> |
177 |
<option value="" selected="selected"></option> |
178 |
<td> |
178 |
<option value="not_suspended">Not suspended</option> |
179 |
<select id="new_suspend_status" name="new_suspend_status"> |
179 |
<option value="suspend">Suspend</option> |
180 |
<option value="" selected="selected"></option> |
180 |
</select> |
181 |
<option value="not_suspended">Not suspended</option> |
181 |
</td> |
182 |
<option value="suspend">Suspend</option> |
182 |
<td> |
183 |
</select> |
183 |
<input type="text" id="new_suspend_date" name="new_suspend_date" class="flatpickr" data-flatpickr-futuredate="true"/> |
184 |
</td> |
184 |
</td> |
185 |
<td> |
185 |
<td> |
186 |
<input type="text" id="new_suspend_date" name="new_suspend_date" class="flatpickr" data-flatpickr-futuredate="true"/> |
186 |
<input type="text" id="new_reserve_note" name="new_reserve_note"/> |
187 |
</td> |
187 |
</td> |
188 |
<td> |
188 |
</tr> |
189 |
<input type="text" id="new_reserve_note" name="new_reserve_note"/> |
189 |
</tbody> |
190 |
</td> |
190 |
</table> <!-- /#hold_modifies --> |
191 |
</tr> |
|
|
192 |
</tbody> |
193 |
</table> <!-- /#hold_modifies --> |
194 |
</div> |
191 |
<fieldset class="action"> |
195 |
<fieldset class="action"> |
192 |
<input type="hidden" name="op" value="modify"/> |
196 |
<input type="hidden" name="op" value="cud-modify"/> |
193 |
<input type="submit" class="btn btn-primary" value="Modify selected holds"/> |
197 |
<input type="submit" class="btn btn-primary" value="Modify selected holds"/> |
194 |
<a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Cancel</a> |
198 |
<a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Cancel</a> |
195 |
</fieldset> |
199 |
</fieldset> |
Lines 202-218
Link Here
|
202 |
[% END %] |
206 |
[% END %] |
203 |
[% ELSIF view == 'report' %] |
207 |
[% ELSIF view == 'report' %] |
204 |
<div class="dialog message"> |
208 |
<div class="dialog message"> |
205 |
Holds have been modified! |
209 |
[% updated_holds.count | html %] holds have been modified! |
206 |
</div> |
210 |
</div> |
207 |
<div class="page-section"> |
211 |
<div class="page-section"> |
208 |
<div class="btn-toolbar selections-toolbar"> |
|
|
209 |
<a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a> |
210 |
<a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a> |
211 |
</div> |
212 |
<table id="holds"> |
212 |
<table id="holds"> |
213 |
<thead> |
213 |
<thead> |
214 |
<tr> |
214 |
<tr> |
215 |
<th>Expiration date</th> |
215 |
<th>Expiration date</th> |
|
|
216 |
<th>Title</th> |
217 |
<th>Barcode</th> |
216 |
<th>Hold pickup library</th> |
218 |
<th>Hold pickup library</th> |
217 |
<th>Suspended</th> |
219 |
<th>Suspended</th> |
218 |
<th>Suspended until</th> |
220 |
<th>Suspended until</th> |
Lines 223-228
Link Here
|
223 |
[% FOREACH hold IN updated_holds %] |
225 |
[% FOREACH hold IN updated_holds %] |
224 |
<tr> |
226 |
<tr> |
225 |
<td>[% hold.expirationdate | $KohaDates %]</td> |
227 |
<td>[% hold.expirationdate | $KohaDates %]</td> |
|
|
228 |
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% hold.biblionumber | uri %]">[% hold.biblio.title | html %]</a></td> |
229 |
<td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% hold.itemnumber | uri %]&biblionumber=[% hold.biblionumber | uri %]&bi=[% hold.biblionumber | uri %]#item[% hold.itemnumber | uri %]">[% hold.item.barcode | html %]</a></td> |
226 |
<td>[% Branches.GetName( hold.branchcode ) | html %]</td> |
230 |
<td>[% Branches.GetName( hold.branchcode ) | html %]</td> |
227 |
<td>[% IF hold.suspend == 0 %]No[% ELSE %]Yes[% END %]</td> |
231 |
<td>[% IF hold.suspend == 0 %]No[% ELSE %]Yes[% END %]</td> |
228 |
<td>[% hold.suspend_until | $KohaDates %]</td> |
232 |
<td>[% hold.suspend_until | $KohaDates %]</td> |
Lines 244-250
Link Here
|
244 |
</aside> |
248 |
</aside> |
245 |
</div> <!-- /.col-sm-2 col-sm-pull-10 --> |
249 |
</div> <!-- /.col-sm-2 col-sm-pull-10 --> |
246 |
</div> <!-- /.row --> |
250 |
</div> <!-- /.row --> |
247 |
|
251 |
</div> |
248 |
[% MACRO jsinclude BLOCK %] |
252 |
[% MACRO jsinclude BLOCK %] |
249 |
[% Asset.js("js/tools-menu.js") | $raw %] |
253 |
[% Asset.js("js/tools-menu.js") | $raw %] |
250 |
[% INCLUDE 'calendar.inc' %] |
254 |
[% INCLUDE 'calendar.inc' %] |
Lines 279-306
Link Here
|
279 |
})); |
283 |
})); |
280 |
|
284 |
|
281 |
$("#process").on('submit', function(e) { |
285 |
$("#process").on('submit', function(e) { |
|
|
286 |
var errors = []; |
282 |
var reserve_ids = $("input[type=checkbox][name='hold_id']:checked"); |
287 |
var reserve_ids = $("input[type=checkbox][name='hold_id']:checked"); |
283 |
|
288 |
|
|
|
289 |
var new_pickup_loc = $("#new_pickup_loc").val(); |
284 |
var new_suspend_status = $("#new_suspend_status").val(); |
290 |
var new_suspend_status = $("#new_suspend_status").val(); |
285 |
var new_suspend_date = $("#new_suspend_date").val(); |
291 |
var new_suspend_date = $("#new_suspend_date").val(); |
286 |
|
292 |
|
287 |
if ( reserve_ids.length == 0 ) { |
293 |
if ( reserve_ids.length == 0 ) { |
288 |
e.preventDefault(); |
294 |
e.preventDefault(); |
289 |
alert(_("Please select at least one hold to process.")); |
295 |
errors.push(_("Please select at least one hold to process.")); |
290 |
return false; |
296 |
return false; |
291 |
} |
297 |
} |
292 |
if( new_suspend_status ){ |
298 |
if( new_pickup_loc || new_suspend_status ){ |
293 |
reserve_ids.each(function(){ |
299 |
reserve_ids.each(function(){ |
294 |
if($(this).parents("tr").children(".found_status").data("found") != ""){ |
300 |
if($(this).parents("tr").children(".found_status").data("found") != ""){ |
295 |
e.preventDefault(); |
301 |
e.preventDefault(); |
296 |
alert(_("One or more holds have found status and can't be suspended.")); |
302 |
if( new_suspend_status ){ |
|
|
303 |
errors.push(_("One or more holds have found status and can't be suspended.")); |
304 |
} |
305 |
if( new_pickup_loc ){ |
306 |
errors.push(_("One or more holds have found status and their pick up location can't be changed.")); |
307 |
} |
297 |
return false; |
308 |
return false; |
298 |
} |
309 |
} |
299 |
}) |
310 |
}) |
300 |
} |
311 |
} |
301 |
if( ( !new_suspend_status || new_suspend_status == "not_suspended") && new_suspend_date ){ |
312 |
if( ( !new_suspend_status || new_suspend_status == "not_suspended") && new_suspend_date ){ |
302 |
e.preventDefault(); |
313 |
e.preventDefault(); |
303 |
alert(_('You have to suspend holds if new suspend until date is set.')); |
314 |
errors.push(_("You have to suspend holds if new suspend until date is set.")); |
|
|
315 |
return false; |
316 |
} |
317 |
|
318 |
if (errors.length > 0) { |
319 |
e.preventDefault(); |
320 |
$("#errorList").html(errors.map(error => `<li>${error}</li>`).join("")); |
321 |
$("#errorModal").modal('show'); |
304 |
return false; |
322 |
return false; |
305 |
} |
323 |
} |
306 |
|
324 |
|