Main Koha release repository https://koha-community.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

280 lines
14 KiB

[% USE raw %]
[% USE Asset %]
[% SET footerjs = 1 %]
[% USE Branches %]
[% USE Categories %]
[% USE KohaDates %]
[% USE ItemTypes %]
[% PROCESS 'html_helpers.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Batch extend due dates</title>
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("css/humanmsg.css") | $raw %]
</head>
<body id="tools_batch_extend_due_dates" class="tools">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
<a href="/cgi-bin/koha/tools/batch_extend_due_dates.pl">Batch extend due dates</a>
</div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
<h1>Batch extend due dates</h1>
[% IF ( messages ) %]
<div class="dialog message">
[% FOREACH message IN messages %]
[% IF message.type == 'success' %]
<div><i class="fa fa-check success"></i>
[% ELSIF message.type == 'warning' %]
<div><i class="fa fa-warning warn"></i>
[% ELSIF message.type == 'error' %]
<div><i class="fa fa-exclamation error"></i>
[% END %]
[% IF message.error %]
(The error was: [% message.error | html %]. See the Koha logfile for more information).
[% END %]
</div>
[% END %]
</div> <!-- .dialog.message -->
[% END %]
[% IF view == 'form' %]
<form method="post" action="/cgi-bin/koha/tools/batch_extend_due_dates.pl" id="extend_due_dates_form">
<fieldset class="rows">
<legend>Checkout criteria:</legend>
<ol>
<li>
<label for="categorycodes">Patrons' categories: </label>
[% SET categories = Categories.all() %]
<select id="categorycodes" name="categorycodes" multiple="multiple">
[% FOREACH cat IN categories %]
<option value="[% cat.categorycode | html %]">[% cat.description | html %]</option>
[% END %]
</select>
</li>
<li>
<label for="branchcodes">Libraries: </label>
<select name="branchcodes" id="branchcodes" multiple="multiple">
[% PROCESS options_for_libraries libraries => Branches.all() %]
</select>
</li>
<li>
<label for="from_due_date">Due date from: </label>
<input type="text" size="10" id="from" name="from_due_date" class="datepickerfrom" />
</li>
<li>
<label for="to_due_date">Due date to:</label>
<input type="text" size="10" id="to" name="to_due_date" class="datepickerto" />
</li>
</ol>
</fieldset>
<fieldset class="rows">
<legend>New due date:</legend>
<ol>
<li>
<label for="new_hard_due_date">Hard due date: </label>
<input type="text" size="10" id="new_hard_due_date" name="new_hard_due_date" class="datepicker" />
</li>
<li>
<label for="due_date_days">Or add number of days:</label>
<input type="text" size="10" id="due_date_days" name="due_date_days"/>
</li>
</ol>
</fieldset>
<fieldset class="rows">
<legend>Options:</legend>
<ol>
<li>
<label for="preview_results">Preview results:</label>
<input type="checkbox" name="preview_results" id="preview_results" checked />
<span class="hint">This is not recommended when changing very large numbers of due dates.</span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="hidden" name="op" value="list" />
<input type="submit" value="Continue" class="button" />
<a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
</fieldset>
</form> <!-- /#extend_due_dates_form -->
[% ELSIF view == 'list' %]
[% IF checkouts.count %]
<form action="/cgi-bin/koha/tools/batch_extend_due_dates.pl" method="post" id="process">
<div id="toolbar">
<a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
| <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
</div>
<table id="checkouts">
<thead>
<tr>
<th>&nbsp;</th>
<th>Due date</th>
<th>Title</th>
<th>Item type</th>
<th>Home library</th>
<th>Checked out on</th>
<th>Checked out from</th>
<th>New due date</th>
</tr>
</thead>
<tbody>
[% FOR checkout IN checkouts %]
<tr>
<td><input type="checkbox" name="issue_id" value="[% checkout.issue_id | html %]" /></td>
<td>[% checkout.date_due | $KohaDates as_due_date => 1 %]</td>
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% checkout.item.biblio.biblionumber | uri %]">[% checkout.item.biblio.title | html %]</a></td>
<td>[% ItemTypes.GetDescription( checkout.item.effective_itemtype ) | html %]</td>
<td>[% checkout.item.home_branch.branchname | html %]</td>
<td>[% checkout.issuedate | $KohaDates %]</td>
<td>[% Branches.GetName( checkout.branchcode ) | html %]</td>
<td>
[% new_due_dates.shift | $KohaDates as_due_date => 1 %]
</td>
</tr>
[% END %]
</tbody>
</table> <!-- /#checkouts -->
<div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected checkouts!</div>
<fieldset class="action">
<input type="hidden" name="op" value="modify" />
<input type="hidden" name="new_hard_due_date" value="[% new_hard_due_date | $KohaDates %]" />
<input type="hidden" name="due_date_days" value="[% due_date_days | html %]" />
<input type="submit" value="Modify selected checkouts" class="button" />
<a class="cancel" href="/cgi-bin/koha/tools/batch_extend_due_dates.pl">Cancel</a>
</fieldset>
</form> <!-- /#process -->
[% ELSE %]
<div class="dialog message">
No checkouts for the selected filters.
</div>
[% END %]
[% ELSIF view == 'report' %]
<div class="dialog message">
Due dates have been modified!
</div>
<table id="checkouts_result">
<thead>
<tr>
<th>Due date</th>
<th>Title</th>
<th>Item type</th>
<th>Home library</th>
<th>Checked out on</th>
<th>Checked out from</th>
</tr>
</thead>
<tbody>
[% FOR checkout IN checkouts %]
<tr>
<td>[% checkout.date_due | $KohaDates as_due_date => 1 %]</td>
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% checkout.item.biblio.biblionumber | uri %]">[% checkout.item.biblio.title | html %]</a></td>
<td>[% ItemTypes.GetDescription( checkout.item.effective_itemtype ) | html %]</td>
<td>[% checkout.item.home_branch.branchname | html %]</td>
<td>[% checkout.issuedate | $KohaDates %]</td>
<td>[% Branches.GetName( checkout.branchcode ) | html %]</td>
</tr>
[% END %]
</tbody>
</table> <!-- /#checkouts_result -->
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'tools-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/tools-menu.js") | $raw %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
[% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
<script>
$(document).ready(function() {
$("#selectall").click(function(e){
e.preventDefault();
$("#checkouts input[type='checkbox']").each(function(){
$(this).prop("checked", true);
});
});
$("#clearall").click(function(e){
e.preventDefault();
$("#checkouts input[type='checkbox']").each(function(){
$(this).prop("checked", false);
});
});
$("#selectall").click();
$("#checkouts").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
{ "aTargets": [1], "sType": "num-html" }
],
"sDom": 't',
"aaSorting": [],
"bPaginate": false
}));
$("#checkouts_result").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [0, 3], "bSortable": false, "bSearchable": false },
{ "aTargets": [1], "sType": "num-html" }
],
"sDom": 't',
"aaSorting": [],
"bPaginate": false
}));
$("#extend_due_dates_form").on('submit', function(e) {
var new_hard_due_date = $("#new_hard_due_date").val();
var due_date_days = $("#due_date_days").val();
if (new_hard_due_date && due_date_days ) {
e.preventDefault();
alert(_("You must fill only one of the two due date options"));
return false;
} else if ( !new_hard_due_date && !due_date_days ) {
e.preventDefault();
alert(_("You must fill at least one of the two due date options"));
return false;
}
return true;
});
$("#process").on('submit', function(e) {
if ($("input[type=checkbox][name='issue_id']:checked").length == 0) {
e.preventDefault();
alert(_("Please select at least one checkout to process"));
return false;
}
return true;
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]