Bug 42287: Tidy all script tags - members
In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the members/patrons module. The 2 main changes are in the following files: * moremember.tt => Trivial, simply moving the existing JS variable to a separate script tag * update-child.tt => Trivial, only a single variable created: 'patron_id' Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
af6eca85fb
commit
4020a70819
|
|
@ -587,7 +587,7 @@
|
|||
[% INCLUDE 'format_price.inc' %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") | $raw %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
var table_settings = [% TablesSettings.GetTableSettings('members', 'fines', 'account-fines', 'json') | $raw %];
|
||||
Koha.addPrefs({
|
||||
FinePaymentAutoPopup: [% Koha.Preference('FinePaymentAutoPopup') ? 1 : 0 | html %],
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@
|
|||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") | $raw %]
|
||||
[% INCLUDE 'js-biblio-format.inc' %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
const all_libraries = [% To.json(Branches.all) | $raw %].map(e => {
|
||||
e["_id"] = e["branchcode"];
|
||||
e["_str"] = e["branchname"];
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
[% INCLUDE 'datatables.inc' %]
|
||||
[% INCLUDE 'js-biblio-format.inc' %]
|
||||
[% INCLUDE 'calendar.inc' %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
var prefilters = '[% prefilters | html %]';
|
||||
// Set column settings
|
||||
var table_settings = [% TablesSettings.GetTableSettings( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) | $raw %];
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@
|
|||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") | $raw %]
|
||||
[% Asset.js("js/additional-fields-entry.js") | $raw %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
$(document).ready(function(){
|
||||
$('#mancredit').preventDoubleFormSubmit();
|
||||
$("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@
|
|||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") | $raw %]
|
||||
[% Asset.js("js/additional-fields-entry.js") | $raw %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
var type_fees = {};
|
||||
[% FOREACH debit_type IN debit_types %]
|
||||
type_fees['[% debit_type.code | html %]'] = "[% IF debit_type.default_amount %][% debit_type.default_amount | $Price on_editing => 1 %][% END %]";
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@
|
|||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") | $raw %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
$(document).ready(function() {
|
||||
|
||||
[% IF disable_superlibrarian_privs && patron.is_superlibrarian %]
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@
|
|||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") | $raw %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
function generate_password() {
|
||||
// Always generate a strong password
|
||||
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@
|
|||
}
|
||||
});
|
||||
</script>
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
// Apply DataTables on the results table
|
||||
var table_settings = [% TablesSettings.GetTableSettings( 'members', 'member', 'memberresultst', 'json' ) | $raw %];
|
||||
[% UNLESS CAN_user_borrowers_edit_borrowers OR CAN_user_tools_manage_patron_lists %]
|
||||
|
|
|
|||
|
|
@ -1628,7 +1628,7 @@
|
|||
[% INCLUDE 'calendar.inc' %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") | $raw %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
function update_cardnumber_warning(size){
|
||||
var max_len = [% maxlength_cardnumber | html %];
|
||||
if ( size >= max_len ) {
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@
|
|||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") | $raw %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
$(document).ready(function(){
|
||||
[%- IF ( active ) -%]
|
||||
$("#panel-" + [% active | html %] + "_panel").collapse("show");
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@
|
|||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'slip-print.inc' #printThenClose %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
var checkouts_columns = [% TablesSettings.GetTableSettings( 'circ', 'print_summary', 'print-summary-checkouts', 'json' ) | $raw %];
|
||||
var holds_columns = [% TablesSettings.GetTableSettings( 'circ', 'print_summary', 'print-summary-holds', 'json' ) | $raw %];
|
||||
var fines_columns = [% TablesSettings.GetTableSettings( 'circ', 'print_summary', 'print-summary-fines', 'json' ) | $raw %];
|
||||
|
|
|
|||
|
|
@ -811,7 +811,7 @@
|
|||
[% INCLUDE 'datatables.inc' %]
|
||||
[% INCLUDE 'select2.inc' %]
|
||||
[% PROCESS 'modal-claims-js' %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
/* Set some variable needed in circulation.js */
|
||||
var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
|
||||
var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
|
||||
|
|
@ -834,6 +834,20 @@
|
|||
[% END %]
|
||||
var SuspendHoldsIntranet = [% ( Koha.Preference('SuspendHoldsIntranet') ) ? 1 : 0 | html %];
|
||||
var DisplayAddHoldGroups = [% ( Koha.Preference('DisplayAddHoldGroups') ) ? 1 : 0 | html %];
|
||||
|
||||
const LoadCheckoutsTableDelay = 0;
|
||||
const AlwaysLoadCheckoutsTable = [% Koha.Preference('AlwaysLoadCheckoutsTable') | html %];
|
||||
|
||||
table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
|
||||
table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
|
||||
table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %]
|
||||
table_settings_bookings_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'bookings-table', 'json' ) | $raw %]
|
||||
CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
|
||||
patron_borrowernumber = [% patron.borrowernumber | $raw %]
|
||||
|
||||
var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
|
||||
var fines = "[% fines | $Price %]";
|
||||
|
||||
</script>
|
||||
[% Asset.js("js/pages/circulation.js") | $raw %]
|
||||
[% IF Koha.Preference('ClaimReturnedLostValue') || Koha.Preference('BundleLostValue') %]
|
||||
|
|
@ -853,18 +867,6 @@
|
|||
[% Asset.js("js/throttledButton.js") | $raw %]
|
||||
[% Asset.js("js/hold-group.js") | $raw %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
const LoadCheckoutsTableDelay = 0;
|
||||
const AlwaysLoadCheckoutsTable = [% Koha.Preference('AlwaysLoadCheckoutsTable') | html %];
|
||||
|
||||
table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
|
||||
table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
|
||||
table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %]
|
||||
table_settings_bookings_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'bookings-table', 'json' ) | $raw %]
|
||||
CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
|
||||
patron_borrowernumber = [% patron.borrowernumber | $raw %]
|
||||
|
||||
var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
|
||||
var fines = "[% fines | $Price %]";
|
||||
var MSG_CONFIRM_RENEW = _("The patron has a debt of %s").format(fines);
|
||||
MSG_CONFIRM_RENEW += _("Are you sure you want to renew checkout(s)?");
|
||||
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@
|
|||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") | $raw %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
var table_settings = [% TablesSettings.GetTableSettings('members', 'pay', 'pay-fines-table', 'json') | $raw %];
|
||||
const payment_id = "[% payment_id | html %]";
|
||||
const change_given = "[% change_given | html %]";
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@
|
|||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") | $raw %]
|
||||
[% Asset.js("js/additional-fields-entry.js") | $raw %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
$(document).ready(function() {
|
||||
[% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
|
||||
window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id | html %]&change_given=[% change_given | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@
|
|||
[% INCLUDE 'modals/checkout_renewals.inc' %]
|
||||
[% INCLUDE 'js-date-format.inc' %]
|
||||
[% Asset.js("js/checkout_renewals_modal.js") | $raw %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
// FIXME This cannot work without bKohaColumnsUseNames
|
||||
var column_sort = [% Koha.Preference('RecordStaffUserOnCheckout') ? 11 : 10 | html %];
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@
|
|||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") | $raw %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
$(document).ready(function () {
|
||||
$("#enable-2FA").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@
|
|||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
var patron_id = "[% borrowernumber | html %]";
|
||||
</script>
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
$(document).ready(function () {
|
||||
$("#catst").kohaTable({
|
||||
|
|
@ -81,7 +84,7 @@
|
|||
</script>
|
||||
[% IF ( SUCCESS ) %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
self.opener.location.href='/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | html %]';
|
||||
self.opener.location.href=`/cgi-bin/koha/members/moremember.pl?borrowernumber=${patron_id}`;
|
||||
window.close();
|
||||
</script>
|
||||
[% END %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue