View | Details | Raw Unified | Return to bug 28220
Collapse All | Expand All

(-)a/Koha/Patrons/Import.pm (-3 / +3 lines)
Lines 343-353 sub import_patrons { Link Here
343
343
344
                my $patron_id = defined $matchpoint ? $borrower{$matchpoint} : $matchpoint_attr_type;
344
                my $patron_id = defined $matchpoint ? $borrower{$matchpoint} : $matchpoint_attr_type;
345
                if ( $_->isa('Koha::Exceptions::Patron::Attribute::UniqueIDConstraint') ) {
345
                if ( $_->isa('Koha::Exceptions::Patron::Attribute::UniqueIDConstraint') ) {
346
                    push @errors, { patron_attribute_unique_id_constraint => 1, patron_id => $patron_id, attribute => $_->attribute };
346
                    push @errors, { patron_attribute_unique_id_constraint => 1, borrowernumber => $borrowernumber, attribute => $_->attribute };
347
                } elsif ( $_->isa('Koha::Exceptions::Patron::Attribute::InvalidType') ) {
347
                } elsif ( $_->isa('Koha::Exceptions::Patron::Attribute::InvalidType') ) {
348
                    push @errors, { patron_attribute_invalid_type => 1, patron_id => $patron_id, attribute_type_code => $_->type };
348
                    push @errors, { patron_attribute_invalid_type => 1, borrowernumber => $borrowernumber, attribute_type_code => $_->type };
349
                } elsif ( $_->isa('Koha::Exceptions::Patron::Attribute::NonRepeatable') ) {
349
                } elsif ( $_->isa('Koha::Exceptions::Patron::Attribute::NonRepeatable') ) {
350
                    push @errors, { patron_attribute_non_repeatable => 1, patron_id => $patron_id, attribute => $_->attribute };
350
                    push @errors, { patron_attribute_non_repeatable => 1, borrowernumber => $borrowernumber, attribute => $_->attribute };
351
                } else {
351
                } else {
352
                    use Data::Printer colored => 1; warn p $_;
352
                    use Data::Printer colored => 1; warn p $_;
353
                    push @errors, { unknown_error => 1 };
353
                    push @errors, { unknown_error => 1 };
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt (+27 lines)
Lines 169-174 Link Here
169
                            Password error for patron with borrowernumber [% e.borrowernumber | html %].
169
                            Password error for patron with borrowernumber [% e.borrowernumber | html %].
170
                        </li>
170
                        </li>
171
                    [% END %]
171
                    [% END %]
172
                    [% IF e.patron_attribute_unique_id_constraint %]
173
                        <li class="line_error">
174
                            [% IF e.borrowernumber %]
175
                                Patron attribute [% e.attribute.code | html %] must be unique for patron with borrowernumber [% e.borrowernumber | html %].
176
                            [% ELSE %]
177
                                Patron attribute [% e.attribute.code | html %] must be unique for patron [% e.patron_id | html %].
178
                            [% END %]
179
                        </li>
180
                    [% END %]
181
                    [% IF e.patron_attribute_invalid_type %]
182
                        <li class="line_error">
183
                            [% IF e.borrowernumber %]
184
                                Patron attribute [% e.attribute_type_code | html %] is invalid for patron with borrowernumber [% e.borrowernumber | html %].
185
                            [% ELSE %]
186
                                Patron attribute [% e.attribute_type_code | html %] is invalid for patron [% e.patron_id | html %].
187
                            [% END %]
188
                        </li>
189
                    [% END %]
190
                    [% IF e.patron_attribute_non_repeatable %]
191
                        <li class="line_error">
192
                            [% IF e.borrowernumber %]
193
                                Patron attribute [% e.attribute.code | html %] is non-repeatable for patron with borrowernumber [% e.borrowernumber | html %].
194
                            [% ELSE %]
195
                                Patron attribute [% e.attribute.code | html %] is non-repeatable for patron [% e.patron_id | html %].
196
                            [% END %]
197
                        </li>
198
                    [% END %]
172
                [% END %]
199
                [% END %]
173
            </ul>
200
            </ul>
174
        </div>
201
        </div>
(-)a/t/db_dependent/Koha/Patrons/Import.t (-4 / +3 lines)
Lines 1042-1048 subtest 'patron_attributes' => sub { Link Here
1042
        is( $result->{overwritten}, 0 );
1042
        is( $result->{overwritten}, 0 );
1043
        my $error = $result->{errors}->[0];
1043
        my $error = $result->{errors}->[0];
1044
        is( $error->{patron_attribute_unique_id_constraint}, 1 );
1044
        is( $error->{patron_attribute_unique_id_constraint}, 1 );
1045
        is( $error->{patron_id}, $cardnumber );
1045
        is( $error->{borrowernumber}, $patron->borrowernumber );
1046
        is( $error->{attribute}->code, $unique_attribute_type->code );
1046
        is( $error->{attribute}->code, $unique_attribute_type->code );
1047
1047
1048
        compare_patron_attributes($patron->extended_attributes->unblessed, {},  );
1048
        compare_patron_attributes($patron->extended_attributes->unblessed, {},  );
Lines 1067-1073 subtest 'patron_attributes' => sub { Link Here
1067
1067
1068
        $error = $result->{errors}->[0];
1068
        $error = $result->{errors}->[0];
1069
        is( $error->{patron_attribute_invalid_type}, 1 );
1069
        is( $error->{patron_attribute_invalid_type}, 1 );
1070
        is( $error->{patron_id}, $cardnumber );
1070
        is( $error->{borrowernumber}, $patron->borrowernumber );
1071
        is( $error->{attribute_type_code}, $non_existent_attribute_type_code );
1071
        is( $error->{attribute_type_code}, $non_existent_attribute_type_code );
1072
1072
1073
        # NonRepeatable
1073
        # NonRepeatable
Lines 1088-1094 subtest 'patron_attributes' => sub { Link Here
1088
1088
1089
        $error = $result->{errors}->[0];
1089
        $error = $result->{errors}->[0];
1090
        is( $error->{patron_attribute_non_repeatable}, 1 );
1090
        is( $error->{patron_attribute_non_repeatable}, 1 );
1091
        is( $error->{patron_id}, $cardnumber );
1091
        is( $error->{borrowernumber}, $patron->borrowernumber );
1092
        is( $error->{attribute}->code, $normal_attribute_type->code );
1092
        is( $error->{attribute}->code, $normal_attribute_type->code );
1093
1093
1094
        # Don't preserve existing attributes
1094
        # Don't preserve existing attributes
1095
- 

Return to bug 28220