From 6797259d446dafec4523aad6840c590ae641769a Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 19 Apr 2018 15:02:31 -0400 Subject: [PATCH] Bug 9302: Add error messages, correct number of unit tests in subtest 'Test Koha::Patrons::merge' Signed-off-by: Jonathan Druart --- .../prog/en/modules/members/merge-patrons.tt | 75 ++++++++++--------- t/db_dependent/Koha/Patrons.t | 2 +- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt index f016436479..a8cd953978 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt @@ -50,49 +50,54 @@

Merge patron records

[% IF action == 'show' %] -

Select patron to keep. Data from the other patrons will be transferred to this patron record and the remaining patron records will be deleted.

-
- - - - - - - - - - - - - - - [% FOREACH p IN patrons %] + [% IF patrons.count > 1 %] +

Select patron to keep. Data from the other patrons will be transferred to this patron record and the remaining patron records will be deleted.

+ +
 CardNameDate of birthCategoryLibraryExpires on
+ - - - - - - - - [% END %] - -
[% p.cardnumber | html %][% INCLUDE 'patron-title.inc' patron = p %][% p.dateofbirth | $KohaDates %][% Categories.GetName( p.categorycode ) %] ([% p.categorycode %])[% Branches.GetName( p.branchcode ) %][% p.dateexpiry | $KohaDates %]
- - [% FOREACH p IN patrons %] - - [% END %] +   + Card + Name + Date of birth + Category + Library + Expires on + + + + + [% FOREACH p IN patrons %] + + + [% p.cardnumber | html %] + [% INCLUDE 'patron-title.inc' patron = p %] + [% p.dateofbirth | $KohaDates %] + [% Categories.GetName( p.categorycode ) %] ([% p.categorycode %]) + [% Branches.GetName( p.branchcode ) %] + [% p.dateexpiry | $KohaDates %] + [% END %] + + + + [% FOREACH p IN patrons %] + + [% END %] -

+

- - + + + [% ELSE %] +

Error: Two or more patrons need to be selected for merging
+ [% END %]
[% ELSIF action == 'merge' %]

Results

- [% IF error %]
Merge failed! The following error was reported: [% error %].
+ [% ELSIF !results.merged.keys.size %] +
No valid patrons to merge were found.
[% ELSE %]

Patron records merged into [% INCLUDE 'patron-title.inc' patron = keeper %] diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t index 8eb80e6f7e..04352c9de3 100644 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -1337,7 +1337,7 @@ subtest 'Log cardnumber change' => sub { $schema->storage->txn_rollback; subtest 'Test Koha::Patrons::merge' => sub { - plan tests => 98; + plan tests => 110; my $schema = Koha::Database->new()->schema(); -- 2.39.5