From ae955d641074ea5ad3e15e94ccfbe26ab2cd3158 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 17 Mar 2020 00:55:05 +0000 Subject: [PATCH] Bug 24886: Reindent reports template This patch reindents the template for saved reports, replacing tabs with spaces and making indentation consistent. Some lines have been split up. To test, apply the patch and go to Reports -> Use saved. - Test adding, editing, viewing, and running reports - Test filtering by group and subgroup - Test the process of adding a guided report Everything should work as expected. Use your preferred method for checking the differences between files while ignoring whitespace. I use diff with the "-w" flag, but I'm not your dad. The only changes you see should be split lines. Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- .../modules/reports/guided_reports_start.tt | 2132 +++++++++-------- 1 file changed, 1164 insertions(+), 968 deletions(-) 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 131f8b6d46..de395abbf1 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 @@ -19,27 +19,41 @@ [% INCLUDE 'doc-head-open.inc' %] -Koha › Reports › Guided reports wizard [%- IF ( saved1 ) -%]› Saved reports -[%- ELSIF ( create ) -%]› Create from SQL -[%- ELSIF ( showsql ) -%]› Saved reports › SQL view -[%- ELSIF ( execute ) -%]› Saved reports › [% name | html %] Report -[%- ELSIF ( editsql ) -%]› Saved reports › Edit SQL report -[%- END -%] -[%- IF ( build1 ) -%]› Build a report, step 1 of 6: Choose a module -[%- ELSIF ( build2 ) -%]› Build a report, step 2 of 6: Pick a report type -[%- ELSIF ( build3 ) -%]› Build a report, step 3 of 6: Select columns for display -[%- ELSIF ( build4 ) -%]› Build a report, step 4 of 6: Select criteria to limit on -[%- ELSIF ( build5 ) -%]› Build a report, step 5 of 6: Pick which columns to total -[%- ELSIF ( build6 ) -%]› Build a report, step 6 of 6: Select how you want the report ordered -[%- END -%] + + Koha › Reports › Guided reports wizard + [%- IF ( saved1 ) -%] + › Saved reports + [%- ELSIF ( create ) -%] + › Create from SQL + [%- ELSIF ( showsql ) -%] + › Saved reports › SQL view + [%- ELSIF ( execute ) -%] + › Saved reports › [% name | html %] Report + [%- ELSIF ( editsql ) -%] + › Saved reports › Edit SQL report + [%- END -%] + [%- IF ( build1 ) -%] + › Build a report, step 1 of 6: Choose a module + [%- ELSIF ( build2 ) -%] + › Build a report, step 2 of 6: Pick a report type + [%- ELSIF ( build3 ) -%] + › Build a report, step 3 of 6: Select columns for display + [%- ELSIF ( build4 ) -%] + › Build a report, step 4 of 6: Select criteria to limit on + [%- ELSIF ( build5 ) -%] + › Build a report, step 5 of 6: Pick which columns to total + [%- ELSIF ( build6 ) -%] + › Build a report, step 6 of 6: Select how you want the report ordered + [%- END -%] + [% INCLUDE 'doc-head-close.inc' %] [% Asset.css("lib/codemirror/codemirror.min.css") | $raw %] [% Asset.css("css/reports.css") | $raw %] [% Asset.css("lib/d3c3/c3.min.css") | $raw %] @@ -49,41 +63,54 @@ [% INCLUDE 'header.inc' %] [% INCLUDE 'circ-search.inc' %] - -[% ELSE %]
- [% IF (filter_set || filters.date || filters.author || filters.keyword) %] -

No saved reports match your criteria.

- [% IF ( CAN_user_reports_create_reports ) %] -
- - -
- -
- - -
- -
- - - - -
+ [% INCLUDE 'mana/mana-share-report.inc' %] - [% END %] - [% ELSE %] -

There are no saved reports.

- [% IF ( CAN_user_reports_create_reports ) %] - Build a new report? - [% END %] - [% END %] -
-[% END %] -[% END %] - -[% INCLUDE 'mana/mana-share-report.inc' %] + [% IF ( build1 ) %] + [% IF ( cache_error) %] +
+ Please choose a cache_expiry less than 30 days +
+ [% END %] -[% IF ( build1 ) %] -[% IF ( cache_error) %] -
- Please choose a cache_expiry less than 30 days -
-[% END %] -

Build a report

-
-
-Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility -
    -
  1. - - -
  2. -[% IF (public) %] -
  3. -[% ELSE %] -
  4. -[% END %] -[% IF (usecache) %]
  5. - - -
  6. [% END %] -
