Koha/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.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

100 lines
4 KiB
Text

[% USE Asset %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Choose adult category</title>
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("css/datatables.css") %]
</head>
<body id="pat_update-child" class="pat">
<div class="container-fluid">
[% IF ( MULTI ) %]
<h3> Choose adult category </h3>
[% IF patron_categories %]
<form method="post" action="update-child.pl">
<fieldset>
<table id="catst">
<thead>
<tr>
<th>&nbsp;</th>
<th>Code</th>
<th>Description</th>
</tr>
</thead>
<tbody>
[% FOREACH patron_category IN patron_categories %]
<tr>
<td>
<input type="radio" id="catcode[% patron_category.categorycode %]" name="catcode" value="[% patron_category.categorycode %]" />
</td>
<td>[% patron_category.categorycode %]</td>
<td><label for="catcode[% patron_category.categorycode %]"><strong>[% patron_category.description %]</strong></label></td>
</tr>
[% END %]
</tbody>
</table>
<input type="hidden" name="op" value="update" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
<input type="hidden" name="catcode" value="[% catcode %]" />
<input type="hidden" name="cattype" value="[% cattype %]" />
<input type="hidden" name="catcode_multi" value="[% CATCODE_MULTI %]" />
<fieldset class="action">
<input class="submit" type="submit" value="Submit" />
<a href="#" class="cancel close">Cancel</a>
</fieldset>
</fieldset>
</form>
[% END %]
[% END %]
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
/* Set some variables needed in members-menu.js */
var advsearch = "[% advsearch %]";
var dateformat = "[% dateformat %]";
var CAN_user_borrowers = "[% CAN_user_borrowers %]";
var CAN_user_borrowers_edit_borrowers = "[% CAN_user_borrowers_edit_borrowers %]";
var NorwegianPatronDBEnable = "[% NorwegianPatronDBEnable %]";
var CATCODE_MULTI = "[% CATCODE_MULTI %]";
var catcode = "[% catcode %]";
var destination = "[% destination %]";
$(document).ready(function() {
$("#catst").dataTable($.extend(true, {}, dataTablesDefaults, {
"sDom": 't',
"aaSorting": [[ 2, "asc" ]],
"aoColumnDefs": [
{ "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }
],
"bPaginate": false
}));
});
</script>
[% IF ( CONFIRM ) %]
<script type="text/javascript">
function confirm_updatechild() {
var is_confirmed = window.confirm('Are you sure you want to update this child to an Adult category? This cannot be undone.');
if (is_confirmed) {
window.location='/cgi-bin/koha/members/update-child.pl?op=update&borrowernumber=[% borrowernumber %]&catcode=[% catcode %]&catcode_multi=[% CATCODE_MULTI %]';
}
}
confirm_updatechild([% borrowernumber %]);
</script>
[% END %]
[% IF ( SUCCESS ) %]
<script type="text/javascript">
self.opener.location.href='/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]';
window.close();
</script>
[% END %]
[% Asset.js("js/members-menu.js") %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]