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

264 lines
11 KiB
Text

[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE Price %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Acquisitions &rsaquo; Invoice</title>
[% Asset.css("css/datatables.css") %]
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="acq_invoice" 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/invoices.pl">Invoices</a> &rsaquo; <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid %]">[% invoicenumber %]</a></div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF ( modified ) %]
<div class="dialog message">
<p>Invoice has been modified</p>
</div>
[% END %]
<h1>Invoice: [% invoicenumber %]</h1>
<p>Vendor: <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% suppliername %]</a></p>
<form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
<fieldset class="rows">
<ol>
<li>
<label for="shipmentdate" class="required">Invoice number:</label>
<input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber %]" class="required" required="required"/>
<span class="required">Required</span>
</li>
<li><label for="shipmentdate">Shipment date:</label>
<input type="text" size="10" id="shipmentdate" name="shipmentdate" value="[% shipmentdate | $KohaDates %]" class="datepicker" /></li>
<li><label for="billingdate">Billing date:</label>
<input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" class="datepicker" /></li>
<li><label for="shipmentcost">Shipping cost:</label>
<input type="text" size="10" id="shipmentcost" name="shipmentcost" value="[% shipmentcost %]" /></li>
<li><label for="shipment_budget_id">Shipping fund:</label>
<select id="shipment_budget_id" name="shipment_budget_id">
<option value="">No fund</option>
[% FOREACH budget IN budgets_loop %]
[% IF ( budget.selected ) %]
<option selected="selected" value="[% budget.budget_id %]">
[% ELSE %]
<option value="[% budget.budget_id %]">
[% END %]
[% budget.budget_name %]
</option>
[% END %]
</select></li>
[% IF ( invoiceclosedate ) %]
<li><span class="label">Status:</span>
Closed on [% invoiceclosedate | $KohaDates %].</li>
<li><label for="reopen">Reopen: </label> <input type="checkbox" name="reopen" id="reopen" /></li>
[% ELSE %]
<li><span class="label">Status:</span>
Open.</li>
<li><label for="close">Close: </label> <input type="checkbox" name="close" id="close" />
</li>
[% END %]
</ol>
<input type="hidden" name="op" value="mod" />
<input type="hidden" name="invoiceid" value="[% invoiceid %]" />
</fieldset>
<fieldset class="action">
<input type="submit" value="Save" />
[% UNLESS orders_loop.size %]
<a href="invoice.pl?op=delete&invoiceid=[% invoiceid %]" id="delete">Delete</a>
[% END %]
</fieldset>
</form>
<p>
<a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Go to receipt page</a>
[% IF Koha.Preference('AcqEnableFiles') %]| <a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid %]">Manage invoice files</a>[% END %]
</p>
<h2>Invoice details</h2>
[% IF orders_loop.size %]
<label for="show_all_details">
<input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
Show all details
</label>
<table id="orderst">
<thead>
<tr>
<th class="anti-the">Summary</th>
<th>Library</th>
<th class="tax_excluded">Actual cost tax exc.</th>
<th class="tax_included">Actual cost tax inc.</th>
<th>Qty.</th>
<th class="tax_excluded">Total tax exc. ([% currency.symbol %])</th>
<th class="tax_included">Total tax inc. ([% currency.symbol %])</th>
<th>GST %</th>
<th>GST</th>
<th>Fund</th>
</tr>
</thead>
<tbody>
[% FOREACH order IN orders_loop %]
<tr>
<td>
[% IF order.biblionumber %]
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber %]">[% order.title |html %]</a>
[% IF ( order.author ) %]
<br /><em>by</em> [% order.author %]
[% END %]
[% ELSE %]
<em>Deleted bibliographic record, can't find title</em>
[% END %]
[% IF ( order.isbn ) %] &ndash; [% order.isbn %][% END %]
[% IF ( order.publishercode ) %]
<br/>[% order.publishercode %]
[% IF order.publicationyear %], [% order.publicationyear %]
[% ELSIF ( order.copyrightdate ) %][% order.copyrightdate %][% END %]
[% END %]
</td>
<td><p>[% order.branchcode %]</p></td>
<td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td>
<td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td>
<td class="number">[% order.quantity %]</td>
<td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
<td class="number tax_included">[% order.total_tax_included | $Price %]</td>
<td class="number">[% order.tax_rate * 100 %]</td>
<td class="number">[% order.tax_value | $Price %]</td>
<td>[% order.budget_name %]</td>
</tr>
[% END %]
</tbody>
<tfoot>
[% FOR tf IN foot_loop %]
<tr>
<th colspan="2">Total (GST [% tf.tax_rate * 100 %] %)</th>
<th class="tax_excluded"/><th class="tax_included"/>
<th>[% tf.quantity %]</th>
<th class="tax_excluded">[% tf.total_tax_excluded | $Price %]</th>
<th class="tax_included">[% tf.total_tax_included | $Price %]</th>
<th>&nbsp;</th>
<th>[% tf.tax_value | $Price %]</th>
<th>&nbsp;</th>
</tr>
[% END %]
<tr>
<th colspan='2'>Total ([% currency.symbol %])</th>
<th class="tax_excluded"/><th class="tax_included"/>
<th>[% total_quantity %]</th>
<th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
<th class="tax_included">[% total_tax_included | $Price %]</th>
<th>&nbsp;</th>
<th>[% total_tax_value | $Price %]</th>
<th>&nbsp;</th>
</tr>
<tr>
<th colspan="2">Total + Shipment cost ([% currency.symbol %])</th>
<th class="tax_excluded"></th>
<th class="tax_included"></th>
<th>[% total_quantity %]</th>
<th class="tax_excluded">[% total_tax_excluded_shipment | $Price %]</th>
<th class="tax_included">[% total_tax_included_shipment | $Price %]</th>
<th>&nbsp;</th>
<th>[% total_tax_value | $Price %]</th>
<th>&nbsp;</th>
</tr>
</tfoot>
</table>
[% ELSE %]
<div class="dialog message"><p>No orders yet</p></div>
[% END %]
[% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
<br />
<h2>Files attached to invoice</h2>
<table id="invoice_files_table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Uploaded</th>
</tr>
</thead>
<tbody>
[% FOREACH f IN files %]
<tr>
<td><a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid %]&amp;op=download&amp;view=1&amp;file_id=[% f.file_id %]">[% f.file_name | html %]</a></td>
<td>[% f.file_type | html %]</td>
<td>[% f.file_description | html %]</td>
<td class="title-string">
<span title="[% f.date_uploaded %]">[% f.date_uploaded | $KohaDates %]</span>
</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'acquisitions-menu.inc' %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/acquisitions-menu.js") %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
function updateColumnsVisibility(visible) {
if ( visible ) {
$("table .tax_excluded, .tax_included").show();
} else {
[% IF ( invoiceincgst ) %]
$("table .tax_excluded").hide();
[% ELSE %]
$("table .tax_included").hide();
[% END %]
}
}
$(document).ready(function() {
$("#delete").click(function(){
return confirmDelete(_("Are you sure you want to delete this invoice?"));
});
$("#orderst").dataTable($.extend(true, {}, dataTablesDefaults, {
bInfo: false,
bPaginate: false,
bFilter: false,
sDom: "t",
"aoColumnDefs": [
{ "sType": "anti-the", "aTargets": [ "anti-the" ] }
]
}));
[% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
$("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [ "title-string" ], "sType": "title-string" }
],
bInfo: false,
bPaginate: false,
bFilter: false,
sDom: "t"
}));
[% END %]
$("#show_all_details").click(function(){
updateColumnsVisibility( $(this).is(":checked") );
});
$("#show_all_details").prop('checked', false);
updateColumnsVisibility(false);
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]