-
-
- - - -
-
-[% END %] +

Build a report

+
+
+ Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility +
    +
  1. + + +
  2. + [% IF (public) %] +
  3. + + +
  4. + [% ELSE %] +
  5. + + +
  6. + [% END %] + [% IF (usecache) %] +
  7. + + + +
  8. + [% END %] +
+
+
+ + +
+
+ [% END %] -[% IF ( build2 ) %] -

Build a report

-
- - - -
Step 2 of 6: Pick a report type -
  1. - -
- -
- - - -
-
+ [% IF ( build2 ) %] +

Build a report

+
+ + + +
+ Step 2 of 6: Pick a report type +
    +
  1. + + +
  2. +
+
+ +
+ + + +
+
+ [% END %] -[% END %] + [% IF ( build3 ) %] +

Build a report

+

Step 3 of 6: Select columns for display

+

Note: Be careful selecting when selecting columns. If your choice is too broad it could result in a very large report that will either not complete, or slow your system down.

+ +
+ + + + +
+
+
+
+ +
+
+
+ +
+
-[% IF ( build3 ) %] -

Build a report

-

Step 3 of 6: Select columns for display

-

Note: Be careful selecting when selecting columns. If your choice is too broad it could result in a very large report that will either not complete, or slow your system down.

- - - - - - -
-
-
-
+ +
+
+
+
+ + + +
+ + [% END %] - -[% ELSE %] - -[% END %] -[% END %] - -
-

-
- + [% IF ( build4 ) %] +

Build a report

+
+ + + + + +
+ Step 4 of 6: Select criteria to limit on + + [% FOREACH criteri IN criteria %] + + + [% IF ( criteri.date ) %] + + + [% ELSE %] + [% IF ( criteri.textrange ) %] + + + [% ELSE %] + [% IF ( criteri.daterange ) %] + + + [% ELSE %] + + + [% END %] + [% END %] + [% END %] + [% END %] +
+ + + + + [% INCLUDE 'date-format.inc' %] +
+ from + to + +
+ from + + to + + [% INCLUDE 'date-format.inc' %] +
+ +
+
+ + [% IF ( definitions ) %] +
+ Dictionary definitions + + [% FOREACH definition IN definitions %] + + + + [% END %] +
+ + [% definition.name | html %] +
+
+ [% END %] -
- -
- -
-
- - - -
- +
+ + + +
+ + [% END %] -[% END %] + [% IF ( build5 ) %] +

Build a report

+

Step 5 of 6: Pick which columns to total

+
+ + + + + + + +
+ + [% FOREACH total_b IN total_by %] + + + + + [% END %] +
+ + + + +
+
+ +
+ + +
+
+ [% END %] -[% IF ( build4 ) %] -

Build a report

-
- - - - - -
Step 4 of 6: Select criteria to limit on - - [% FOREACH criteri IN criteria %] - - - [% IF ( criteri.date ) %] - - - [% ELSE %] - [% IF ( criteri.textrange ) %] - - - [% ELSE %] - [% IF ( criteri.daterange ) %] - - - [% ELSE %] - - - [% END %] - [% END %] - [% END %] - [% END %] -
- - - - - [% INCLUDE 'date-format.inc' %] -
from - to - -
from - - to - - [% INCLUDE 'date-format.inc' %] -
- + + + + + + + +
+ + [% FOREACH order_b IN order_by %] + + + + + [% END %] +
+ + + + +
+
+
+ + +
+ [% END %] - -
-
- -[% IF ( definitions ) %] -
Dictionary definitions - -[% FOREACH definition IN definitions %] - -[% END %] -
[% definition.name | html %]
-
-[% END %] -
- -
- -[% END %] + [% IF ( showreport ) %] +

Confirm custom report

+

Your report will be generated with the following SQL statement.

+

+ [% sql | html %] +

+ +
+ + + + +

You will need to save the report before you can execute it

+
+ +
+
+ [% END %] + [% IF ( save ) %] +
+ + + + + +
+ Save your custom report +
    +
  1. + + + Required +
  2. + [% PROCESS group_and_subgroup_selection %] +
  3. + + +
  4. +
+
+
+ +
+
+ [% END %] -[% IF ( build5 ) %] -

Build a report

-

Step 5 of 6: Pick which columns to total

-
- - - - - - - -
-[% FOREACH total_b IN total_by %] - - -[% END %] -
+ [% IF ( warn_authval_problem ) %] +
+

