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>
383 lines
17 KiB
Text
383 lines
17 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE KohaDates %]
|
|
[% USE Branches %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Tools › Inventory</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% Asset.css("css/datatables.css") | $raw %]
|
|
</head>
|
|
|
|
<body id="tools_inventory" class="tools">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% IF (loop) %]<a href="/cgi-bin/koha/tools/inventory.pl">Inventory</a> › Results[% ELSE %]Inventory[% END %]</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
<h1>Inventory</h1>
|
|
[% IF (moddatecount) %]<div class="dialog message">[% moddatecount | html %] items modified : datelastseen set to [% date | $KohaDates %]</div>
|
|
<div class="dialog alert">Number of potential barcodes read: [% LinesRead | html %]</div>[% END %]
|
|
[% IF (errorfile) %]<div class="dialog alert">[% errorfile | html %] can't be opened</div>[% END %]
|
|
[% IF (err_length && err_length==1) %]<div class="dialog alert">There was 1 barcode that was too long.</div>[% END %]
|
|
[% IF (err_length && err_length>1) %]<div class="dialog alert">There were [% err_length | html %] barcodes that were too long.</div>[% END %]
|
|
[% IF (err_data && err_data==1) %]<div class="dialog alert">There was 1 barcode that contained at least one unprintable character.</div>[% END %]
|
|
[% IF (err_data && err_data>1) %]<div class="dialog alert">There were [% err_data | html %] barcodes that contained at least one unprintable character.</div>[% END %]
|
|
[% FOREACH error IN errorloop %]
|
|
<div class="dialog alert">
|
|
[% error.barcode | html %]
|
|
[% IF (error.ERR_BARCODE) %]: barcode not found[% END %]
|
|
[% IF (error.ERR_WTHDRAWN) %]: item withdrawn[% END %]
|
|
[% IF (error.ERR_ONLOAN_RET) %]: item was on loan. It was returned before marked as seen[% END %]
|
|
[% IF (error.ERR_ONLOAN_NOT_RET) %]: item was on loan. couldn't be returned.[% END %]
|
|
</div>
|
|
[% END %]
|
|
[% UNLESS op %]
|
|
<div class="yui-g">
|
|
<form method="post" id="inventory_form" action="/cgi-bin/koha/tools/inventory.pl" enctype="multipart/form-data">
|
|
<fieldset class="rows">
|
|
<legend>Use a barcode file</legend>
|
|
<ol>
|
|
<li><label for="uploadbarcodes">Barcode file: </label> <input type="file" id="uploadbarcodes" name="uploadbarcodes" /></li>
|
|
<li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today | $KohaDates %]" class="datepicker" disabled /></li>
|
|
<li><label for="compareinv2barcd">Compare barcodes list to results: </label><input type="checkbox" name="compareinv2barcd" id="compareinv2barcd" disabled /></li>
|
|
<li><label for="dont_checkin">Do not check in items scanned during inventory: </label><input type="checkbox" name="dont_checkin" id="dont_checkin" disabled /></li>
|
|
</ol>
|
|
</fieldset>
|
|
|
|
<fieldset class="rows">
|
|
<legend>Item location filters</legend>
|
|
<ol><li>
|
|
<label for="branch">Library: </label>
|
|
<input type="radio" name="branch" value="homebranch"> Home library</input>
|
|
<input type="radio" name="branch" value="holdingbranch"> Current library</input>
|
|
</li><li>
|
|
<label for="branchloop">Library: </label><select id="branchloop" name="branchcode" style="width:12em;">
|
|
<option value="">All libraries</option>
|
|
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
|
|
</select>
|
|
</li>
|
|
[% IF (authorised_values) %]
|
|
<li>
|
|
<label for="locationloop">Shelving location (items.location) is: </label>
|
|
<select id="locationloop" name="location">
|
|
<option value="">Filter location</option>
|
|
[% FOREACH value IN authorised_values %]
|
|
[% IF (value.selected) %]
|
|
<option value="[% value.authorised_value | html %]" selected="selected">[% value.lib | html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% value.authorised_value | html %]">[% value.lib | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select> </li>
|
|
[% END %]
|
|
<li>
|
|
<label for="minlocation">Item callnumber between: </label>
|
|
<input type="text" name="minlocation" id="minlocation" value="[% minlocation | html %]" /> (items.itemcallnumber) </li>
|
|
<li><label for="maxlocation">...and: </label>
|
|
<input type="text" name="maxlocation" id="maxlocation" value="[% maxlocation | html %]" />
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
|
|
<fieldset class="rows" id="optionalfilters">
|
|
<legend>Optional filters for inventory list or comparing barcodes</legend>
|
|
<br/>
|
|
<div id="statuses" style="display: block;">
|
|
[% FOREACH status IN statuses %]
|
|
[% IF (status.values) %]
|
|
<fieldset style="float: left; padding: 5px; margin: 5px;text-align:right">
|
|
<legend>[% status.fieldname | html %]</legend>
|
|
<ul id="statuses-[% fieldname | html %]" style="display: inline;">
|
|
[% FOREACH value IN status.values %]
|
|
[% IF (value.lib) %]
|
|
<li>
|
|
<label for="[% value.id | html %]">
|
|
[% IF value.authorised_value==0 %]
|
|
For loan
|
|
[% ELSE %]
|
|
[% value.lib | html %]
|
|
[% END %]
|
|
</label>
|
|
<input type="checkbox" name="status-[% status.fieldname | html %]-[% value.authorised_value | html %]" id="[% value.authorised_value | html %]" />
|
|
</li>
|
|
[% END %]
|
|
[% END %]
|
|
</ul>
|
|
</fieldset>
|
|
[% END %]
|
|
[% END %]
|
|
</div>
|
|
<ol>
|
|
<li>
|
|
<br/>
|
|
<label for="datelastseen">Last inventory date:</label>
|
|
<input type="text" id="datelastseen" name="datelastseen" value="[% datelastseen | $KohaDates %]" class="datepicker" />
|
|
(Skip records marked as seen on or after this date.)
|
|
</li>
|
|
<li>
|
|
<label for="ignoreissued">Skip items on loan: </label>
|
|
[% IF (ignoreissued) %]
|
|
<input type="checkbox" id="ignoreissued" name="ignoreissued" checked="checked" />
|
|
[% ELSE %]
|
|
<input type="checkbox" id="ignoreissued" name="ignoreissued" />
|
|
[% END %]
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
|
|
<fieldset class="rows">
|
|
<legend>Additional options</legend>
|
|
<ol>
|
|
|
|
<li>
|
|
<label for="CSVexport">Export to CSV file: </label>
|
|
<input type="checkbox" name="CSVexport" id="CSVexport" />
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<input type="hidden" name="op" value="do_it" />
|
|
|
|
<fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
[% END %]
|
|
[% IF (op) %]
|
|
<form method="post" action="/cgi-bin/koha/tools/inventory.pl" class="checkboxed">
|
|
<input type="hidden" name="minlocation" value="[% minlocation | html %]" />
|
|
<input type="hidden" name="maxlocation" value="[% maxlocation | html %]" />
|
|
<input type="hidden" name="location" value="[% location | html %]" />
|
|
<input type="hidden" name="branchcode" value="[% branchcode | html %]" />
|
|
<input type="hidden" name="datelastseen" value="[% datelastseen | html %]" />
|
|
|
|
[% UNLESS uploadedbarcodesflag %]
|
|
<div><a href="#" class="checkall"><i class="fa fa-check"></i> Select all</a> <a href="#" class="clearall"><i class="fa fa-remove"></i> Clear all</a></div>
|
|
[% END %]
|
|
|
|
<table id="inventoryt">
|
|
<thead>
|
|
<tr>
|
|
[% UNLESS uploadedbarcodesflag %]<th>Seen</th>[% END %]
|
|
<th>Barcode</th>
|
|
<th>Call number</th>
|
|
<th>Library</th>
|
|
<th>Title</th>
|
|
<th>Not for loan</th>
|
|
<th>Lost</th>
|
|
<th>Damaged</th>
|
|
<th>Withdrawn</th>
|
|
<th>Last seen</th>
|
|
<th>Problems</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH result IN loop %]
|
|
<tr>
|
|
[% UNLESS uploadedbarcodesflag %]
|
|
<td>
|
|
<input type="checkbox" name="SEEN-[% result.itemnumber | html %]" value="1" />
|
|
</td>
|
|
[% END %]
|
|
<td>
|
|
[% result.barcode | html %]
|
|
</td>
|
|
<td>[% result.itemcallnumber | html %]</td>
|
|
<td>
|
|
[% Branches.GetName( result.homebranch ) | html %]
|
|
<span class="shelvingloc">[% result.location | html %]</span>
|
|
</td>
|
|
<td>
|
|
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% result.biblionumber | html %]" class="openWin">[% result.title | html %]</a>
|
|
[% IF ( result.author ) %]
|
|
by <span class="author">[% result.author | html %]</span>
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% result.notforloan | html %]
|
|
</td>
|
|
<td>
|
|
[% result.itemlost | html %]
|
|
</td>
|
|
<td>
|
|
[% result.damaged | html %]
|
|
</td>
|
|
<td>
|
|
[% result.withdrawn | html %]
|
|
</td>
|
|
<td>
|
|
[% result.datelastseen | $KohaDates %]
|
|
</td>
|
|
<td>
|
|
[% FOREACH problem IN result.problems %]
|
|
[% IF problem.key == 'wrongplace' %]
|
|
Found in wrong place<br/>
|
|
[% ELSIF problem.key == 'changestatus' %]
|
|
Unknown not-for-loan status<br/>
|
|
[% ELSIF problem.key == 'not_scanned' %]
|
|
Missing (not scanned)<br/>
|
|
[% ELSIF problem.key == 'checkedout' %]
|
|
Still checked out<br/>
|
|
[% ELSIF problem.key == 'no_barcode' %]
|
|
No barcode<br/>
|
|
[% END %]
|
|
[% END %]
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
<div class="spacer"></div>
|
|
[% UNLESS uploadedbarcodesflag %]
|
|
<div style="padding : .3em 0"><a href="#" class="checkall"><i class="fa fa-check"></i> Select all</a> <a href="#" class="clearall"><i class="fa fa-remove"></i> Clear all</a></div>
|
|
<input type="submit" id="markseenandquit" value="Mark seen and quit" />
|
|
<input type="submit" value="Mark seen and continue >>" id="markseenandcontinuebutton" />
|
|
<input type="submit" value="Continue without marking >>" id="continuewithoutmarkingbutton" class="submit" />
|
|
[% END %]
|
|
</form>
|
|
|
|
</div>
|
|
|
|
[% END %]
|
|
</div>
|
|
<div class="yui-b">
|
|
[% INCLUDE 'tools-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/tools-menu.js") | $raw %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
[% INCLUDE 'calendar.inc' %]
|
|
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
|
|
<script type="text/javascript">
|
|
function checkForm() {
|
|
if ( $('#uploadbarcodes').val() ) {
|
|
if ( !(
|
|
$('#branchloop').val() ||
|
|
$('#locationloop').val() ||
|
|
$('#minlocation').val() ||
|
|
$('#maxlocation').val() ||
|
|
$('#statuses input:checked').length
|
|
) ) {
|
|
return confirm(
|
|
_("You have not selected any catalog filters and are about to compare a file of barcodes to your entire catalog.") + "\n\n" +
|
|
_("For large catalogs this can result in unexpected behavior") + "\n\n" +
|
|
_("Are you sure you want to do this?")
|
|
);
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
inventorydt = $('#inventoryt').dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
'sPaginationType': 'full_numbers',
|
|
[% IF compareinv2barcd %]
|
|
// sort on callnumber
|
|
"aaSorting": [[ 1, "asc" ]],
|
|
[% ELSE %]
|
|
// first column contains checkboxes
|
|
"aoColumnDefs": [
|
|
{ "bSortable": false, "bSearchable": false, "aTargets": [ 0 ] },
|
|
],
|
|
// 3rd column is callnumber
|
|
"aaSorting": [[ 2, "asc" ]],
|
|
[% END %]
|
|
'fnDrawCallback': function() {
|
|
//bind the click handler script to the newly created elements held in the table
|
|
$('.openWin').bind('click',function(e){
|
|
e.preventDefault();
|
|
openWindow(this.href,'marcview',800,600);
|
|
});
|
|
}
|
|
} ));
|
|
|
|
|
|
$("#continuewithoutmarkingbutton").click(function(){
|
|
inventorydt.fnPageChange( 'next' );
|
|
return false;
|
|
});
|
|
|
|
$("#markseenandcontinuebutton").click(function(){
|
|
var param = '';
|
|
$("input:checked").each(function() {
|
|
param += "|" + $(this).attr('name');
|
|
});
|
|
$.post('/cgi-bin/koha/tools/ajax-inventory.pl', { seen: param });
|
|
inventorydt.fnPageChange( 'next' );
|
|
return false;
|
|
});
|
|
|
|
$("#markseenandquit").click(function(){
|
|
var param = '';
|
|
$("input:checked").each(function() {
|
|
param += "|" + $(this).attr('name');
|
|
});
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '/cgi-bin/koha/tools/ajax-inventory.pl',
|
|
data: { seen: param},
|
|
async: false
|
|
});
|
|
document.location.href = '/cgi-bin/koha/tools/inventory.pl';
|
|
return false;
|
|
});
|
|
|
|
|
|
$(".checkall").click(function(){
|
|
$(".checkboxed").checkCheckboxes();
|
|
return false;
|
|
});
|
|
$(".clearall").click(function(){
|
|
$(".checkboxed").unCheckCheckboxes();
|
|
return false;
|
|
});
|
|
$("#inventory_form").on("submit",function(){
|
|
return checkForm();
|
|
});
|
|
|
|
// #uploadbarcodes and #compareinv2barcd determine the behavior of
|
|
// the controls within the barcode fieldset and the optional filters
|
|
$("#uploadbarcodes").change(function() {
|
|
if( $("#uploadbarcodes").val() ) {
|
|
$("#setdate").prop('disabled',false);
|
|
$("#compareinv2barcd").prop('disabled',false);
|
|
$("#compareinv2barcd").attr('checked',true); // default
|
|
$("#dont_checkin").prop('disabled',false);
|
|
if( $("#compareinv2barcd").attr('checked') ) {
|
|
$("fieldset#optionalfilters").show();
|
|
$("#ignoreissued").attr('checked',true); // default
|
|
} else {
|
|
$("fieldset#optionalfilters").hide();
|
|
$("#ignoreissued").attr('checked',false);
|
|
}
|
|
} else {
|
|
$("#setdate").prop('disabled',true);
|
|
$("#compareinv2barcd").prop('disabled',true);
|
|
$("#compareinv2barcd").attr('checked',false);
|
|
$("#dont_checkin").prop('disabled',true);
|
|
$("#dont_checkin").attr('checked',false);
|
|
$("fieldset#optionalfilters").show();
|
|
}
|
|
});
|
|
$("#compareinv2barcd").click(function() {
|
|
if( $("#compareinv2barcd").attr('checked') ) {
|
|
$("fieldset#optionalfilters").show();
|
|
$("#ignoreissued").attr('checked',true); // default
|
|
} else {
|
|
$("#ignoreissued").attr('checked',false);
|
|
$("fieldset#optionalfilters").hide();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|