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

150 lines
4.6 KiB
Text

[% USE Asset %]
[% USE KohaDates %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Acquisitions &rsaquo; EDIFACT messages</title>
[% Asset.css("css/datatables.css") %]
[% INCLUDE 'doc-head-close.inc' %]
<style type="text/css">
#EDI_modal { width : 80%; } @media (max-width: 767px) { #EDI_modal { margin: 0; width : auto; } }
</style>
</head>
<body id="acq_edifactmsgs" 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; <a href="/cgi-bin/koha/acqui/edifactmsgs.pl">EDIFACT messages</a>
</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<h1>EDIFACT messages</h1>
<div id="acqui_edifactmsgs">
[% IF ( messages ) %]
<table id="edi_msgs">
<thead>
<tr>
<th>Type</th>
<th class="title-string">Transferred</th>
<th>Status</th>
<th>Vendor</th>
<th>Details</th>
<th>Filename</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH msg IN messages %]
<tr>
<td>[% msg.message_type %]</td>
<td><span title="[% msg.transfer_date %]">[% msg.transfer_date | $KohaDates %]</span></td>
<td>[% msg.status %]</td>
<td>
<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% msg.vendor_id %]">
[% msg.vendor.name %]
</a>
</td>
<td>
[% IF msg.message_type == 'QUOTE' || msg.message_type == 'ORDERS' %]
[% IF msg.basketno %]
<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% msg.basketno.basketno %]">
Basket: [% msg.basketno.basketno %]
</a>
[% END %]
[% ELSE %]
<!-- Assuming invoices -->
<a href="/cgi-bin/koha/acqui/invoices.pl?message_id=[% msg.id %]">
Invoices
</a>
[% END %]
</td>
<td>[% msg.filename %]</td>
<td class="actions">
<a class="btn btn-default btn-xs view_message" target="_blank" href="/cgi-bin/koha/acqui/edimsg.pl?id=[% msg.id %]"><i class="fa fa-search"></i> View message</a>
<a class="btn btn-default btn-xs delete_msg" href="/cgi-bin/koha/acqui/edifactmsgs.pl?op=delete&amp;message_id=[% msg.id %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
</tbody>
</table>
<!-- Modal to display EDIFACT messages -->
<div class="modal" id="EDI_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_modal_label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3 id="EDI_modal_label">EDIFACT message</h3>
</div>
<div class="modal-body">
<div id="loading"> <img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /> Loading </div>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
</div>
</div>
[% ELSE %]
<div class="dialog message">There are no EDIFACT messages.</div>
[% END %]
</div>
</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() {
$('#edi_msgs').dataTable($.extend(true, {}, dataTablesDefaults, {
'aaSorting': [[1, "desc" ]],
'sPaginationType': "four_button",
"aoColumnDefs": [
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
{ "sType": "title-string", "aTargets" : [ "title-string" ] }
]
}));
var EDIModal = $("#EDI_modal");
var EDIModalBody = $("#EDI_modal .modal-body");
$(".view_message").on("click", function(e){
e.preventDefault();
var page = $(this).attr("href");
EDIModalBody.load(page + " #edimsg");
EDIModal.modal("show");
});
EDIModal.on("click",".closebtn",function(e){
e.preventDefault();
EDIModal.modal("hide");
});
EDIModal.on("hidden", function(){
EDIModalBody.html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
});
$(".delete_msg").on("click",function(){
return confirm(_("Are you sure you want to delete this message?"));
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]