Owen Leonard
a4d1fd124b
Replace the tablesorter plugin with the DataTables plugin on the serials claims page. This patch replaces some custom table fitlering code with code which uses DataTables' built-in table fitlering. A minor correction to markup has also been made to properly align inputs in the filter form. To test, run the serials claims report for a vendor with data which will populate results. Confirm that table sorting works correctly. Confirm also that filtering by title and branch works. Signed-off-by: Frédéric Demians <f.demians@tamil.fr> Works as advertised. I have compared side by side the both pages, with tablesorter, and with DataTables. The both work. No regression. With DataTables, no more sorting on Begin clam column, which is great. A new sort option may be usefull on the Library column (wasn't the with tablesorter neither). Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
392 lines
14 KiB
Text
392 lines
14 KiB
Text
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Serials › Claims</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% INCLUDE 'calendar.inc' %]
|
|
<link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/datatables.css" />
|
|
<script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
|
|
[% INCLUDE 'datatables-strings.inc' %]
|
|
<script type="text/javascript" src="/intranet-tmpl/prog/en/js/datatables.js"></script>
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
[% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %]
|
|
$(document).ready(function() {
|
|
[% UNLESS ( preview ) %]
|
|
var sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"sDom": 't',
|
|
"aoColumnDefs": [
|
|
{ "aTargets": [ 0,1,-1 ], "bSortable": false, "bSearchable": false }
|
|
],
|
|
"bPaginate": false
|
|
}));
|
|
[% END %]
|
|
$('#supplierid').change(function() {
|
|
$('#claims').submit();
|
|
});
|
|
|
|
// Checkboxes : Select All / None
|
|
$("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>");
|
|
$("span.exportSelected").html("<a id=\"ExportSelected\" href=\"/cgi-bin/koha/serials/claims.pl\"> "+_("Export selected items data") +"<\/a>");
|
|
|
|
$("#CheckAll").click(function() {
|
|
$("#claimst tr:visible :checkbox").attr('checked', $("#CheckAll").is(':checked'));
|
|
});
|
|
|
|
// Generates a dynamic link for exporting the selection's data as CSV
|
|
$("#ExportSelected").click(function() {
|
|
// We use input:checked because it's faster, but if there must new checkboxes
|
|
// used for other purpose on this page, please use [name=serialid]:checked instead
|
|
var selected = $("input:checked");
|
|
|
|
if (selected.length == 0) {
|
|
alert(_("Please select at least one item to export."));
|
|
return false;
|
|
}
|
|
|
|
// Building the url from currently checked boxes
|
|
var url = '/cgi-bin/koha/serials/lateissues-excel.pl?supplierid=&op=claims';
|
|
for (var i = 0; i < selected.length; i++) {
|
|
url += '&serialid=' + selected[i].value;
|
|
}
|
|
// And redirecting to the CSV page
|
|
location.href = url;
|
|
return false;
|
|
});
|
|
|
|
$("#titlefilter").keyup( function () {
|
|
sTable.fnFilter( this.value, 3 ); // 3 is position of title column
|
|
} );
|
|
|
|
$("#branchfilter").keyup(function() {
|
|
sTable.fnFilter( this.value, 2 ); // 2 is the position of the author column
|
|
});
|
|
});
|
|
|
|
// Checks if the form can be sent (at least one checkbox must be checked)
|
|
function checkForm() {
|
|
if ($("input:checked").length == 0) {
|
|
alert(_("Please select at least one item."));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// Filter by status
|
|
function filterByStatus() {
|
|
selectedStatus = $("#statusfilter").val();
|
|
if (selectedStatus == "all") {
|
|
clearFilters();
|
|
} else {
|
|
$("table#claimst tbody tr").hide();
|
|
$("table#claimst tbody tr:contains(" + selectedStatus + ")").show();
|
|
}
|
|
}
|
|
|
|
// Filter by branch
|
|
function filterByBranch() {
|
|
selectedBranch = $("#branchfilter").val();
|
|
if (selectedBranch == "all") {
|
|
clearFilters();
|
|
} else {
|
|
$("table#claimst tbody tr").hide();
|
|
$("table#claimst tbody tr:contains(" + selectedBranch + ")").show();
|
|
}
|
|
}
|
|
// Filter by date
|
|
function filterByDate() {
|
|
var beginDate = Date_from_syspref($("#from").val()).getTime();
|
|
var endDate = Date_from_syspref($("#to").val()).getTime();
|
|
|
|
// Checks if the beginning date is valid
|
|
if (!parseInt(beginDate)) {
|
|
alert(_("The beginning date is missing or invalid."));
|
|
return false;
|
|
}
|
|
|
|
// Checks if the ending date is valid
|
|
if (!parseInt(endDate)) {
|
|
alert(_("The ending date is missing or invalid."));
|
|
return false;
|
|
}
|
|
|
|
// Checks if beginning date is before ending date
|
|
if (beginDate > endDate) {
|
|
// If not, we swap them
|
|
var tmpDate = endDate;
|
|
endDate = beginDate;
|
|
beginDate = tmpDate;
|
|
}
|
|
|
|
// We hide everything
|
|
$("table#claimst tbody tr").hide();
|
|
|
|
// For each date in the table
|
|
$(".planneddate").each(function() {
|
|
|
|
// We make a JS Date Object, according to the locale
|
|
var pdate = Date_from_syspref($(this).text()).getTime();
|
|
|
|
// And checks if the date is between the beginning and ending dates
|
|
if (pdate > beginDate &&
|
|
pdate < endDate) {
|
|
// If so, we can show the row
|
|
$(this).parent().show();
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
// Clears filters : shows everything
|
|
function clearFilters() {
|
|
$("table#claimst tbody tr").show();
|
|
}
|
|
|
|
function popup(supplierid,serialid){
|
|
window.open('claims.pl?supplierid='+ supplierid +'&serialid='+ serialid +'&op=preview' ,'popup', 'width=600,height=400,toolbar=no,scrollbars=yes');
|
|
}
|
|
|
|
//]]>
|
|
</script>
|
|
</head>
|
|
<body id="ser_claims" class="ser">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% UNLESS ( preview ) %]
|
|
[% INCLUDE 'serials-search.inc' %]
|
|
[% END %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> › Claims</div>
|
|
|
|
[% UNLESS ( preview ) %]
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
|
|
<h1>Claims</h1>
|
|
|
|
[% IF ( letter ) %][% UNLESS ( missingissues ) %][% IF ( supplierid ) %] <div class="dialog alert">No missing issues found.</div>[% ELSE %]<div class="dialog message">Please choose a vendor.</div>[% END %][% END %][% END %]
|
|
|
|
[% IF ( SHOWCONFIRMATION ) %]
|
|
<div class="dialog alert">Your notification has been sent.</div>
|
|
[% END %]
|
|
[% UNLESS ( letter ) %]<div class="dialog alert">No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>.</div>[% END %]
|
|
<form id="claims" name="claims" action="claims.pl" method="post">
|
|
<fieldset>
|
|
<label for="supplierid">Vendor: </label>
|
|
<select id="supplierid" name="supplierid">
|
|
[% FOREACH suploo IN suploop %]
|
|
[% IF ( suploo.selected ) %]
|
|
<option value="[% suploo.id %]" selected="selected" >
|
|
[% ELSE %]
|
|
<option value="[% suploo.id %]">
|
|
[% END %]
|
|
[% suploo.name %]
|
|
([% suploo.count %])
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
<input type="submit" value="OK" />
|
|
[% IF ( phone ) %]Phone: [% phone %][% END %]
|
|
[% IF ( booksellerfax ) %]Fax: [% booksellerfax %][% END %]
|
|
[% IF ( bookselleremail ) %]</p><p><a href="mailto:[% bookselleremail %]">[% bookselleremail %]</a>[% END %]
|
|
</fieldset>
|
|
</form>
|
|
|
|
[% IF ( missingissues ) %]
|
|
<h3>Missing issues</h3>
|
|
<form action="claims.pl" onsubmit="return false;">
|
|
<fieldset class="rows">
|
|
<legend>Filters :</legend>
|
|
|
|
<ol>
|
|
<li>
|
|
<label for="statusfilter">Status : </label>
|
|
<select id="statusfilter" onchange="filterByStatus();">
|
|
<option value="all" selected="selected">(All)</option>
|
|
<option>Expected</option>
|
|
<option>Arrived</option>
|
|
<option>Late</option>
|
|
<option>Missing</option>
|
|
<option>Claimed</option>
|
|
<option>Stopped</option>
|
|
</select>
|
|
</li>
|
|
|
|
<li>
|
|
<label for="titlefilter">Title : </label>
|
|
<input id="titlefilter" type="text" />
|
|
</li>
|
|
<li>
|
|
<label for="branchfilter">Library: </label>
|
|
<select id="branchfilter" onchange="filterByBranch();">
|
|
[% FOREACH branchloo IN branchloop %]
|
|
[% IF ( branchloo.selected ) %]
|
|
<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
|
|
[% ELSE %]
|
|
<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
|
|
<li>
|
|
<label for="from">From:</label>
|
|
<input type="text" name="begindate" id="from" value="[% begindate %]" size="10" maxlength="10" class="datepickerfrom" />
|
|
<label for="to" style="float:none;">To:</label>
|
|
<input type="text" name="enddate" id="to" value="[% enddate %]" size="10" maxlength="10" class="datepickerto" />
|
|
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
|
|
<input type="button" value="OK" onclick="filterByDate();" />
|
|
</li>
|
|
|
|
<li>
|
|
<input type="reset" value="Clear filters" onclick="clearFilters();" />
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
</form>
|
|
|
|
<fieldset>
|
|
<form action="claims.pl" method="post" class="checkboxed" onsubmit="return checkForm()">
|
|
<input type="hidden" name="order" value="[% order %]" />
|
|
<table id="claimst">
|
|
<thead><tr>
|
|
[% IF ( letter ) %]
|
|
<th><input type="checkbox" id="CheckAll"></th>
|
|
[% END %]
|
|
<th>Vendor</th>
|
|
<th>Library</th>
|
|
<th>Title</th>
|
|
<th>Issue number</th>
|
|
<th>Status</th>
|
|
<th>Since</th>
|
|
<th>Claim date</th>
|
|
<th>Begin claim</th>
|
|
</tr></thead>
|
|
<tbody>[% FOREACH missingissue IN missingissues %]
|
|
<tr>
|
|
[% IF ( letter ) %]
|
|
<td>
|
|
<input type="checkbox" name="serialid" value="[% missingissue.serialid %]" />
|
|
</td>
|
|
[% END %]
|
|
<td>
|
|
[% missingissue.name %]
|
|
</td>
|
|
<td>
|
|
[% missingissue.branchcode %]
|
|
</td>
|
|
<td>
|
|
<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid %]">[% missingissue.title |html %]</a>
|
|
</td>
|
|
<td>
|
|
[% missingissue.serialseq %]
|
|
</td>
|
|
<td>
|
|
[% IF ( missingissue.status1 ) %]Expected[% END %]
|
|
[% IF ( missingissue.status2 ) %]Arrived[% END %]
|
|
[% IF ( missingissue.status3 ) %]Late[% END %]
|
|
[% IF ( missingissue.status4 ) %]Missing[% END %]
|
|
[% IF ( missingissue.status7 ) %]Claimed[% END %]
|
|
[% IF ( missingissue.status8 ) %]Stopped[% END %]
|
|
</td>
|
|
<td class="planneddate">
|
|
[% missingissue.planneddate %]
|
|
</td>
|
|
<td>
|
|
[% missingissue.claimdate %]
|
|
</td>
|
|
<td>
|
|
<a href="/cgi-bin/koha/serials/lateissues-excel.pl?supplierid=[% missingissue.supplieri %]&serialid=[% missingissue.serialid %]&op=claims">Export item data</a>
|
|
</td>
|
|
</tr>
|
|
[% END %]</tbody>
|
|
</table>
|
|
<p><span class="exportSelected"></span></p>
|
|
|
|
[% IF ( letter ) %]
|
|
<fieldset class="action"> <label for="letter_code">Select notice:</label>
|
|
<select name="letter_code" id="letter_code">
|
|
[% FOREACH letter IN letters %]
|
|
<option value="[% letter.code %]">[% letter.name %]</option>
|
|
[% END %]
|
|
</select>
|
|
<input type="hidden" name="op" value="send_alert" /><input type="submit" name="submit" class="button" value="Send notification" /></fieldset>
|
|
[% END %]
|
|
</form>
|
|
</fieldset>
|
|
[% END %]
|
|
|
|
[% ELSE %]
|
|
|
|
<div id="doc" class="yui-t7">
|
|
<div id="bd">
|
|
|
|
[% IF ( supplierloop ) %]
|
|
[% FOREACH supplierloo IN supplierloop %]
|
|
[% IF ( supplierloo.name ) %]
|
|
<p><b>[% supplierloo.name %]</b><br />
|
|
[% END %]
|
|
[% IF ( supplierloo.postal ) %]
|
|
[% supplierloo.postal %]<br />
|
|
[% END %]
|
|
[% IF ( supplierloo.contphone ) %]
|
|
Ph: [% supplierloo.contphone %]<br />
|
|
[% END %]
|
|
[% IF ( supplierloo.contfax ) %]
|
|
Fax: [% supplierloo.contfax %]<br />
|
|
[% END %]
|
|
[% IF ( supplierloo.contemail ) %]
|
|
Email: [% supplierloo.contemail %]<br />
|
|
[% END %]
|
|
[% IF ( supplierloo.accountnumber ) %]
|
|
A/C: [% supplierloo.accountnumber %]</p>
|
|
[% END %]
|
|
[% IF ( supplierloo.contact ) %]
|
|
<p>Dear [% supplierloo.contact %]</p>
|
|
[% ELSE %]
|
|
<p>To whom it may concern</p>
|
|
[% END %]
|
|
<p>The following items have not been received from you and are now considered missing:</p>
|
|
[% END %]
|
|
[% END %]
|
|
[% IF ( missingissues ) %]
|
|
<h3>Missing issues</h3>
|
|
<table>
|
|
<tr>
|
|
<td><b>Vendor<b></td>
|
|
<td><b>Title</b></td>
|
|
<td><b>Issue number</b></td>
|
|
<td><b>Missing since</b></td>
|
|
</tr>
|
|
[% FOREACH missingissue IN missingissues %]
|
|
<tr>
|
|
<td>
|
|
[% missingissue.name %]
|
|
</td>
|
|
<td>
|
|
[% missingissue.Title |html %]
|
|
</td>
|
|
<td>
|
|
[% missingissue.serialseq %]
|
|
</td>
|
|
<td>
|
|
[% missingissue.planneddate %]
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</table>
|
|
[% END %]
|
|
|
|
<p class="noprint"><a href="#" onclick="window.print(); return false;">Print</a> <a href="#" class="close">Close</a></p>
|
|
[% END %]
|
|
|
|
</div>
|
|
</div>
|
|
|
|
[% UNLESS ( preview ) %]
|
|
<div class="yui-b">
|
|
[% INCLUDE 'serials-menu.inc' %]
|
|
</div>
|
|
[% END %]
|
|
</div>
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|