From bef25e79778dc02b3bd12127e77a4822841e864f Mon Sep 17 00:00:00 2001 From: Owen Leonard <oleonard@myacpl.org> Date: Wed, 23 May 2018 17:59:28 +0000 Subject: [PATCH] Bug 20807: Lost items report: Improve the display of CSV profile errors This patch modifies the template for the lost items report to change the way it handles a missing CSV profile. Now, if there is a missing CSV profile, a message is displayed with details about the profile requirements. If the logged-in user has the right permission there is a link to the CSV profiles page. Since item selection is used only in conjunction with exporting results, item selection controls are all hidden when there is no valid CSV profile. To test, apply the patch go to Reports -> Lost items. - Run the report with parameters which will return results. - If your system has no CSV profile for exporting lost items: - If you are logged in as a user with manage_csv_profiles permission: - You should see a message dialog instructing you to create a CSV profile with a link to the CSV profiles page. - If you are not logged in as a user with manage_csv_profiles permission: - You should see a similar message but without a link to the CSV profiles page. - In both cases, with no CSV profile defined there should be no checkboxes in the table of results and no "select all/clear all" controls. - If your system has a valid CSV profile for exporting lost items: - Checking the checkbox for one or more items in the table should trigger the display of an "Export selected items" link. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> --- .../prog/en/modules/reports/itemslost.tt | 50 ++++++++++++------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt index 596e99dffa..a8cb2ba516 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt @@ -36,29 +36,41 @@ </div> [% IF items.count %] - <div class="lostitems-table_table_controls"> + [% IF csv_profiles.count %] + <div class="lostitems-table_table_controls"> | <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a> <span class="itemselection_actions"> - | Actions: - [% IF csv_profiles.count %] - <a class="itemselection_action_export"><i class="fa fa-download"></i> Export selected items</a> - Using the following CSV profile: - <select name="csv_profile_id" id="csv_profile_id"> - [% FOREACH csv_profile IN csv_profiles %] - <option value="[% csv_profile.export_format_id %]">[% csv_profile.profile %]</<option> - [% END %] - </select> - [% ELSE %] - <span class="itemselection_action_export" title="You should create a CSV profile for export_lost_items"><i class="fa fa-download"></i> Export selected items</a> - [% END %] + | Actions: + <a class="itemselection_action_export"><i class="fa fa-download"></i> Export selected items</a> + Using the following CSV profile: + <select name="csv_profile_id" id="csv_profile_id"> + [% FOREACH csv_profile IN csv_profiles %] + <option value="[% csv_profile.export_format_id %]"> + [% csv_profile.profile %] + </option> + [% END %] + </select> </span> - </div> + </div> + [% ELSE %] + <div class="dialog message"> + [% IF ( CAN_user_tools_manage_csv_profiles ) %] + To enable the export of selected items, <a href="/cgi-bin/koha/tools/csv-profiles.pl">create a CSV profile</a> of the type "SQL" with usage option "Export lost items in report." + [% ELSE %] + To enable the export of selected items, your administrator must create a CSV profile of the type "SQL" with usage option "Export lost items in report." + [% END %] + </div> + <div class="lostitems-table_table_controls"> + </div> + [% END %] <table id="lostitems-table"> <thead> <tr> - <th class="NoSort"></th> + [% IF csv_profiles.count %] + <th class="NoSort"></th> + [% END %] <th>Title</th> <th>Author</th> <th>Lost status</th> @@ -79,9 +91,11 @@ <tbody> [% FOREACH item IN items %] <tr> - <td style="text-align:center;vertical-align:middle"> - <input type="checkbox" value="[% item.itemnumber %]" name="itemnumber" /> - </td> + [% IF csv_profiles.count %] + <td style="text-align:center;vertical-align:middle"> + <input type="checkbox" value="[% item.itemnumber %]" name="itemnumber" /> + </td> + [% END %] <td> <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber %]" title="[% item.itemnotes %]">[% item.biblio.title |html %]</a> </td> -- 2.17.0