|
Lines 42-48
Link Here
|
| 42 |
<div class="col-sm-10 col-sm-push-2 order-sm-1"> |
42 |
<div class="col-sm-10 col-sm-push-2 order-sm-1"> |
| 43 |
<main> |
43 |
<main> |
| 44 |
<h1>Batch modify holds</h1> |
44 |
<h1>Batch modify holds</h1> |
| 45 |
[% IF view == "form" %] |
45 |
[% IF view == "cud-form" %] |
| 46 |
<div id="modify_holds_search"> |
46 |
<div id="modify_holds_search"> |
| 47 |
<form method="get" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form"> |
47 |
<form method="get" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form"> |
| 48 |
<fieldset class="rows"> |
48 |
<fieldset class="rows"> |
|
Lines 50-56
Link Here
|
| 50 |
<ol> |
50 |
<ol> |
| 51 |
<li> |
51 |
<li> |
| 52 |
<label for="expirationdate_from">Expiration date from:</label> |
52 |
<label for="expirationdate_from">Expiration date from:</label> |
| 53 |
<input type="text" size="10" id="expirationdate_from" name="expirationdate_from" class="flatpickr" data-date_to="expirationdate_to" /> |
53 |
<input type="text" size="10" id="expirationdate_from" name="expirationdate_from" class="flatpickr" /> |
| 54 |
</li> |
54 |
</li> |
| 55 |
<li> |
55 |
<li> |
| 56 |
<label for="expirationdate_to">Expiration date to:</label> |
56 |
<label for="expirationdate_to">Expiration date to:</label> |
|
Lines 303-311
Link Here
|
| 303 |
var expirationdate_from = modify_holds_form.find("#expirationdate_from").val(); |
303 |
var expirationdate_from = modify_holds_form.find("#expirationdate_from").val(); |
| 304 |
var expirationdate_to = modify_holds_form.find("#expirationdate_to").val(); |
304 |
var expirationdate_to = modify_holds_form.find("#expirationdate_to").val(); |
| 305 |
|
305 |
|
| 306 |
searchpattern += expirationdate_from && expirationdate_to ? _("expiration date between ")+ expirationdate_from + " and " + expirationdate_to + " ": ""; |
306 |
if (expirationdate_from && expirationdate_to){ |
| 307 |
|
307 |
searchpattern += _("expiration date between ") + expirationdate_from + " and " + expirationdate_to + " "; |
| 308 |
return expirationdate_from && expirationdate_to ? {"-between": [expirationdate_from, expirationdate_to]} : ""; |
308 |
return {"-between": [expirationdate_from, expirationdate_to]}; |
|
|
309 |
} |
| 310 |
else if (expirationdate_from && !expirationdate_to){ |
| 311 |
searchpattern += _("expiration date from ") + expirationdate_from + " "; |
| 312 |
return {">=": expirationdate_from }; |
| 313 |
} else if (!expirationdate_from && expirationdate_to){ |
| 314 |
searchpattern += _("expiration date to ") + expirationdate_to + " "; |
| 315 |
return {"<=": expirationdate_to }; |
| 316 |
} |
| 309 |
}, |
317 |
}, |
| 310 |
"me.branchcode": function(){ |
318 |
"me.branchcode": function(){ |
| 311 |
var branchcodes = modify_holds_form.find("#branchcodes").val(); |
319 |
var branchcodes = modify_holds_form.find("#branchcodes").val(); |
|
Lines 354-360
Link Here
|
| 354 |
var suspend_until_from = modify_holds_form.find("#suspend_until_from").val(); |
362 |
var suspend_until_from = modify_holds_form.find("#suspend_until_from").val(); |
| 355 |
var suspend_until_to = modify_holds_form.find("#suspend_until_to").val(); |
363 |
var suspend_until_to = modify_holds_form.find("#suspend_until_to").val(); |
| 356 |
|
364 |
|
| 357 |
searchpattern += suspend_until_from && suspend_until_to ? _("suspend date between ")+ suspend_until_from +"-"+suspend_until_to : ""; |
365 |
searchpattern += suspend_until_from && suspend_until_to ? _("suspend date between ")+ suspend_until_from +" and "+suspend_until_to : ""; |
| 358 |
|
366 |
|
| 359 |
return suspend_until_from && suspend_until_to ? {"-between": [suspend_until_from, suspend_until_to]} : ""; |
367 |
return suspend_until_from && suspend_until_to ? {"-between": [suspend_until_from, suspend_until_to]} : ""; |
| 360 |
}, |
368 |
}, |
|
Lines 468-477
Link Here
|
| 468 |
{ |
476 |
{ |
| 469 |
"data": "suspended", |
477 |
"data": "suspended", |
| 470 |
"name": "suspended", |
478 |
"name": "suspended", |
|
|
479 |
"className": "suspended", |
| 471 |
"title": _("Suspended"), |
480 |
"title": _("Suspended"), |
| 472 |
"orderable": true, |
481 |
"orderable": true, |
| 473 |
"render": function( data, type, row, meta ) { |
482 |
"render": function( data, type, row, meta ) { |
| 474 |
return data == 0 ? _("No") : _("Yes"); |
483 |
var suspended_string = data == 0 ? _("No") : _("Yes"); |
|
|
484 |
return "<span data-suspended='" + data + "'>" + suspended_string + "</span>"; |
| 475 |
} |
485 |
} |
| 476 |
}, |
486 |
}, |
| 477 |
{ |
487 |
{ |
|
Lines 521-527
Link Here
|
| 521 |
errors.push(_("Please select at least one hold to process.")); |
531 |
errors.push(_("Please select at least one hold to process.")); |
| 522 |
} |
532 |
} |
| 523 |
|
533 |
|
| 524 |
if( new_pickup_loc || new_suspend_status ){ |
534 |
if( new_pickup_loc || new_suspend_status || new_suspend_date ){ |
| 525 |
var found = false; |
535 |
var found = false; |
| 526 |
holds_checked.each(function(){ |
536 |
holds_checked.each(function(){ |
| 527 |
if($(this).parents("tr").children(".found_status").children("span").data("found-status")){ |
537 |
if($(this).parents("tr").children(".found_status").children("span").data("found-status")){ |
|
Lines 529-544
Link Here
|
| 529 |
found = true; |
539 |
found = true; |
| 530 |
} |
540 |
} |
| 531 |
}); |
541 |
}); |
| 532 |
if( new_suspend_status && found ){ |
542 |
if( ( new_suspend_status || new_suspend_date ) && found ){ |
| 533 |
errors.push(_("One or more holds have found status and can't be suspended.")); |
543 |
errors.push(_("One or more holds have found status and can't be suspended.")); |
| 534 |
} |
544 |
} |
| 535 |
if( new_pickup_loc && found ){ |
545 |
if( new_pickup_loc && found ){ |
| 536 |
errors.push(_("One or more holds have found status and their pick up location can't be changed.")); |
546 |
errors.push(_("One or more holds have found status and their pick up location can't be changed.")); |
| 537 |
} |
547 |
} |
| 538 |
} |
548 |
} |
| 539 |
if( ( !new_suspend_status || new_suspend_status == "0") && new_suspend_date ){ |
549 |
|
| 540 |
e.preventDefault(); |
550 |
var suspended = false; |
| 541 |
errors.push(_("You have to suspend holds if new suspend until date is set.")); |
551 |
|
|
|
552 |
holds_checked.each(function(){ |
| 553 |
if($(this).parents("tr").children(".suspended").children("span").data("suspended")){ |
| 554 |
suspended = true; |
| 555 |
} |
| 556 |
}); |
| 557 |
|
| 558 |
if( ( !new_suspend_status || new_suspend_status == "0" || !suspended ) && new_suspend_date ){ |
| 559 |
new_suspend_status = 1; |
| 542 |
} |
560 |
} |
| 543 |
|
561 |
|
| 544 |
if (errors.length > 0) { |
562 |
if (errors.length > 0) { |