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

331 lines
11 KiB
Text

[% USE Asset %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; EDI accounts
[% IF acct_form %]
[% IF account %]
&rsaquo; Modify account
[% ELSE %]
&rsaquo; Add new account
[% END %]
[% END %]
[% IF delete_confirm %]
&rsaquo; Confirm deletion of account
[% END %]
</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="admin_edi_acct" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'prefs-admin-search.inc' %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
&rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
[% IF acct_form %]
[% IF account %]
&rsaquo; <a href="/cgi-bin/koha/admin/edi_accounts.pl">EDI accounts</a> &rsaquo; Modify account
[% ELSE %]
&rsaquo; <a href="/cgi-bin/koha/admin/edi_accounts.pl">EDI accounts</a> &rsaquo; Add new account
[% END %]
[% ELSIF delete_confirm %]
&rsaquo; <a href="/cgi-bin/koha/admin/edi_accounts.pl">EDI accounts</a> &rsaquo; Confirm deletion of account
[% ELSE %]
&rsaquo; EDI accounts
[% END %]
</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF display %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default btn-sm" id="newediacct" href="/cgi-bin/koha/admin/edi_accounts.pl?op=acct_form">
<i class="fa fa-plus"></i>
New account
</a>
</div>
[% END %]
[% IF acct_form %]
<form action="/cgi-bin/koha/admin/edi_accounts.pl" name="Actform" method="post">
<input type="hidden" name="op" value="save" />
[% IF account %]
<input type="hidden" name="id" value="[% account.id %]" />
[% END %]
<fieldset class="rows">
<legend>
[% IF account %]
Modify account
[% ELSE %]
New account
[% END %]
</legend>
<ol>
<li>
<label for="vendor_id">Vendor: </label>
<select name="vendor_id" id="vendor_id">
[% FOREACH vendor IN vendors %]
[% IF account.vendor_id == vendor.id %]
<option value="[% vendor.id %]" selected="selected">[% vendor.name %]</option>
[% ELSE %]
<option value="[% vendor.id %]">[% vendor.name %]</option>
[% END %]
[% END %]
</select>
</li>
[% IF plugins_enabled %]
<li>
<label for="plugin">Plugin: </label>
<select name="plugin" id="plugin">
<option value="">Do not use plugin</option>
[% FOREACH plugin IN plugins %]
[% IF account.plugin == plugin.class %]
<option value="[% plugin.class %]" selected="selected">[% plugin.metadata.name %]</option>
[% ELSE %]
<option value="[% plugin.class %]">[% plugin.metadata.name %]</option>
[% END %]
[% END %]
</select>
</li>
[% ELSE %]
<input type="hidden" name="plugin" value="" />
[% END %]
<li>
<label for="description">Description: </label>
<input type="text" name="description" id="description" size="20" value="[% account.description %]" />
</li>
<li>
[% transport_types = [ 'FTP', 'SFTP', 'FILE' ] %]
<label for="transport">Transport: </label>
<select name="transport" title="valid types of transport are FTP and SFTP"
id="transport">
[% FOREACH transport_type IN transport_types %]
[% IF transport_type == account.transport %]
<option value="[% transport_type %]" selected="selected">[% transport_type %]</option>
[% ELSE %]
<option value="[% transport_type %]">[% transport_type %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="host">Remote host: </label>
<input type="text" name="host" id="host" size="20" maxlength="40" value="[% account.host %]" />
</li>
<li>
<label for="username">Username: </label>
<input type="text" name="username" id="username" size="20" maxlength="40" value="[% account.username %]" />
</li>
<li>
<label for="password">Password: </label>
<input type="text" name="password" id="password" size="20" maxlength="40" value="[% account.password %]" />
</li>
<li>
<label for="download_directory">Download directory: </label>
<input type="text" name="download_directory" id="download_directory" size="20" value="[% account.download_directory %]" />
<div class="hint">The download directory specifies the directory on the ftp site from which quotes and invoices are downloaded.</div>
</li>
<li>
<label for="upload_directory">Upload directory: </label>
<input type="text" name="upload_directory" id="upload_directory" size="20" value="[% account.upload_directory %]" />
<div class="hint">The upload directory specifies the directory on the ftp site to which orders are uploaded.</div>
</li>
<li>
<label for="id_code_qualifier">Qualifier:</label>
<select name="id_code_qualifier" id="id_code_qualifier">
[% FOREACH qualifier IN code_qualifiers %]
[% IF qualifier.code == account.id_code_qualifier %]
<option value="[% qualifier.code %]" selected="selected">
[% qualifier.description %] ([% qualifier.code %])
</option>
[% ELSE %]
<option value="[% qualifier.code %]">
[% qualifier.description %] ([% qualifier.code %])
</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="san">SAN: </label>
<input type="text" name="san" id="san" size="20" maxlength="20" value="[% account.san %]" />
</li>
<li>
<label for="quotes_enabled">Quotes enabled: </label>
[% IF account.quotes_enabled %]
<input type="checkbox" name="quotes_enabled" id="quotes_enabled" value="[% account.quotes_enabled %]" checked="checked" />
[% ELSE %]
<input type="checkbox" name="quotes_enabled" id="quotes_enabled" value="[% account.quotes_enabled %]" />
[% END %]
</li>
<li>
<label for="orders_enabled">Orders enabled: </label>
[% IF account.orders_enabled %]
<input type="checkbox" name="orders_enabled" id="orders_enabled" value="[% account.orders_enabled %]" checked="checked" />
[% ELSE %]
<input type="checkbox" name="orders_enabled" id="orders_enabled" value="[% account.orders_enabled %]" />
[% END %]
</li>
<li>
<label for="invoices_enabled">Invoices enabled: </label>
[% IF account.invoices_enabled %]
<input type="checkbox" name="invoices_enabled" id="invoices_enabled" value="[% account.invoices_enabled %]" checked="checked" />
[% ELSE %]
<input type="checkbox" name="invoices_enabled" id="invoices_enabled" value="[% account.invoices_enabled %]" />
[% END %]
</li>
<li>
<label for="responses_enabled">Responses enabled: </label>
[% IF account.responses_enabled %]
<input type="checkbox" name="responses_enabled" id="responses_enabled" value="[% account.responses_enabled %]" checked="checked" />
[% ELSE %]
<input type="checkbox" name="responses_enabled" id="responses_enabled" value="[% account.responses_enabled %]" />
[% END %]
</li>
<li>
<label for="auto_orders">Automatic ordering: </label>
[% IF account.auto_orders %]
<input type="checkbox" name="auto_orders" id="auto_orders" value="[% account.auto_orders %]" checked="checked" />
[% ELSE %]
<input type="checkbox" name="auto_orders" id="auto_orders" value="[% account.auto_orders %]" />
[% END %]
<div class="hint">
With automatic ordering quotes generate orders without staff intervention.
</div>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Submit" />
<a href="/cgi-bin/koha/admin/edi_accounts.pl" class="cancel">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF delete_confirm %]
<div class="dialog alert">
<h3>Delete this account?</h3>
<table>
<tr>
<th>Vendor</th>
<td>[% account.vendor.name %]</td>
</tr>
<tr>
<th>Description</th>
<td>[% account.description %]</td>
</tr>
<tr>
<th>SAN</th>
<td>[% account.san %]</td>
</tr>
</table>
<form action="/cgi-bin/koha/admin/edi_accounts.pl" method="post">
<table>
</table>
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="id" value="[% account.id %]" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
</form>
<form action="/cgi-bin/koha/admin/edi_accounts.pl" method="get">
<button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
</form>
</div>
[% END %]
[% IF display %]
[% IF ( ediaccounts ) %]
<h2>Vendor EDI accounts</h2>
<table>
<tr>
<th>ID</th>
<th>Vendor</th>
<th>Description</th>
<th>Transport</th>
<th>Remote host</th>
<th>Username</th>
<th>Password</th>
<th>Download directory</th>
<th>Upload directory</th>
<th>Qualifier</th>
<th>SAN</th>
<th>Quotes</th>
<th>Orders</th>
<th>Invoices</th>
<th>Responses</th>
<th>Auto ordering</th>
<th>Actions</th>
</tr>
[% FOREACH account IN ediaccounts %]
<tr>
<td>[% account.id %]</td>
<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% account.vendor_id %]">[% account.vendor.name %]</a></td>
<td>[% account.description %]</td>
<td>[% account.transport %]</td>
<td>[% account.host %]</td>
<td>[% account.username %]</td>
<td>[% IF account.password %]*****[% END %]</td>
<td>[% account.download_directory %]</td>
<td>[% account.upload_directory %]</td>
<td>
[% FOREACH qualifier IN code_qualifiers %]
[% IF qualifier.code == account.id_code_qualifier %]
[% qualifier.description %]
[% END %]
[% END %]
([% account.id_code_qualifier %])
</td>
<td>[% account.san %]</td>
[% IF account.quotes_enabled %]
<td>Y</td>
[% ELSE %]
<td>N</td>
[% END %]
[% IF account.orders_enabled %]
<td>Y</td>
[% ELSE %]
<td>N</td>
[% END %]
[% IF account.invoices_enabled %]
<td>Y</td>
[% ELSE %]
<td>N</td>
[% END %]
[% IF account.responses_enabled %]
<td>Y</td>
[% ELSE %]
<td>N</td>
[% END %]
[% IF account.auto_orders %]
<td>Y</td>
[% ELSE %]
<td>N</td>
[% END %]
<td class="actions">
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/edi_accounts.pl?op=acct_form&id=[% account.id %]"><i class="fa fa-pencil"></i> Edit</a> <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/edi_accounts.pl?op=delete_confirm&id=[% account.id %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
</table>
[% ELSE %]
<div class="dialog message">
There are no EDI accounts.
</div>
[% END %]
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'admin-menu.inc' %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]