Errors found when processing parameters for report: [% name | html %]

+ [% FOREACH problematic_authval IN problematic_authvals %] +

+ [% problematic_authval.name | html %]: The authorized value category ([% problematic_authval.authval | html %]) + you selected does not exist. +

+ [% END %] + + + + + + + + + + + + + [% IF ( phase_update) %] + + + [% ELSIF ( phase_save) %] + + + + [% END %] + + +
+ +
+
+ [% END %] -
+ [% IF ( enter_params ) %] +
+ + [% IF ( auth_val_error ) %] + +
+

Errors found when processing parameters for report: [% name | html %]

+ [% FOREACH auth_val_error IN auth_val_errors %] +

+ [% auth_val_error.entry | html %]: The authorized value category ([% auth_val_error.auth_val | html %]) + you selected does not exist. +

+ [% END %] +
+
+ [% ELSE %] + +

Enter parameters for report [% name | html %]:

+ [% IF ( notes ) %] +

[% notes | html %]

+ [% END %] +
+
    + [% FOREACH sql_param IN sql_params %] + + [% IF sql_param.input == 'date' %] +
  1. + +
  2. + [% ELSIF ( sql_param.input == 'text' ) %] +
  3. + + +
  4. + [% ELSE %] +
  5. + + +
  6. + [% END %] + [% END %] +
+
+
+ +
+ [% END %] +
+ [% END %] -
- -
- -[% END %] + [% IF ( execute ) %] +

[% name | html %]

+ [% IF ( notes ) %] +

Notes: [% notes | html %]

+ [% END %] + [% IF ( unlimited_total ) %] +

+ Total number of results: + [% unlimited_total | html %] + [% IF unlimited_total > limit %] + ([% limit | html %] shown) + [% END %]. +

