Koha/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt
Julian Maurice ed7543287b Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere
Having to write [% KOHA_VERSION %] for each url is bad because:
- It's easily forgettable when adding new <script> or <link>
- It prevents grep'ing for the full filename
- It violates the DRY principle
- If at some point we want to change the "force js and css reload"
  mechanism, it will be tedious

This patch:
- adds a Template::Toolkit plugin that generates <script> and
  <link> tags for JS and CSS files, and inserts automatically the Koha
  version in the filename
- use the new plugin to remove all occurences of [% KOHA_VERSION %]
- remove the code that was adding KOHA_VERSION as a template variable

Test plan:
1. Apply patch
2. Go to several different pages in Koha (opac and intranet) while
   checking your browser's dev tools (there should be no 404 for JS and
   CSS files, and the Koha version should appear in filenames) and the
   server logs (there should be no "File not found")
3. `git grep KOHA_VERSION` should return nothing
4. prove t/db_dependent/Koha/Template/Plugin/Asset.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-04-13 11:49:44 -03:00

101 lines
4.6 KiB
Text

[% USE Asset %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Acquisitions &rsaquo; Add order from a suggestion</title>
[% Asset.css("css/datatables.css") %]
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="acq_newordersuggestion" class="acq">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'suggestions-add-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; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Basket [% basketno %]</a> &rsaquo; Add order from a suggestion</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<h1>Suggestions</h1>
[% IF ( suggestions_loop ) %]
<a href="#" id="show_only_mine">Show only mine</a> | <a href="#" id="show_all">Show all suggestions</a>
<table id="suggestionst">
<thead>
<tr>
<th>Mine</th>
<th>Suggestion</th>
<th>Suggested by</th>
<th>Accepted by</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH suggestions_loo IN suggestions_loop %]
<tr>
<td>[% suggestions_loo.managedby %]</td>
<td>
<p>[% suggestions_loo.title |html %] - [% suggestions_loo.author %]</p>
<p>
[% IF ( suggestions_loo.copyrightdate ) %]&copy; [% suggestions_loo.copyrightdate %] [% END %]
[% IF ( suggestions_loo.volumedesc ) %]volume: <i>[% suggestions_loo.volumedesc %]</i> [% END %]
[% IF ( suggestions_loo.isbn ) %]ISBN: <i>[% suggestions_loo.isbn %]</i> [% END %]
[% IF ( suggestions_loo.publishercode ) %]<br />published by: [% suggestions_loo.publishercode %] [% END %]
[% IF ( suggestions_loo.publicationyear ) %] in <i>[% suggestions_loo.publicationyear %]</i> [% END %]
[% IF ( suggestions_loo.place ) %] in <i>[% suggestions_loo.place %]</i> [% END %]
[% IF ( suggestions_loo.note ) %]<p><i>([% suggestions_loo.note %])</i></p> [% END %]
</p>
</td>
<td>
[% suggestions_loo.surnamesuggestedby %][% IF ( suggestions_loo.firstnamesuggestedby ) %],[% END %] [% suggestions_loo.firstnamesuggestedby %]
</td>
<td>
[% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %],[% END %] [% suggestions_loo.firstnamemanagedby %]
</td>
<td class="actions">
[% IF ( suggestions_loo.biblionumber ) %]
<a href="neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;suggestionid=[% suggestions_loo.suggestionid %]&amp;biblio=[% suggestions_loo.biblionumber %]" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Order</a>
[% ELSE %]
<a href="neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;suggestionid=[% suggestions_loo.suggestionid %]" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Order</a>
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
There are no outstanding (accepted) suggestions.
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'acquisitions-menu.inc' %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/acquisitions-menu.js") %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
$(document).ready(function() {
var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [ 0 ], "bVisible": false, "bSearchable": true }, // must be searchable for fnFilter
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
],
"sPaginationType": "four_button"
}));
$("#show_only_mine").on('click', function(e){
e.preventDefault();
suggestionst.fnFilter('^[% loggedinuser %]$', 0, true);
});
$("#show_all").on('click', function(e){
e.preventDefault();
suggestionst.fnFilter('', 0 );
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]