Koha/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt
Jonathan Druart dcd1f5d48c Bug 13618: Add html filters to all the variables
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>
2018-08-17 15:55:05 +00:00

164 lines
7.2 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( booksellername ) %]Orders with uncertain prices for vendor [% booksellername | html %][% ELSE %]Orders with uncertain prices[% END %]</title>
[% Asset.css("css/datatables.css") | $raw %]
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="acq_uncertainprice" class="acq">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; [% IF ( booksellername ) %]<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> &rsaquo; Uncertain prices for vendor [% booksellername | html %][% ELSE %]Uncertain prices[% END %]</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% INCLUDE 'acquisitions-toolbar.inc' %]
[% IF ( validate ) %]
[% SET metacontent = '0; url=' _ scriptname _ '?booksellerid=' _ booksellerid %]
<META HTTP-EQUIV=Refresh CONTENT="[% metacontent | html %]">
[% ELSE %]
[% IF ( booksellername ) %]
<h1>Orders with uncertain prices for vendor <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a></h1>
<h2>Contact information</h2>
<p><strong>Address: </strong>
[% booksellerpostal | html %]
[% bookselleraddress1 | html %]
[% bookselleraddress2 | html %]
[% bookselleraddress3 | html %]
[% bookselleraddress4 | html %]
<a href="[% booksellerurl | html %]">[% booksellerurl | html %]</a>
</p>
<p><strong>Phone: </strong>
[% booksellerphone | html %] / Fax:
[% booksellerfax | html %]</p>
<dl>
[% FOREACH contact IN contacts %]
<dt><strong>Contact: </strong></dt>
<dd>[% contact.name | html %]
[% contact.position | html %]
[% contact.phone | html %]
[% contact.altphone | html %]
[% contact.email | html %]
[% contact.notes | html %]
</dd>
[% END %]
</dl>
[% IF ( booksellernotes ) %]
<p><strong>Notes: </strong>
[% booksellernotes | html %]</p>
[% END %]
[% END %]
<h2>Orders with uncertain prices</h2>
<form action="[% scriptname | html %]" method="post">
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
<label for="owner">Orders from:</label>
<select id="owner" name="owner">
[% IF ( owner ) %]
<option value="0">Everyone</option>
<option value="1" selected="selected">me</option>
[% ELSE %]
<option value="0" selected="selected">Everyone</option>
<option value="1">me</option>
[% END %]
</select>
<input type="submit" value="Filter" />
</form>
<form action="[% scriptname | html %]" method="post" id="uncertainprices">
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
<input type="hidden" name="op" value="validate" />
<table id="uncertainpricet">
<thead>
<tr>
<th>Basket</th>
<th>Order</th>
<th>By</th>
<th>Uncertain</th>
<th>Price</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
[% FOREACH uncertainpriceorder IN uncertainpriceorders %]
<tr>
<td>
[% uncertainpriceorder.basketname | html %]
</td>
<td>
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% uncertainpriceorder.biblionumber | html %]">[% uncertainpriceorder.title | html %]</a>
[% IF ( uncertainpriceorder.author ) %] <em>by</em> [% uncertainpriceorder.author | html %][% END %]
[% IF ( uncertainpriceorder.publishercode ) %]
<br /><em>Publisher:</em> [% uncertainpriceorder.publishercode | html %]
[%- IF ( uncertainpriceorder.publicationyear ) -%], [% uncertainpriceorder.publicationyear | html %]
[%- ELSIF ( uncertainpriceorder.copyrightdate ) -%] [% uncertainpriceorder.copyrightdate | html %]
[% END %]
[% END %]
[% IF ( uncertainpriceorder.isbn ) %]<br />[% uncertainpriceorder.isbn | html %][% END %]
<br />
<a href="neworderempty.pl?ordernumber=[% uncertainpriceorder.ordernumber | html %]&amp;booksellerid=[% booksellerid | html %]&amp;basketno=[% uncertainpriceorder.basketno | html %]">
Edit
</a>
</td>
<td>
[% uncertainpriceorder.firstname | html %] [% uncertainpriceorder.surname | html %]
</td>
<td>
<input type="checkbox" name="uncertainprice[% uncertainpriceorder.ordernumber | html %]" value="1" checked="checked" />
</td>
<td>
<input class="check_uncertain" data-ordernumber="[% uncertainpriceorder.ordernumber | html %]" type="text" size="10" name="price[% uncertainpriceorder.ordernumber | html %]" value="[% uncertainpriceorder.listprice | html %]" />
</td>
<td>
[% IF basket.effective_create_items == 'ordering' %]
[% uncertainpriceorder.quantity | html %]
<input type="hidden" name="qty[% uncertainpriceorder.ordernumber | html %]" value="[% uncertainpriceorder.quantity | html %]" />
[% ELSE %]
<input class="check_uncertain" data-ordernumber="[% uncertainpriceorder.ordernumber | html %]" type="text" size="10" name="qty[% uncertainpriceorder.ordernumber | html %]" value="[% uncertainpriceorder.quantity | html %]" />
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
<fieldset class="action"><input type="submit" value="Save" /></fieldset>
</form>
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'vendor-menu.inc' %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/acquisitions-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
$(document).ready(function() {
var uncertainpricet = $("#uncertainpricet").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false },
],
"sPaginationType": "four_button"
}));
$(".check_uncertain").on("change",function(){
var form = document.getElementById("uncertainprices");
var ordernumber = $(this).data("ordernumber");
uncheckbox( form, ordernumber );
});
});
var MSG_INVALIDPRICE = _("ERROR: Price is not a valid number, please check the price and try again!");
</script>
[% Asset.js("js/acq.js") | $raw %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]