From 0109dd751b05b3dae0a1ae0cb24575224ae4b0a2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 6 May 2021 12:38:52 +0200 Subject: [PATCH] Bug 28220: UI changes Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- Koha/Patrons/Import.pm | 6 ++--- .../prog/en/modules/tools/import_borrowers.tt | 27 +++++++++++++++++++ t/db_dependent/Koha/Patrons/Import.t | 6 ++--- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm index 14a47ae879..e6c59eab48 100644 --- a/Koha/Patrons/Import.pm +++ b/Koha/Patrons/Import.pm @@ -343,11 +343,11 @@ sub import_patrons { my $patron_id = defined $matchpoint ? $borrower{$matchpoint} : $matchpoint_attr_type; if ( $_->isa('Koha::Exceptions::Patron::Attribute::UniqueIDConstraint') ) { - push @errors, { patron_attribute_unique_id_constraint => 1, patron_id => $patron_id, attribute => $_->attribute }; + push @errors, { patron_attribute_unique_id_constraint => 1, borrowernumber => $borrowernumber, attribute => $_->attribute }; } elsif ( $_->isa('Koha::Exceptions::Patron::Attribute::InvalidType') ) { - push @errors, { patron_attribute_invalid_type => 1, patron_id => $patron_id, attribute_type_code => $_->type }; + push @errors, { patron_attribute_invalid_type => 1, borrowernumber => $borrowernumber, attribute_type_code => $_->type }; } elsif ( $_->isa('Koha::Exceptions::Patron::Attribute::NonRepeatable') ) { - push @errors, { patron_attribute_non_repeatable => 1, patron_id => $patron_id, attribute => $_->attribute }; + push @errors, { patron_attribute_non_repeatable => 1, borrowernumber => $borrowernumber, attribute => $_->attribute }; } else { use Data::Printer colored => 1; warn p $_; push @errors, { unknown_error => 1 }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt index d4445c1afa..4237c8fcc9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt @@ -169,6 +169,33 @@ Password error for patron with borrowernumber [% e.borrowernumber | html %]. [% END %] + [% IF e.patron_attribute_unique_id_constraint %] +
  • + [% IF e.borrowernumber %] + Patron attribute [% e.attribute.code | html %] must be unique for patron with borrowernumber [% e.borrowernumber | html %]. + [% ELSE %] + Patron attribute [% e.attribute.code | html %] must be unique for patron [% e.patron_id | html %]. + [% END %] +
  • + [% END %] + [% IF e.patron_attribute_invalid_type %] +
  • + [% IF e.borrowernumber %] + Patron attribute [% e.attribute_type_code | html %] is invalid for patron with borrowernumber [% e.borrowernumber | html %]. + [% ELSE %] + Patron attribute [% e.attribute_type_code | html %] is invalid for patron [% e.patron_id | html %]. + [% END %] +
  • + [% END %] + [% IF e.patron_attribute_non_repeatable %] +
  • + [% IF e.borrowernumber %] + Patron attribute [% e.attribute.code | html %] is non-repeatable for patron with borrowernumber [% e.borrowernumber | html %]. + [% ELSE %] + Patron attribute [% e.attribute.code | html %] is non-repeatable for patron [% e.patron_id | html %]. + [% END %] +
  • + [% END %] [% END %] diff --git a/t/db_dependent/Koha/Patrons/Import.t b/t/db_dependent/Koha/Patrons/Import.t index b3ba72ee9d..4cdcb3b741 100755 --- a/t/db_dependent/Koha/Patrons/Import.t +++ b/t/db_dependent/Koha/Patrons/Import.t @@ -1042,7 +1042,7 @@ subtest 'patron_attributes' => sub { is( $result->{overwritten}, 0 ); my $error = $result->{errors}->[0]; is( $error->{patron_attribute_unique_id_constraint}, 1 ); - is( $error->{patron_id}, $cardnumber ); + is( $error->{borrowernumber}, $patron->borrowernumber ); is( $error->{attribute}->code, $unique_attribute_type->code ); compare_patron_attributes($patron->extended_attributes->unblessed, {}, ); @@ -1067,7 +1067,7 @@ subtest 'patron_attributes' => sub { $error = $result->{errors}->[0]; is( $error->{patron_attribute_invalid_type}, 1 ); - is( $error->{patron_id}, $cardnumber ); + is( $error->{borrowernumber}, $patron->borrowernumber ); is( $error->{attribute_type_code}, $non_existent_attribute_type_code ); # NonRepeatable @@ -1088,7 +1088,7 @@ subtest 'patron_attributes' => sub { $error = $result->{errors}->[0]; is( $error->{patron_attribute_non_repeatable}, 1 ); - is( $error->{patron_id}, $cardnumber ); + is( $error->{borrowernumber}, $patron->borrowernumber ); is( $error->{attribute}->code, $normal_attribute_type->code ); # Don't preserve existing attributes -- 2.39.5