Browse Source

Bug 16784: Add table configuration on suggestions table

This patch adds DataTables column configuration and export options to
the suggestions management tables in the staff interface.

The columns settings made via the administrative interface will affect
tables under each tab in the interface whether it be organized by
status, library, etc. However because of the way the KohaTable function
is currently written, changes made via the "Columns" button will only
affect the visible table.

To test, apply the patch and go to Acquisitions -> Suggestions.

 - Under each tab, the table of suggestions should have a DataTables
   toolbar with export and columns buttons. These controls should work
   correctly:
   - Showing and hiding columns should work as expected
   - Exports should work, excluding the first and last columns
 - Test the tables when using the various "Organize by" settings.
 - Test changing the settings in Administration -> Columns settings.
   - Verify that the changes you make to that configuration are
     reflected in the suggestions tables.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Owen Leonard 4 years ago
committed by Martin Renvoize
parent
commit
fb526fb155
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 27
      admin/columns_settings.yml
  2. 42
      koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt

27
admin/columns_settings.yml

@ -101,6 +101,33 @@ modules:
cannot_be_toggled: 1
cannot_be_modified: 1
suggestions:
suggestions:
-
columnname: selections
cannot_be_toggled: 1
cannot_be_modified: 1
-
columnname: suggestion
-
columnname: suggested_by
-
columnname: suggested_on
-
columnname: managed_by
-
columnname: managed_on
-
columnname: library
-
columnname: library_fund
-
columnname: suggestion_status
-
columnname: actions
cannot_be_toggled: 1
cannot_be_modified: 1
admin:
currency:
currencies-table:

42
koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt

@ -4,6 +4,7 @@
[% USE AuthorisedValues %]
[% USE KohaDates %]
[% USE Price %]
[% USE ColumnsSettings %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Acquisitions &rsaquo;
@ -501,7 +502,7 @@
<table id="[% suggestion.suggestiontype | html %]t" class="sorted">
<thead>
<tr>
<th class="NoSort">&nbsp;</th>
<th class="NoSort noExport">&nbsp;</th>
<th class="anti-the">Suggestion</th>
<th>Suggested by</th>
<th>Suggested on</th>
@ -510,7 +511,7 @@
<th>Library</th>
<th>Fund</th>
<th>Status</th>
<th class="NoSort">&nbsp;</th>
<th class="NoSort noExport">&nbsp;</th>
</tr>
</thead>
<tbody>
@ -810,7 +811,7 @@
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
[% IF ( op == 'show' || op_else ) %]
<script type="text/javascript">
<script>
$(document).ready(function(){
$(".deletesuggestion").on("click",function(){
return confirm(_("Are you sure you want to delete this suggestion?"));
@ -820,8 +821,9 @@
[% END %]
[% IF ( op_else ) %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
<script type="text/javascript">
<script>
/**
* displayOther.
* This function display the select or an textaera to write a reason.
@ -831,20 +833,22 @@
$("#"+show+id).show();
}
$(document).ready(function() {
$('#suggestiontabs').tabs({
// Correct table sizing for tables hidden in tabs
// http://www.datatables.net/examples/api/tabs_and_scrolling.html
"activate": function(event, ui) {
$( $.fn.dataTable.tables( true ) ).DataTable().columns.adjust();
}
});
$(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] }
],
"sPaginationType": "full"
}));
$('#suggestiontabs').tabs();
columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'suggestions', 'suggestions', 'json' ) | $raw %]
[% FOREACH suggestion IN suggestions %]
[% IF ( suggestion.suggestions_loop ) %]
KohaTable("[% suggestion.suggestiontype %]t", {
"sorting": [[ 1, "asc" ]],
"autoWidth": false,
"columnDefs": [
{ "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] },
]
}, columns_settings );
[% END %]
[% END %]
[% FOREACH suggestion IN suggestions %]
// functions for [% suggestion.suggestiontype | html %] interactions
$("#CheckAll[% suggestion.suggestiontype | html %]").click(function(e){
@ -948,7 +952,7 @@
</script>
[% END %]
[% IF ( op_save ) %]
<script type="text/javascript">
<script>
$(document).ready(function(){
calcNewsuggTotal();
$("#quantity,#price,#currency").on("change",function(){

Loading…
Cancel
Save