dcd1f5d48c
Here we go, next step then. As we did not fix the performance issue when autofiltering the variables (see bug 20975), the only solution we have is to add the filters explicitely. This patch has been autogenerated (using add_html_filters.pl, see next pathces) and add the html filter to all the variables displayed in the template. Exceptions are made (using the new 'raw' TT filter) to the variable we already listed in the previous versions of this patch. To test: - Use t/db_dependent/Koha/Patrons.t to populate your DB with autogenerated data which contain <script> tags - Remove them from borrower_debarments.comments (there are allowed here) update borrower_debarments set comment="html tags possible here"; - From the interface hit page and try to catch alert box. If you find one it means you find a possible XSS. To know where it comes from: * note the exact URL where you found it * note the alert box content * Dump your DB and search for the string in the dump to identify its location (for instance table.field) Next: * Ideally we would like to use the raw filter when it is not necessary to HTML escape the variables (in big loop for instance) * Provide a QA script to catch missing filters (we want html, uri, url or raw, certainly others that I am forgetting now) * Replace the html filters with uri when needed (!) Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
253 lines
11 KiB
Text
253 lines
11 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE AuthorisedValues %]
|
|
[% USE Branches %]
|
|
[% USE ColumnsSettings %]
|
|
[% USE KohaDates %]
|
|
[% USE ItemTypes %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Reports › Lost items</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% Asset.css("css/datatables.css") | $raw %]
|
|
</head>
|
|
|
|
<body id="rep_itemslost" class="rep">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>[% IF ( get_items ) %] › <a href="/cgi-bin/koha/reports/itemslost.pl">Lost items</a> › Results[% ELSE %] › Lost items[% END %]</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
|
|
<h1>Lost items</h1>
|
|
|
|
[% IF ( get_items ) %]
|
|
|
|
<div class="results">
|
|
[% IF items.count%]
|
|
[% items.count | html %] lost items found
|
|
[% ELSE %]
|
|
No lost items found
|
|
[% END %]
|
|
</div>
|
|
|
|
[% IF items.count %]
|
|
[% IF csv_profiles.count %]
|
|
<div class="lostitems-table_table_controls">
|
|
| <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> |
|
|
<a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
|
|
<span class="itemselection_actions">
|
|
| Actions:
|
|
<a class="itemselection_action_export"><i class="fa fa-download"></i> Export selected items</a>
|
|
Using the following CSV profile:
|
|
<select name="csv_profile_id" id="csv_profile_id">
|
|
[% FOREACH csv_profile IN csv_profiles %]
|
|
<option value="[% csv_profile.export_format_id | html %]">
|
|
[% csv_profile.profile | html %]
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</span>
|
|
</div>
|
|
[% ELSE %]
|
|
<div class="dialog message">
|
|
[% IF ( CAN_user_tools_manage_csv_profiles ) %]
|
|
To enable the export of selected items, <a href="/cgi-bin/koha/tools/csv-profiles.pl">create a CSV profile</a> of the type "SQL" with usage option "Export lost items in report."
|
|
[% ELSE %]
|
|
To enable the export of selected items, your administrator must create a CSV profile of the type "SQL" with usage option "Export lost items in report."
|
|
[% END %]
|
|
</div>
|
|
<div class="lostitems-table_table_controls">
|
|
</div>
|
|
[% END %]
|
|
|
|
<table id="lostitems-table">
|
|
<thead>
|
|
<tr>
|
|
[% IF csv_profiles.count %]
|
|
<th class="NoSort"></th>
|
|
[% END %]
|
|
<th>Title</th>
|
|
<th>Author</th>
|
|
<th>Lost status</th>
|
|
<th class="title-string">Lost on</th>
|
|
<th>Barcode</th>
|
|
<th>Call number</th>
|
|
<th class="title-string">Date last seen</th>
|
|
<th>Price</th>
|
|
<th>Rep.price</th>
|
|
<th>Library</th>
|
|
<th>Item type</th>
|
|
<th>Current location</th>
|
|
<th>Location</th>
|
|
<th>Not for loan status</th>
|
|
<th>Notes</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH item IN items %]
|
|
<tr>
|
|
[% IF csv_profiles.count %]
|
|
<td style="text-align:center;vertical-align:middle">
|
|
<input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
|
|
</td>
|
|
[% END %]
|
|
<td>
|
|
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber | html %]" title="[% item.itemnotes | html %]">[% item.biblio.title | html %]</a>
|
|
</td>
|
|
<td>[% item.biblio.author | html %]</td>
|
|
<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) | html %]
|
|
<td><span title="[% item.itemlost_on | html %]">[% item.itemlost_on | $KohaDates %]</span></td>
|
|
<td>
|
|
<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% item.biblionumber | html %]" title="[% item.itemnotes | html %]">[% item.barcode | html %]</a>
|
|
</td>
|
|
<td>[% item.itemcallnumber | html %]</td>
|
|
<td><span title="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</span></td>
|
|
<td>[% item.price | html %]</td>
|
|
<td>[% item.replacementprice | html %]</td>
|
|
<td>[% Branches.GetName(item.homebranch) | html %]</td>
|
|
<td>[% ItemTypes.GetDescription(item.effective_itemtype) | html %]</td>
|
|
<td>[% Branches.GetName(item.holdingbranch) | html %]</td>
|
|
<td>[% AuthorisedValues.GetByCode( 'LOC', item.location ) | html %]</td>
|
|
<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) | html %]
|
|
<td>[% item.itemnotes | html %]</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% END %]
|
|
[% ELSE %]
|
|
|
|
<form name="f" action="/cgi-bin/koha/reports/itemslost.pl" method="post">
|
|
<fieldset class="rows">
|
|
<ol>
|
|
|
|
<li><label for="barcodefilter">Barcode: </label><input type="text" name="barcodefilter" id="barcodefilter" size="6" /></li>
|
|
<li><label for="branchfilter">Library: </label><select name="branchfilter" id="branchfilter">
|
|
<option value="">All</option>
|
|
[% PROCESS options_for_libraries libraries => Branches.all() %]
|
|
</select></li>
|
|
<li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter">
|
|
<option value="">All</option>
|
|
[% FOREACH itemtype IN itemtypes %]
|
|
<option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
|
|
[% END %]
|
|
</select></li>
|
|
|
|
<li>
|
|
<label for="loststatusfilter">Lost status: </label>
|
|
<select name="loststatusfilter" id="loststatusfilter">
|
|
<option value="">All</option>
|
|
[% FOREACH l IN AuthorisedValues.GetDescriptionsByKohaField( kohafield => 'items.itemlost') %]
|
|
[% IF l.authorised_value == lostfilter %]
|
|
<option value="[% l.authorised_value | html %]" selected="selected">[% l.lib | html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% l.authorised_value | html %]">[% l.lib | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
|
|
<li>
|
|
<label for="notforloanfilter">Not for loan: </label>
|
|
<select name="notforloanfilter" id="notforloanfilter">
|
|
<option value="">All</option>
|
|
[% FOREACH n IN AuthorisedValues.GetDescriptionsByKohaField( kohafield => 'items.notforloan') %]
|
|
[% IF n.authorised_value == notforloanfilter %]
|
|
<option value="[% n.authorised_value | html %]" selected="selected">[% n.lib | html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% n.authorised_value | html %]">[% n.lib | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
|
|
</ol></fieldset>
|
|
<fieldset class="action"> <input type="submit" value="Submit" />
|
|
<input type="hidden" name="get_items" value="1" /></fieldset>
|
|
</form>
|
|
|
|
[% END %]
|
|
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
[% INCLUDE 'reports-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
|
|
[% INCLUDE 'columns_settings.inc' %]
|
|
[% Asset.js("js/table_filters.js") | $raw %]
|
|
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
|
|
<script type='text/javascript'>
|
|
$(document).ready(function() {
|
|
var columns_settings = [% ColumnsSettings.GetColumns( 'reports', 'lostitems', 'lostitems-table', 'json' ).raw %];
|
|
var lostitems_table = KohaTable("lostitems-table", {
|
|
"dom": 'B<"clearfix">t',
|
|
"aaSorting": [],
|
|
"aoColumnDefs": [
|
|
{ "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
|
|
{ "sType": "title-string", "aTargets" : [ "title-string" ] }
|
|
],
|
|
'bAutoWidth': false,
|
|
"bPaginate": false,
|
|
}, columns_settings, 'with_filters');
|
|
|
|
function itemSelectionBuildExportLink() {
|
|
var itemnumbers = new Array();
|
|
$("input[name='itemnumber'][type='checkbox']:checked").each(function() {
|
|
itemnumbers.push($(this).val());
|
|
});
|
|
if (itemnumbers.length > 0) {
|
|
var csv_profile_id = $("#csv_profile_id option:selected").val();
|
|
var url = '/cgi-bin/koha/reports/itemslost.pl?op=export&csv_profile_id='+csv_profile_id;
|
|
url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
|
|
$('a.itemselection_action_export').attr('href', url);
|
|
} else {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function itemSelectionBuildActionLinks() {
|
|
var export_link_ok = itemSelectionBuildExportLink();
|
|
if (export_link_ok) {
|
|
$('.itemselection_actions').show();
|
|
} else {
|
|
$('.itemselection_actions').hide();
|
|
}
|
|
}
|
|
|
|
itemSelectionBuildActionLinks();
|
|
|
|
$("input[name='itemnumber'][type='checkbox']").change(function() {
|
|
itemSelectionBuildActionLinks();
|
|
});
|
|
$("#csv_profile_id").change(function() {
|
|
itemSelectionBuildActionLinks();
|
|
});
|
|
|
|
$(".SelectAll").on("click",function(e){
|
|
e.preventDefault();
|
|
$("#lostitems-table").checkCheckboxes();
|
|
itemSelectionBuildActionLinks();
|
|
});
|
|
|
|
$(".ClearAll").on("click",function(e){
|
|
e.preventDefault();
|
|
$("#lostitems-table").unCheckCheckboxes();
|
|
itemSelectionBuildActionLinks();
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|