@@ -, +, @@ wih AV - FIX display/hide attr on memberentry.pl when category changes - Attr classes filled with AV 'PA_CLASS' category (you have to create AV with a new category 'PA_CLASS' to fill class list) - Use tables (classes separation) on member modification and attr management (admin). Theses array are sorted by name. --- admin/patron-attr-types.pl | 28 +++++- .../prog/en/modules/admin/patron-attr-types.tt | 62 +++++++---- .../prog/en/modules/members/memberentrygen.tt | 108 +++++++++++--------- members/memberentry.pl | 17 +++- members/moremember.pl | 2 +- 5 files changed, 136 insertions(+), 81 deletions(-) --- a/admin/patron-attr-types.pl +++ a/admin/patron-attr-types.pl @@ -22,6 +22,8 @@ use strict; use warnings; use CGI; +use List::MoreUtils qw/uniq/; + use C4::Auth; use C4::Context; use C4::Output; @@ -84,6 +86,7 @@ sub add_attribute_type_form { confirm_op => 'add_attribute_type_confirmed', ); authorised_value_category_list($template); + pa_classes($template); } sub error_add_attribute_type_form { @@ -237,9 +240,9 @@ sub edit_attribute_type_form { $template->param(display_checkout_checked => 'checked="checked"'); } authorised_value_category_list($template, $attr_type->authorised_value_category()); + pa_classes( $template, $attr_type->class ); $template->param ( category_type => $attr_type->category_type ); - $template->param ( class => $attr_type->class ); $template->param( attribute_type_form => 1, @@ -251,9 +254,21 @@ sub edit_attribute_type_form { sub patron_attribute_type_list { my $template = shift; - + my @attr_types = C4::Members::AttributeTypes::GetAttributeTypes(); - $template->param(available_attribute_types => \@attr_types); + my @classes = sort uniq( map {$_->{class}} @attr_types ); + my @attributes_loop; + for my $class (@classes) { + my @items; + for my $attr (@attr_types) { + push @items, $attr if $attr->{class} eq $class + } + push @attributes_loop, { + class => $class, + items => \@items + }; + } + $template->param(available_attribute_types => \@attributes_loop); $template->param(display_list => 1); } @@ -270,3 +285,10 @@ sub authorised_value_category_list { } $template->param(authorised_value_categories => \@list); } + +sub pa_classes { + my $template = shift; + my $selected = @_ ? shift : ''; + + $template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS', $selected ) ); +} --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt @@ -201,8 +201,21 @@ function CheckAttributeTypeForm(f) {
Class | -Code | -Description | -Actions | -
---|
[% available_attribute_type.class |html %] | -[% available_attribute_type.code |html %] | -[% available_attribute_type.description %] | -- Edit - Delete - | +Code | +Description | +Actions |
---|
There are no saved patron attribute types.
[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -63,16 +63,19 @@ } function update_category_code(category_type) { - var mytable = $("#attributes_table>tbody"); + if ( $(category_type).is("select") ) { + category_type = $("#categorycode").find("option:selected").attr("data-typename"); + } + var mytables = $(".attributes_table>tbody"); - mytable.find("tr").each(function(){ + mytables.find("tr").each(function(){ $(this).hide() }); - mytable.find("tr[data-category_type="+category_type+"]").each(function(){ + mytables.find("tr[data-category_type="+category_type+"]").each(function(){ $(this).show(); }); - mytable.find("tr[data-category_type='']").each(function(){ + mytables.find("tr[data-category_type='']").each(function(){ $(this).show(); }); @@ -1192,7 +1195,7 @@ [% IF ( opduplicate ) %] [% ELSE %] - + [% END %] @@ -1207,62 +1210,67 @@