+ [% END %] + + + +
+ + [% IF ( execute ) %] + [% UNLESS ( errors ) %] +
+ + + [% # Preserve the whitespace of the following textarea in order to format the values correctly %] + +
+ +
+ + + [% # Preserve the whitespace of the following textarea in order to format the values correctly %] + +
+ +
+ + [% FOREACH result IN results %] + [% FOREACH cells IN result.cells %] + [% place = loop.index %] + [% NEXT UNLESS cells.cell.match('^(\d+)$') %] + [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %] + [% SET batch_itemnumbers = 1 %] + [% SET header_row.$place.has_itemnumbers = 1 %] + + [% END %] + [% END %] + [% END %] +
+ +
+ + + [% FOREACH result IN results %] + [% FOREACH cells IN result.cells %] + [% place = loop.index %] + [% NEXT UNLESS cells.cell.match('^(\d+)$') %] + [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %] + [% SET batch_itemnumbers = 1 %] + [% SET header_row.$place.has_itemnumbers = 1 %] + + [% END %] + [% END %] + [% END %] +
+ +
+ [% FOREACH result IN results %] + [% FOREACH cells IN result.cells %] + [% place = loop.index %] + [% NEXT UNLESS cells.cell.match('^(\d+)$') %] + [% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %] + [% SET batch_biblionumbers = 1 %] + [% SET header_row.$place.has_biblionumbers = 1 %] + + [% END %] + [% END %] + [% END %] +
+ +
+ + [% # Preserve the whitespace of the following textarea in order to format the values correctly %] + +
+ + [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %] +

+

+

+ [% END %] + [% END # UNLESS ( errors ) %] + [% END # IF ( execute ) %] -[% IF ( build6 ) %] -

Build a report

-

Step 6 of 6: Choose how you want the report ordered

-
- - - - - - - - -
[% FOREACH order_b IN order_by %] - + + + -[% END %] -
- -
+ [% FOREACH p IN sql_params %] + + [% END %] + [% FOREACH n IN param_names %] + + [% END %] -
- -
-
-[% END %] + + + + +
[% pagination_bar | $raw %]
+ [% UNLESS ( errors ) %] + + + [% FOREACH header_ro IN header_row %] + + [% END %] + + [% FOREACH result IN results %] + + [% FOREACH cells IN result.cells %] + + [% END %] + + [% END %] +
[% header_ro.cell | html %]
[% cells.cell | $raw %]
+ [% END %] + [% INCLUDE 'chart.inc' %] -[% IF ( showreport ) %] -

Confirm custom report

-

Your report will be generated with the following SQL statement.

-

-[% sql | html %] -

- -
- - - - -

You will need to save the report before you can execute it

-
-
-
-[% END %] + [% END %] -[% IF ( save ) %] -
- - - - - -
-Save your custom report -
    -
  1. Required
  2. - [% PROCESS group_and_subgroup_selection %] -
  3. -
-
-
-
-[% END %] + [% IF ( create ) %] +
+
+ Create report from SQL +
    +
  1. + + [% IF ( reportname ) %] + + [% ELSE %] + + [% END %] + Required +
  2. + [% PROCESS group_and_subgroup_selection %] + + [% IF (public) %] +
  3. + + +
  4. + [% ELSE %] +
  5. + + +
  6. + [% END %] -[% IF ( warn_authval_problem ) %] -
    -

    Errors found when processing parameters for report: [% name | html %]

    - [% FOREACH problematic_authval IN problematic_authvals %] -

    - [% problematic_authval.name | html %]: The authorized value category ([% problematic_authval.authval | html %]) - you selected does not exist. -

    - [% END %] - - - - - - - - - - - - - [% IF ( phase_update) %] - - - [% ELSIF ( phase_save) %] - - - - [% END %] - - -
    - -
    -
    -[% END %] + [% IF (usecache) %] +
  7. + + + +
  8. + [% END %] +
  9. + + +
  10. +
+
+ +
+ SQL: +
+ + Required +
+
+ +
+ + + Cancel +
+ + [% END %] -[% IF ( enter_params ) %] -
- - [% IF ( auth_val_error ) %] - -
-

Errors found when processing parameters for report: [% name | html %]

- [% FOREACH auth_val_error IN auth_val_errors %] -

- [% auth_val_error.entry | html %]: The authorized value category ([% auth_val_error.auth_val | html %]) - you selected does not exist. -

- [% END %] -
-
- [% ELSE %] - -

Enter parameters for report [% name | html %]:

- [% IF ( notes ) %]

[% notes | html %]

[% END %] -
-
    - [% FOREACH sql_param IN sql_params %] - - [% IF sql_param.input == 'date' %] -
  1. - -
  2. - [% ELSIF ( sql_param.input == 'text' ) %] -
  3. - [% ELSE %] -
  4. - -
  5. + [% END %] - [% END %] -
-
-
- [% END %] -
-[% END %] -[% IF ( execute ) %] -

[% name | html %]

-[% IF ( notes ) %]

Notes: [% notes | html %]

[% END %] -[% IF ( unlimited_total ) %]

Total number of results: [% unlimited_total | html %][% IF unlimited_total > limit %] ([% limit | html %] shown)[% END %].

[% END %] - - - - -
- -[% IF ( execute ) %] - [% UNLESS ( errors ) %] -
- - - [% # Preserve the whitespace of the following textarea in order to format the values correctly %] - -
- -
- - - [% # Preserve the whitespace of the following textarea in order to format the values correctly %] - -
- -
- - [% FOREACH result IN results %] - [% FOREACH cells IN result.cells %] - [% place = loop.index %] - [% NEXT UNLESS cells.cell.match('^(\d+)$') %] - [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %] - [% SET batch_itemnumbers = 1 %] - [% SET header_row.$place.has_itemnumbers = 1 %] - - [% END %] - [% END %] - [% END %] -
- -
- - - [% FOREACH result IN results %] - [% FOREACH cells IN result.cells %] - [% place = loop.index %] - [% NEXT UNLESS cells.cell.match('^(\d+)$') %] - [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %] - [% SET batch_itemnumbers = 1 %] - [% SET header_row.$place.has_itemnumbers = 1 %] - - [% END %] + [% IF ( showsql ) %] +
+ [% reportname | html %] +
    + [% IF ( notes ) %] +
  1. + Notes: + [% notes | html %] +
  2. + [% ELSE %] + [% END %] +
  3. + +
  4. +
+
[% END %] - [% END %] -
- -
- [% FOREACH result IN results %] - [% FOREACH cells IN result.cells %] - [% place = loop.index %] - [% NEXT UNLESS cells.cell.match('^(\d+)$') %] - [% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %] - [% SET batch_biblionumbers = 1 %] - [% SET header_row.$place.has_biblionumbers = 1 %] - + + [% IF ( save_successful ) %] + [% UNLESS ( errors ) %] +
+
+
+

Your report "[% reportname | html %]" has been saved

+
+
[% END %] [% END %] - [% END %] -
- -
- - [% # Preserve the whitespace of the following textarea in order to format the values correctly %] - -
- - [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %] -

-

-

- [% END %] - [% END # UNLESS ( errors ) %] -[% END # IF ( execute ) %] - - - - - - [% FOREACH p IN sql_params %] - - [% END %] - [% FOREACH n IN param_names %] - - [% END %] + + + +
+ SQL: +
+ + Required +
+
- - - - -
[% pagination_bar | $raw %]
-[% UNLESS ( errors ) %] - - - [% FOREACH header_ro IN header_row %] - - [% END %] - - [% FOREACH result IN results %] - - [% FOREACH cells IN result.cells %] - +
+ + Cancel +
+ [% END %] - - [% END %] -
[% header_ro.cell | html %]
[% cells.cell | $raw %]
-[% END %] - -[% INCLUDE 'chart.inc' %] - -[% END %] - -[% IF ( create ) %] -
-
-Create report from SQL -
    -
  1. - [% IF ( reportname ) %] - [% ELSE %][% END %] Required -
  2. - [% PROCESS group_and_subgroup_selection %] - -[% IF (public) %] -
  3. -[% ELSE %] -
  4. -[% END %] -[% IF (usecache) %]
  5. - - -
  6. [% END %] -
  7. -
-
-
-SQL: -
- Required -
-
- -
- Cancel -
-
-[% END %] - -[% IF saved_results %] -

Saved report results

-

[% name | html %]

-

[% notes | html %]

- -[% FOREACH rows IN saved_results %] - -[% FOREACH col IN rows %] - -[% END %] - -[% END %] -
[% col | html %]
-[% END %] - -[% IF ( showsql ) %] -
- [% reportname | html %] -
    - [% IF ( notes ) %]
  1. Notes: [% notes | html %]
  2. [% ELSE %][% END %] -
  3. -
-
-[% END %] - -[% IF ( save_successful ) %] -[% UNLESS ( errors ) %] -
-
-
-

Your report "[% reportname | html %]" has been saved

-
-
-[% END %] -[% END %] - -[% IF ( editsql ) %] -
- - -
-Edit SQL report -
    -
  1. Required
  2. -[% PROCESS group_and_subgroup_selection %] -[% IF (public) %] -
  3. -[% ELSE %] -
  4. -[% END %] -[% IF (usecache) %]
  5. - - -
  6. [% END %] -
  7. -
-
- -
- SQL: -
- Required -
-
- -
- Cancel -
-
- -[% END %] - -[% IF ( errors ) %] -
-
-The following error was encountered:
-[% FOREACH error IN errors %] - [% IF ( error.sqlerr ) %]This report contains the SQL keyword [% error.sqlerr | html %]. -
Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed. -
Please return to the "Saved Reports" screen and delete this report or retry creating a new one. - [% ELSIF ( error.queryerr ) %]The database returned the following error:
[% error.queryerr | html %]
Please check the log for further details. - [% ELSIF ( error.cache_expiry ) %]Please select a cache expiry less than 30 days. - [% ELSE %] - [% END %] - -[% END %] -
-
-
-
-[% END %] + [% IF ( errors ) %] +
+
+ The following error was encountered:
+ [% FOREACH error IN errors %] + [% IF ( error.sqlerr ) %] + This report contains the SQL keyword [% error.sqlerr | html %].
+ Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.
+ Please return to the "Saved Reports" screen and delete this report or retry creating a new one. + [% ELSIF ( error.queryerr ) %] + The database returned the following error:
+ [% error.queryerr | html %]
Please check the log for further details. + [% ELSIF ( error.cache_expiry ) %] + Please select a cache expiry less than 30 days. + [% ELSE %] + [% END %] + + [% END %] +
+
+ + +
+
+ [% END %]
- [% MACRO jsinclude BLOCK %] [% Asset.js("js/charts.js") | $raw %] [% Asset.js("lib/d3c3/d3.min.js") | $raw %] @@ -1151,7 +1348,6 @@ canned reports and writing custom SQL reports.

validator.resetForm();//remove error class on name elements and clear history validator.reset();//remove all error and success data } - [% END %] [% IF ( showsql ) %] @@ -1180,7 +1376,6 @@ canned reports and writing custom SQL reports.

} $(document).ready(function(){ - $("body").on('click',".fetch_chart_data",function(){ if( [% unlimited_total || 0 | $raw %] > 1000 ){ if( confirm("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you with to chart this report?") ){ @@ -1571,6 +1766,7 @@ canned reports and writing custom SQL reports.

load_group_subgroups(); }); [% END %] + $(".delete").on("click",function(){ return confirmDelete(MSG_CONFIRM_DELETE); }); -- 2.39.5