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

208 lines
12 KiB
Text

[% USE Koha %]
[% USE Branches %]
[% USE ItemTypes %]
[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Circulation &rsaquo; Transfers</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="circ_branchtransfers" class="circ">
[% INCLUDE 'header.inc' %]
[% INCLUDE '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; Transfers</div>
[% IF Koha.Preference('CircSidebar') %]<div id="doc3" class="yui-t2">[% ELSE %]<div id="doc" class="yui-t7">[% END %]
<div id="bd">
<div id="yui-main">
[% IF Koha.Preference('CircSidebar') %]<div class="yui-b">[% END %]
[% IF ( found ) %]
<div class="yui-g"> <h3>Reserve found</h3>
<table>
<caption>
[% IF ( reserved ) %]
Reserve found for [% name | html %] (<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | html %]">[% borrowernumber | html %]</a>).
[% END %]
[% IF ( waiting ) %]
Item is marked waiting at [% branchname | html %] for [% name | html %] (<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | html %]">[% borrowernumber | html %]</a>).
[% END %]
</caption>
<tr>
<th>
[% IF ( reserved ) %]Set reserve to waiting and transfer book to [% branchname | html %]: [% END %]
[% IF ( waiting ) %]Cancel reservation and then attempt transfer: [% END %]
</th>
<td>
<form method="post" name="mainform" id="mainform" action="branchtransfers.pl">
[% FOREACH trsfitemloo IN trsfitemloop %]
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.barcode | html %]" />
<input type="hidden" name="fb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.frombrcd | html %]" />
<input type="hidden" name="tb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.tobrcd | html %]" />
[% END %]
<input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
[% IF ( waiting ) %]
<input type="hidden" name="barcode" value="[% barcode | html %]" />
<input type="hidden" name="request" value="KillWaiting" />
<input type="submit" value="Cancel" />
[% END %]
[% IF ( reserved ) %]
<input type="hidden" name="request" value="SetWaiting" />
<input type="submit" value="Waiting" />
[% END %]
</form>
</td>
</tr>
[% IF ( reserved ) %]
<tr>
<th>Cancel reservation and then attempt transfer:</th>
<td>
<form method="post" name="mainform" id="mainform" action="branchtransfers.pl">
[% FOREACH trsfitemloo IN trsfitemloop %]
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.barcode | html %]" />
<input type="hidden" name="fb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.frombrcd | html %]" />
<input type="hidden" name="tb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.tobrcd | html %]" />
[% END %]
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
<input type="hidden" name="tobranchcd" value="[% tobranchcd | html %]" />
<input type="hidden" name="barcode" value="[% barcode | html %]" />
<input type="hidden" name="request" value="KillReserved" />
<input type="submit" value="Cancel" />
</form>
</td>
</tr>
[% END %]
<tr>
<th>Ignore and return to transfers: </th>
<td>
<form method="post" name="mainform" id="mainform" action="branchtransfers.pl" />
<input type="hidden" name="tobranchcd" value="[% tobranchcd | html %]" />
<input type="hidden" name="barcode" />
[% FOREACH trsfitemloo IN trsfitemloop %]
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.barcode | html %]" />
<input type="hidden" name="fb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.frombrcd | html %]" />
<input type="hidden" name="tb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.tobrcd | html %]" />
[% END %]
<input type="submit" value="Ignore" />
</form>
</td>
</tr>
</table></div>
[% ELSE %]
[% IF ( reqmessage ) %]
<div class="dialog message">
<ul>
[% IF ( cancelled ) %]
<li>Reserve cancelled</li>
[% END %]
[% IF ( setwaiting ) %]
<li>Item should now be waiting at library: [% reqbrchname | html %]</li>
[% END %]
</ul>
</div>
[% END %]
[% IF ( errmsgloop ) %]
<div class="dialog message">
<ul>
[% FOREACH errmsgloo IN errmsgloop %]
[% IF ( errmsgloo.errbadcode ) %]
<li>No Item with barcode: [% errmsgloo.msg | html %]</li>
[% END %]
[% IF ( errmsgloo.errispermanent ) %]
<li>Please return item to home library: [% Branches.GetName( errmsgloo.msg ) | html %]</li>
[% END %]
[% IF ( errmsgloo.errnotallowed ) %]
<li>Transfer is not allowed for:
<ol>
[% IF ( Koha.Preference('BranchTransferLimitsType') == 'itemtype' ) %]
<li>Item type: <b>[% ItemTypes.GetDescription( errmsgloo.code ) | html %]</b></li>
[% ELSE %]
<li>Collection code: <b>[% AuthorisedValues.GetByCode( 'CCODE', errmsgloo.code ) | html %]</b></li>
[% END %]
<li>Destination library: <b>[% Branches.GetName( errmsgloo.tbr ) | html %]</b></li>
</ol>
</li>
[% END %]
[% IF ( errmsgloo.errdesteqholding ) %]
<li>Item is already at destination library.</li>
[% END %]
[% IF ( errmsgloo.errwasreturned ) %]
<li>Item was on loan to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% errmsgloo.patron.borrowernumber | html %]">
[% errmsgloo.patron.firstname | html %] [% errmsgloo.patron.surname | html %]
([% errmsgloo.patron.cardnumber | html %])</a> and has been returned.</li>
[% END %]
[% END %]
</ul>
</div>
[% END %]
<div id="branchtransfers">
<form method="post" name="mainform" id="mainform" action="/cgi-bin/koha/circ/branchtransfers.pl">
<fieldset class="brief">
<legend>Transfer</legend>
<ol>
<li>
<label for="tobranchcd">Destination library: </label>
<select name="tobranchcd" id="tobranchcd">
[% PROCESS options_for_libraries libraries => Branches.all( selected => tobranchcd ) %]
</select>
</li>
<li>
<label for="barcode">Enter barcode: </label>
<input name="barcode" id="barcode" size="15" class="focus" /> <input type="submit" value="Submit" />
</li>
</ol>
</fieldset>
<input type="hidden" name="tobranchcd" value="[% tobrancd | html %]" />
[% FOREACH trsfitemloo IN trsfitemloop %]
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.barcode | html %]" />
<input type="hidden" name="fb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.frombrcd | html %]" />
<input type="hidden" name="tb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.tobrcd | html %]" />
[% END %]
</form>
</div>
[% IF ( trsfitemloop ) %]
<div class="yui-g">
<table>
<caption>Transferred items</caption>
<tr>
<th class="tf-title">Title</th>
<th class="tf-author">Author</th>
<th class="tf-barcode">Barcode</th>
<th class="tf-location">Shelving location</th>
<th class="tf-itemcallnumber">Call number</th>
<th class="tf-itemtype">Item type</th>
<th class="tf-ccode">Collection code</th>
<th class="tf-destination">Destination</th>
</tr>
[% FOREACH trsfitemloo IN trsfitemloop %]
<tr>
<td class="tf-title"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% trsfitemloo.biblionumber | html %]">[% trsfitemloo.title | html %]</a></td>
<td class="tf-author">[% trsfitemloo.author | html %]</td>
<td class="tf-barcode"><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% trsfitemloo.biblionumber | html %]&amp;itemnumber=[% trsfitemloo.itemnumber | html %]#item[% trsfitemloo.itemnumber | html %]">[% trsfitemloo.barcode | html %]</a></td>
<td class="tf-location">[% trsfitemloo.location | html %]</td>
<td class="tf-itemcallnumber">[% trsfitemloo.itemcallnumber | html %]</td>
<td class="tf-itemtype">[% ItemTypes.GetDescription( trsfitemloo.itemtype ) | html %]</td>
<td class="tf-ccode">[% AuthorisedValues.GetByCode( 'CCODE', trsfitemloo.ccode ) | html %]</td>
<td class="tf-destination">[% Branches.GetName( trsfitemloo.tobrcd ) | html %]</td>
</tr>
[% END %]
</table>
</div>
[% END %]
[% END %]
</div>
[% IF Koha.Preference('CircSidebar') %]
</div>
<div class="yui-b noprint">
[% INCLUDE 'circ-nav.inc' %]
</div>
[% END %]
</div>
[% INCLUDE 'intranet-bottom.inc' %]