diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index 8e67104b57..9a71c4ed9f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -326,34 +326,32 @@
| - | ID | -Report name | -Type | -Group | -Subgroup | -Notes | -Author | -Creation date | -Last edit | -Last run | -Public | -JSON URL | ++ | ID | +Report name | +Type | +Group | +Subgroup | +Notes | +Author | +Creation date | +Last edit | +Last run | +Public | +JSON URL | [% IF (usecache) %] -Cache expiry (seconds) | +Cache expiry (seconds) | [% ELSE %] -Cache expiry (seconds) | +Cache expiry (seconds) | [% END %] -Saved results | +Saved results | [% IF has_obsolete_reports %] -Update | +Update | [% ELSE %] -Update | +Update | [% END %] - [% IF ( Koha.Preference('LimitReportsByLibrary') && ( CAN_user_superlibrarian || CAN_user_reports_manage_report_limits ) ) %] -Library limits | - [% END %] -Actions | +Library limits | +Actions | + | + [% IF ( Koha.Preference('LimitReportsByLibrary') && ( CAN_user_superlibrarian || CAN_user_reports_manage_report_limits ) ) %] [% IF savedreport.library_limits && savedreport.library_limits.size > 0 %] [% library_str = "" %] [% FOREACH library IN savedreport.library_limits %] @@ -441,8 +439,8 @@ [% ELSE %] No limitation [% END %] - | - [% END %] + [% END %] +
[%# There should be no space between these two buttons, it would render badly %]
@@ -1918,7 +1916,19 @@
[% END %]
[% END %]
+ const can_limit_reports_by_library = [% (Koha.Preference('LimitReportsByLibrary') && (CAN_user_superlibrarian || CAN_user_reports_manage_report_limits)) ? 1 : 0 | html %];
+
var table_settings = [% TablesSettings.GetTableSettings( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
+ if (table_settings && table_settings.columns) {
+ let library_limits_column = table_settings.columns.find(function (c) {
+ return c.columnname === "library_limits";
+ });
+ if (library_limits_column) {
+ library_limits_column.is_hidden = !can_limit_reports_by_library;
+ library_limits_column.cannot_be_toggled = !can_limit_reports_by_library;
+ library_limits_column.visibility_condition = !!can_limit_reports_by_library;
+ }
+ }
const tables = [% To.json(tables || []) | $raw %];
@@ -2365,22 +2375,7 @@
let report_table_settings = { columns };
$("#report_results").kohaTable({}, report_table_settings);
}
- [% IF (saved1) %]
- var table_settings = [% TablesSettings.GetTableSettings( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
- [% UNLESS ( Koha.Preference('LimitReportsByLibrary') && ( CAN_user_superlibrarian || CAN_user_reports_manage_report_limits ) ) %]
- table_settings.columns = table_settings.columns.filter(function(col) {
- return col.columnname !== 'library_limits';
- });
- [% END %]
-
- [% IF ( Koha.Preference('LimitReportsByLibrary') && ( CAN_user_superlibrarian || CAN_user_reports_manage_report_limits ) ) %]
- let library_limits_col_index = -1;
- table_settings.columns.forEach(function(col, index) {
- if (col.columnname === 'library_limits') {
- library_limits_col_index = index;
- }
- });
- [% END %]
+ if (saved1) {
var rtable = $("#table_reports").kohaTable(
{
autoWidth: false,
@@ -2388,9 +2383,8 @@
order: [[1, "asc"]],
language: {
zeroRecords: _("No matching reports found"),
- }[% IF ( Koha.Preference('LimitReportsByLibrary') && ( CAN_user_superlibrarian || CAN_user_reports_manage_report_limits ) ) %],
- columnDefs: library_limits_col_index !== -1 ? [{ visible: false, targets: [library_limits_col_index] }] : []
- [% END %]
+ },
+ bKohaColumnsUseNames: true,
},
table_settings
);
@@ -2449,7 +2443,7 @@
$("#update_sql_label").html("");
$("#update_sql .modal-body").html(' |
|---|