Koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tmpl
Galen Charlton ab44e2986a bug 2866: Overdues Reports - Upgrading to filter by patron extended attributes
Patch by Rick Welykochy <rick@praxis.com.au> with some squashing
by me.

Bug Report: 2866 Filtering and sorting the overdue report using patron attributes

1. Create a new system preference ?FilterBeforeOverdueReport?
2. Option to filter *before* the overdue report runs, avoiding report slowness
3. Add searchable patron attributes to the list of overdue report filters
4. Add searchable patron attributes to the sort fields on the overdue report
5. add item call number and replacement price
6. the CSV download link now returns the same
   data as the web report, rather than (inconsistently)
   trying to run the overdue_notices.pl batch job
7. always run report if requesting CSV
8. barcodes are now links
9. use item-level item type for overdue itemtype filter

Included is a new callback for searching patron attributes, similar
to circ/ysearch.pl.

The following additional bugs are fixed:

2748: Nothing is output to the .csv file for the "Overdues" circulation report

This is fixed by having circ/overdues.pl produce the CSV output directly instead
of trying to call the overdues cronjob.  The CSV output includes all of the fields
that are displayed on the web table plus the item replacement price and any extended
patron attributes.

2836: overdues.csv may contain HTML
2837: Descending sort doesn't descend on the overdues report plus other probs with report

This enhancement was sponsored by the Plano Independent School District.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-05-28 19:20:36 -05:00

248 lines
12 KiB
Cheetah

