Bug 28347: Add DataTables, additional information to patron attribute types management

This patch enhances the display of patron attribute information on the
attribute management page.

To test, apply the patch and go to Administration -> Patron attribute
types.

 - If necessary, add multiple patron attributes so that there is data to
   display. Include:
   - Some which are mandatory
   - Some which are linked to an authorized value category
   - Some which share a class.
 - The tables showing your attributes should each have DataTables
   sorting and controls (except for column configuration, which isn't
   added by this patch).
 - Confirm that DataTable controls work correctly for each table.
 - The table should include columns showing authorized value category
   and whether the attribute is mandatory.
 - If you are logged in as a user with permission to manage
   authorized values, the data in the authorized value category
   column should be linked to that category on the authorized values
   page.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Owen Leonard 2021-05-12 18:35:27 +00:00 committed by Jonathan Druart
parent 7e1227890b
commit 0511ced01c

View file

@ -292,13 +292,15 @@ Patron attribute types &rsaquo; Administration &rsaquo; Koha
[% IF attribute.class %]
<h4>[% attribute.lib | html %]</h4>
[% END %]
<table class="patron_attributes_types">
<table class="patron_attributes_types" id="patron_attr[% attribute.class | html %]">
<thead>
<tr>
<th>Code</th>
<th>Description</th>
<th>Branches limitation</th>
<th class="noExport">Actions</th>
<th>Library limitation</th>
<th>Authorized value category</th>
<th>Mandatory</th>
<th class="NoSort noExport">Actions</th>
</tr>
</thead>
<tbody>
@ -315,15 +317,28 @@ Patron attribute types &rsaquo; Administration &rsaquo; Koha
[% END %]
<span title="[% branches_str | html %]">
[% IF libraries.count > 1 %]
[% libraries.count | html %] branches limitations
[% libraries.count | html %] library limitations
[% ELSE %]
[% libraries.count | html %] branch limitation
[% libraries.count | html %] library limitation
[% END %]
</span>
[% ELSE %]
No limitation
[% END %]
</td>
<td>
[% IF ( CAN_user_parameters_manage_auth_values ) %]
<a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% item.authorised_value_category | uri %]">[% item.authorised_value_category | html %]</a></td>
[% ELSE %]
[% item.authorised_value_category | html %]
[% END %]
<td>
[% IF ( item.mandatory ) -%]
Yes
[% ELSE -%]
No
[% END %]
</td>
<td class="actions">
<a class="btn btn-default btn-xs" href="[% script_name | url %]?op=edit_attribute_type&amp;code=[% item.code | uri %]"><i class="fa fa-pencil"></i> Edit</a>
<a class="btn btn-default btn-xs" href="[% script_name | url %]?op=delete_attribute_type&amp;code=[% item.code | uri %]"><i class="fa fa-trash"></i> Delete</a>
@ -353,6 +368,8 @@ Patron attribute types &rsaquo; Administration &rsaquo; Koha
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
$(document).ready(function() {
if ( $("#branches option:selected").length < 1 ) {
@ -366,6 +383,14 @@ Patron attribute types &rsaquo; Administration &rsaquo; Koha
$("#opac_editable").attr('disabled', true).parent().attr('aria-disabled', 'true');
}
} ).change();
$(".patron_attributes_types").each(function(){
var tableid = $(this).attr("id");
KohaTable( tableid, {
"bPaginate": false,
'autoWidth': false,
}, null );
});
});
</script>
[% END %]