From 38b04b32df71754c6f7d4b67fa36d970f828ff0f Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Sat, 18 Mar 2023 10:05:32 +0000 Subject: [PATCH] Bug 32610: Add date option to extended patron attributes administration page With this page it will be possible to configure patron attributes to be a date. To test: * Go to administration > patron attribute types * Add a new patron attribute of type date * Dates cannot be repeatable or linked to an AV category, so: * Verify, if you check repeatable, date is disabled * Verify, if you select an AV category, date disabled * Verify, if you check date, AV category and repeatable are disabled * Save the new patron attribute * Edit the patron attribute * Verify all settings have been kept/stored correctly Signed-off-by: Philip Orr --- admin/patron-attr-types.pl | 2 ++ .../en/modules/admin/patron-attr-types.tt | 36 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/admin/patron-attr-types.pl b/admin/patron-attr-types.pl index e89b892776..aa53cb8c48 100755 --- a/admin/patron-attr-types.pl +++ b/admin/patron-attr-types.pl @@ -114,6 +114,7 @@ sub add_update_attribute_type { my $description = $input->param('description'); my $repeatable = $input->param('repeatable') ? 1 : 0; my $unique_id = $input->param('unique_id') ? 1 : 0; + my $is_date = $input->param('is_date') ? 1 : 0; my $opac_display = $input->param('opac_display') ? 1 : 0; my $opac_editable = $input->param('opac_editable') ? 1 : 0; my $staff_searchable = $input->param('staff_searchable') ? 1 : 0; @@ -149,6 +150,7 @@ sub add_update_attribute_type { { repeatable => $repeatable, unique_id => $unique_id, + is_date => $is_date, opac_display => $opac_display, opac_editable => $opac_editable, staff_searchable => $staff_searchable, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt index 0251a18309..4bb53b6d96 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt @@ -147,6 +147,16 @@ cannot be given to a different record. +
  • + + [% IF attribute_type.is_date %] + + [% ELSE %] + + [% END %] + If checked, attribute will be a date. Date attributes cannot be repeatable or linked to an authorised value category. +
  • +
  • [% IF attribute_type AND attribute_type.opac_display %] @@ -169,7 +179,7 @@ [% ELSE %] [% END %] - Check to make this attribute staff_searchable in the staff patron search. + Check to make this attribute searchable in the staff patron search.
  • [% IF attribute_type AND attribute_type.mandatory %] @@ -386,6 +396,30 @@ } } ).change(); + $("#is_date").change( function() { + if ( this.checked ) { + $("#repeatable, #authorised_value_category").attr('disabled', true).parent().attr('aria-disabled', 'true'); + } else { + $("#repeatable, #authorised_value_category").removeAttr('disabled').parent().removeAttr('aria-disabled'); + } + } ).change(); + + $("#repeatable").change( function() { + if ( this.checked ) { + $("#is_date").attr('disabled', true).parent().attr('aria-disabled', 'true'); + } else { + $("#is_date").removeAttr('disabled').parent().removeAttr('aria-disabled'); + } + } ).change(); + + $("#authorised_value_category").change( function() { + if ( $(this).val() != "" ) { + $("#is_date").attr('disabled', true).parent().attr('aria-disabled', 'true'); + } else { + $("#is_date").removeAttr('disabled').parent().removeAttr('aria-disabled'); + } + } ).change(); + $(".patron_attributes_types").each(function(){ var tableid = $(this).attr("id"); KohaTable( tableid, { -- 2.34.1