<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Circulation &rsaquo; Items Overdue as of <!-- TMPL_VAR NAME="todaysdate" --></title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
function clone_parent(node) {
var parent = node.parentNode;
var clone = parent.cloneNode(true);
$("a", clone).attr("style", "visibility: visible");
$("input", clone).attr("value", "");
var theid = $("span", clone).attr("id") || "";
var parts = theid.match(/^pattrodue-getready-(.*)$/);
if (parts && parts.length > 1)
{
var appendid = "-" + Math.floor(Math.random()*1000+1);
$("span", clone).attr("id",theid+appendid);
theid = $("input", clone).attr("id");
$("input", clone).attr("id",theid+appendid);
theid = $("div[id]", clone).attr("id");
$("div[id]", clone).attr("id",theid+appendid);
var attrcode = $("script", clone).attr("x-code");
var newsuffix = parts[1] + appendid;
create_auto_completion_responder(newsuffix,attrcode);
}
parent.parentNode.insertBefore(clone, parent.nextSibling);
}
function delete_parent(node) {
var parent = node.parentNode;
parent.parentNode.removeChild(parent);
}
function create_auto_completion_responder(uniqueid,attrcode) {
YAHOO.util.Event.onContentReady("pattrodue-getready-"+uniqueid, function() {
new function() {
// Define a custom formatter function
this.fnCustomFormatter = function(oResultItem, sQuery) {
var description = oResultItem[0];
var authorised_value = oResultItem[1];
var aMarkup = [
"<div class='pattrodue-result'>",
description,
" (",
authorised_value,
")",
"</div>"];
return (aMarkup.join(""));
};
// Instantiate an XHR DataSource
this.oACDS = new YAHOO.widget.DS_XHR("/cgi-bin/koha/circ/ypattrodue-attr-search-authvalue.pl/"+attrcode, ["\n", "\t"]);
this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;
this.oACDS.maxCacheEntries = 60;
this.oACDS.queryMatchSubset = true;
// Instantiate an AutoComplete Widget with uniqueid
var myInput = document.getElementById('pattrodue-input-'+uniqueid);
var myContainer = document.getElementById('pattrodue-container-'+uniqueid);
this.oAutoComp = new YAHOO.widget.AutoComplete(myInput,myContainer,this.oACDS);
this.oAutoComp.formatResult = this.fnCustomFormatter;
}
});
}
//]]>
</script>
<style type="text/css">
.sql {display:none;}
</style>
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->
<!-- TMPL_INCLUDE NAME="circ-search.inc" -->
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; Overdues as of <!-- TMPL_VAR NAME="todaysdate" --></div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<!-- TMPL_IF name="noreport" -->
<h2>Overdue Report</h2>
<p>Please choose one or more filters to proceed.</p>
<!-- TMPL_ELSE -->
<h2><!-- TMPL_VAR NAME="nnoverdue" --> Item<!-- TMPL_IF NAME="noverdue_is_plural" -->s<!-- /TMPL_IF -->
Overdue as of <!-- TMPL_VAR NAME="todaysdate" --><!-- TMPL_IF NAME="isfiltered" --> (filtered)<!-- /TMPL_IF --></h2>
<p>
<!-- TMPL_IF NAME="isfiltered" -->
<a href="overdue.pl?op=csv&amp;<!-- TMPL_VAR name="csv_param_string" escape="HTML" -->">Download file of displayed overdues</a>
<!-- TMPL_ELSE -->
<a href="overdue.pl?op=csv">Download file of all overdues</a>
<!-- /TMPL_IF -->
</p>
<div class="sql"><pre><!-- TMPL_VAR NAME="sql" ESCAPE="HTML" --></pre></div>
<div class="searchresults">
<table id="overduest">
<thead><tr>
<th>Due Date</th>
<th>Patron</th>
<th>Library</th>
<th>Title</th>
<th>Barcode</th>
<th>Call number</th>
</tr></thead>
<tbody><!-- TMPL_LOOP NAME="overdueloop" -->
<tr>
<td><!-- TMPL_VAR NAME="duedate" --></td>
<td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR name="borrowernumber"-->"><!-- TMPL_VAR NAME="name" --></a>
<!-- TMPL_IF NAME="email" -->[<a href="mailto:<!-- TMPL_VAR NAME="email" -->?subject=Overdue: <!-- TMPL_VAR NAME="title" -->">email</a>]<!-- /TMPL_IF -->
(<!--TMPL_IF NAME="phone" --><!-- TMPL_VAR NAME="phone" --><!-- TMPL_ELSIF NAME="mobile" --><!-- TMPL_VAR NAME="mobile" --><!-- TMPL_ELSIF NAME="phonepro" --><!-- TMPL_VAR NAME="phonepro" --><!-- /TMPL_IF -->)</td>
<td><!-- TMPL_VAR name="branchcode" --></td>
<td><!-- TMPL_IF name="BiblioDefaultViewmarc" -->
<a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" escape="html" --></a>
<!-- TMPL_ELSIF NAME="BiblioDefaultViewisbd" -->
<a href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" escape="html" --></a>
<!-- TMPL_ELSE -->
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" escape="html" --> <!-- TMPL_VAR NAME="subtitle" --></a><!-- /TMPL_IF --> <!-- TMPL_IF NAME="author" -->, by <!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF -->
</td>
<td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnum" -->#item<!-- TMPL_VAR NAME="itemnum" -->"><!-- TMPL_VAR name="barcode" --></a></td>
<td><!-- TMPL_VAR name="itemcallnumber" --></td>
</tr>
<!-- /TMPL_LOOP --></tbody>
</table>
</div>
<!-- /TMPL_IF --> <!-- noreport -->
</div>
</div>
<div class="yui-b">
<form method="post" action="/cgi-bin/koha/circ/overdue.pl">
<fieldset class="brief">
<h4>Filter On:</h4>
<ol>
<li><label>Name or cardnumber:</label><input type="text" name="borname" value="<!--TMPL_VAR Name="borname" escape="html" -->" /></li>
<li><label>Patron category:</label><select name="borcat" id="borcat"><option value="">Any</option>
<!-- TMPL_LOOP name="borcatloop" -->
<!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="value" escape="html" -->" selected="selected"><!-- TMPL_VAR name="catname" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="value" escape="html" -->"><!-- TMPL_VAR name="catname" --></option><!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</select>
</li>
<li><label>Patron flags:</label>
<select name="borflag" size="1" id="borflag">
<option value="">None</option>
<option value="gonenoaddress"<!-- TMPL_IF NAME="borflag_gonenoaddress" --> selected="selected"<!-- /TMPL_IF -->>Address in question</option>
<option value="debarred"<!-- TMPL_IF NAME="borflag_debarred" --> selected="selected"<!-- /TMPL_IF -->>Debarred</option>
<option value="lost"<!-- TMPL_IF NAME="borflag_lost" --> selected="selected"<!-- /TMPL_IF -->>Lost Card</option>
</select>
</li>
<!-- TMPL_LOOP name="patron_attr_filter_loop" -->
<!-- domid cgivalue ismany isclone ordinal code description repeatable authorised_value_category -->
<li>
<label><!-- TMPL_VAR name="description" -->:</label>
<!-- TMPL_IF NAME="authorised_value_category"-->
<script type="text/JavaScript" language="JavaScript" x-code="<!-- TMPL_VAR name="code" escape="html" -->">create_auto_completion_responder(<!-- TMPL_VAR name="domid" -->,"<!-- TMPL_VAR name="code" escape="html" -->");</script>
<span id="pattrodue-getready-<!-- TMPL_VAR name="domid" -->">
<div class="pattrodue-autocomplete">
<input autocomplete="off" id="pattrodue-input-<!-- TMPL_VAR name="domid" -->" name="patron_attr_filter_<!-- TMPL_VAR name="code" escape="html" -->" value="<!-- TMPL_VAR name="cgivalue" escape="html" -->" class="pattrodue-input" type="text" />
<div id="pattrodue-container-<!-- TMPL_VAR name="domid" -->" class="pattrodue-container"></div>
</div>
</span>
<!-- TMPL_ELSE -->
<input name="patron_attr_filter_<!-- TMPL_VAR name="code" escape="html" -->" value="<!-- TMPL_VAR name="cgivalue" escape="html" -->"/>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="repeatable"-->
<a href="#" onclick="clone_parent(this); return false;">Add</a>
<!-- TMPL_IF NAME="isclone" -->
<a href="#" onclick="delete_parent(this); return false;" style="visibility: visible">Delete</a>
<!-- TMPL_ELSIF NAME="ismany" -->
<a href="#" onclick="delete_parent(this); return false;" style="visibility: visible">Delete</a>
<!-- TMPL_ELSE -->
<a href="#" onclick="delete_parent(this); return false;" style="visibility: hidden">Delete</a>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
</li>
<!-- /TMPL_LOOP -->
<li><label>Item type:</label><select name="itemtype" id="itemtype"><option value="">Any</option>
<!-- TMPL_LOOP name="itemtypeloop" --><!-- TMPL_IF NAME="selected" -->
<option value="<!-- TMPL_VAR name="value" escape="html" -->" selected="selected"><!-- TMPL_VAR name="itemtypename" --></option><!-- TMPL_ELSE -->
<option value="<!-- TMPL_VAR name="value" escape="html" -->"><!-- TMPL_VAR name="itemtypename" --></option><!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</select>
</li>
<li>
<label>Library of the patron:</label><select name="branch" id="branch">
<option value="">Any</option>
<!-- TMPL_LOOP name="branchloop" -->
<!-- TMPL_IF NAME="selected" -->
<option value="<!-- TMPL_VAR name="value" escape="html" -->" selected="selected"><!-- TMPL_VAR name="branchname" --></option><!-- TMPL_ELSE -->
<option value="<!-- TMPL_VAR name="value" escape="html" -->"><!-- TMPL_VAR name="branchname" --></option><!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</select>
</li>
<li><label for="order">Sort By:</label> <select name="order" id="order">
<!-- TMPL_LOOP NAME="ORDER_LOOP" -->
<!-- TMPL_IF NAME="selected" -->
<option value="<!-- TMPL_VAR NAME="ordervalue" DEFAULT="" -->" selected="selected">
<!-- TMPL_ELSE -->
<option value="<!-- TMPL_VAR NAME="ordervalue" DEFAULT="" -->">
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="order_date_due" -->Due Date
<!-- TMPL_ELSIF NAME="order_borrower" -->Patron
<!-- TMPL_ELSIF NAME="order_barcode" -->Barcode
<!-- TMPL_ELSIF NAME="order_title" -->Title
<!-- TMPL_ELSIF NAME="order_date_due_desc" -->Due Date desc
<!-- TMPL_ELSIF NAME="order_borrower_desc" -->Patron desc
<!-- TMPL_ELSIF NAME="order_barcode_desc" -->Barcode desc
<!-- TMPL_ELSIF NAME="order_title_desc" -->Title desc
<!-- TMPL_ELSE --><!-- TMPL_VAR NAME="label" -->
<!-- TMPL_IF NAME="desc" -->desc<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
</option>
<!-- /TMPL_LOOP -->
<!-- TMPL_LOOP name="patron_attr_order_loop" -->
<option value="<!-- TMPL_VAR name="value" escape="html" -->"<!-- TMPL_IF NAME="selected" --> selected="selected"<!-- /TMPL_IF -->><!-- TMPL_VAR name="label" --></option>
<!-- /TMPL_LOOP -->
</select></li>
<li class="radio"><label for="showall">Show any items currently issued:</label>
<!-- TMPL_IF NAME="showall" -->
<input type="checkbox" id="showall" name="showall" value="show" checked="checked" />
<!-- TMPL_ELSE -->
<input type="checkbox" id="showall" name="showall" value="show" />
<!-- /TMPL_IF -->
</li>
</ol>
<fieldset class="action">
<input type="submit" name="op" value="Apply Filter" class="submit" />
</fieldset>
</fieldset>
</form>
</div>
</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->