@@ -, +, @@
---
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(-)
--- a/Koha/Patrons/Import.pm
+++ a/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 };
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt
+++ a/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 %]
--- a/t/db_dependent/Koha/Patrons/Import.t
+++ a/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
--