From 293c0c16c241e5f84b5f7b666e3caa46aa208745 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 18 Jul 2014 14:18:12 -0400 Subject: [PATCH] Bug 7944 - attribute error could be clearer If you try to create a patron and enter an extended attribute value which is required to be unique but exists in another record the error you receive is not clear. It uses the attribute code instead of the description. This patch adds description to the output. To test you must have ExtendedPatronAttributes enabled. - Edit or create an extended patron attribute and designate it a unique identifier. - Edit a patron and add a value to that attribute. - Edit another patron and try to add the same value. You should get an error which includes both the description of the attribute you tried to modify and the value you submitted. Signed-off-by: Christopher Brannon Signed-off-by: Katrin Fischer Works as described, no problems found. Passes tests and Qa script. Signed-off-by: Tomas Cohen Arazi --- .../prog/en/modules/members/memberentrygen.tt | 3 +-- members/memberentry.pl | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 6745d6264f..da52fb764e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -207,8 +207,7 @@
  • Passwords do not match.
  • [% END %] [% IF ( ERROR_extended_unique_id_failed ) %] -
  • The attribute value - [% ERROR_extended_unique_id_failed_value %] is already in use by another patron record.
  • +
  • [% ERROR_extended_unique_id_failed_description %] attribute value [% ERROR_extended_unique_id_failed_value %] is already in use by another patron record.
  • [% END %] diff --git a/members/memberentry.pl b/members/memberentry.pl index 49f728ee41..3c7f64828c 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -338,8 +338,13 @@ if ($op eq 'save' || $op eq 'insert'){ $extended_patron_attributes = parse_extended_patron_attributes($input); foreach my $attr (@$extended_patron_attributes) { unless (C4::Members::Attributes::CheckUniqueness($attr->{code}, $attr->{value}, $borrowernumber)) { + my $attr_info = C4::Members::AttributeTypes->fetch($attr->{code}); push @errors, "ERROR_extended_unique_id_failed"; - $template->param(ERROR_extended_unique_id_failed_value => "$attr->{code}/$attr->{value}"); + $template->param( + ERROR_extended_unique_id_failed_code => $attr->{code}, + ERROR_extended_unique_id_failed_value => $attr->{value}, + ERROR_extended_unique_id_failed_description => $attr_info->description() + ); } } } -- 2.39.5