Koha/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.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

234 lines
12 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE KohaDates %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Search for vendor [% supplier | html %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<style type="text/css">
#vendors td{
vertical-align: top;
}
</style>
[% Asset.css("css/datatables.css") | $raw %]
</head>
<body id="acq_booksellers" 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; Search for vendor <em>[% supplier | html %]</em> </div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% INCLUDE 'acquisitions-toolbar.inc' %]
[% UNLESS ( count == 1 ) %]
[% UNLESS count %]
<h1>Your search returned no results.</h1>
[% ELSIF ( supplier.length < 1 ) %]
<h1>Vendor search: [% count | html %] results found</h1>
[% ELSE %]
<h1>Vendor search: [% count | html %] results found for '[% supplier | html %]'</h1>
[% END %]
[% END %]
[% IF ( loop_suppliers.size ) %]
[% UNLESS (count == 1) %]
<p>Choose a vendor in the list to jump directly to the right place.
<select id="supplierlist">
[% FOREACH supplier1 IN loop_suppliers %]
<option value="[% supplier1.booksellerid | html %]">[% supplier1.name | html %]</option>
[% END %]
</select>
</p>
[% END %]
[% IF ( allbaskets ) %]
<a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier | html %]&amp;booksellerid=[% booksellerid | html %]">Show active baskets only</a>
[% ELSE %]
<a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier | html %]&amp;booksellerid=[% booksellerid | html %]&amp;allbaskets=1">Show all baskets</a>
[% END %]
[% UNLESS booksellerid %]
| <a href="#" id="show_active_vendors">Show active vendors only</a><a href="#" id="show_all_vendors">Show all vendors</a>
[% END %]
<div id="acqui_order_supplierlist">
[% FOREACH supplier IN loop_suppliers %]
[% IF ( supplier.active ) %]
<div class="supplier">
[% ELSE %]
<div class="supplier inactive">
[% END %]
<span class="suppliername">
[% IF (supplier.name) %]
<a name="[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | html %]">[% supplier.name | html %]</a>
[% ELSE %]
<a name="[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | html %]">NO NAME</a>
[% END %]
</span>
<span class="action">
[% IF ( CAN_user_acquisition_order_manage ) %]
[% IF ( supplier.active ) %]
<a class="btn btn-default btn-sm" href="/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% supplier.booksellerid | html %]&amp;op=add_form"><i class="fa fa-plus"></i> New basket</a>
[% ELSE %]
(inactive)
[% END %]
[% END %]
[% IF ( supplier.loop_basket.size ) %]
<a class="btn btn-default btn-sm" href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% supplier.booksellerid | html %]"><i class="fa fa-inbox"></i> Receive shipment</a>
[% END %]
</span>
<div class="baskets">
[% IF ( supplier.loop_basket.size ) %]
<table class="baskets">
<thead>
<tr>
<th>No.</th>
<th>Name</th>
<th class="title-numeric">Item count</th>
<th class="title-numeric">Biblio count</th>
<th>Items expected</th>
<th>Created by</th>
<th class="title-string">Date</th>
<th>Basket group</th>
<th class="title-string">Closed</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH basket IN supplier.loop_basket %]
[% IF ( basket.uncertainprices ) %]
<tr class="problem">
[% ELSE %]
<tr>
[% END %]
<td>[% basket.basketno | html %]</td>
<td>[% basket.basketname | html %]</td>
<td>
<span title="[% basket.total_items | html %]">[% basket.total_items | html %]
[% IF basket.total_items_cancelled %]
([% basket.total_items_cancelled | html %] cancelled)
[% END %]
</span>
</td>
<td>
<span title="[% basket.total_biblios | html %]">[% basket.total_biblios | html %]
[% IF basket.total_biblios_cancelled %]
([% basket.total_biblios_cancelled | html %] cancelled)
[% END %]
</span>
</td>
<td>[% basket.expected_items | html %]</td>
<td>
[% IF basket.authorisedby %]
[% basket.authorisedby.firstname | html %]
[% basket.authorisedby.surname | html %]
[% END %]
</td>
<td><span title="[% basket.creationdate | html %]">[% basket.creationdate | $KohaDates %]</span></td>
<td>
[% IF basket.basketgroup %]
[% basketgroup = basket.basketgroup | html %]
[% IF basketgroup.closed %]
[% basketgroup.name | html %] (closed)
[% ELSE %]
<a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% basket.booksellerid | html %]&amp;basketgroupid=[% basketgroup.id | html %]">[% basketgroup.name | html %]</a>
[% END %]
[% END %]
</td>
<td>
[% IF ( basket.closedate ) %]
<span title="[% basket.closedate | html %]">[% basket.closedate | $KohaDates %]</span>
[% ELSE %]
<span title="9999-99-99"></span>
[% END %]
</td>
<td class="actions">
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | html %]"><i class="fa fa-eye"></i> View</a>
[% IF not basket.closedate and supplier.active %]
<a class="btn btn-default btn-xs" id="addtoBasketLabel[% basket.basketno | html %]" href="#addtoBasket[% basket.basketno | html %]" role="button" data-toggle="modal"><i class="fa fa-plus"></i> Add to basket</a>
<!-- Modal -->
<div id="addtoBasket[% basket.basketno | html %]" class="modal" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel[% basket.basketno | html %]" aria-hidden="true" data-basketno="[% basket.basketname | html %]">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
[% INCLUDE 'acquisitions-add-to-basket.inc' booksellerid=supplier.booksellerid basketno=basket.basketno %]
</div>
<div class="modal-footer">
<a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
</div>
</div>
</div>
</div>
[% END %]
</td>
</tr>
[% END %][%# FOREACH basket IN supplier.loop_basket %]
</tbody>
</table>
[% ELSE %]
<p>No pending baskets</p>
[% END %][%# IF ( supplier.loop_basket.size ) %]
</div>
</div>
[% END %][%# FOREACH supplier IN loop_suppliers %]
</div>
[% END %][%# IF ( loop_suppliers.size ) %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% IF ( booksellerid ) %]
[% INCLUDE 'vendor-menu.inc' %]
[% END %]
[% INCLUDE 'acquisitions-menu.inc' %]
</aside>
</div>
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/acquisitions-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function() {
$("table.baskets").dataTable($.extend(true, {}, dataTablesDefaults, {
'sDom': 't',
'bPaginate': false,
'bFilter': false,
'bInfo': false,
"aaSorting": [[ 1, "asc" ]],
"aoColumnDefs": [
{ "sType": "title-string", "aTargets" : [ "title-string" ] },
{ "sType": "title-numeric", "aTargets" : [ "title-numeric" ] },
{ 'aTargets': [-1], 'bSortable': false }
]
}));
$("#supplierlist").change(function() {
var id = $(this).find("option:selected").val();
window.location.href = "#" + id;
});
$(".modal").on("show", function(){
var basket = $(this).data("basketno");
var legend = _("Add order to basket %s").format(basket);
$(this).find("legend").html(legend);
});
$("#show_all_vendors").hide();
$("#show_active_vendors").on('click', function(e){
e.preventDefault();
$(".inactive").hide();
$("#show_active_vendors").hide();
$("#show_all_vendors").show();
});
$("#show_all_vendors").on('click', function(e){
e.preventDefault();
$(".inactive").show();
$("#show_all_vendors").hide();
$("#show_active_vendors").show();
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]