From f9503c2290aeb018bc294e74687d18605822a9ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Sun, 26 Apr 2015 21:36:25 +0200 Subject: [PATCH] Bug 11929: patron modification error shows borrowernumber If an error occurs in patron batch modification, a message similar to the following is displayed: Can not update patron with borrowernumber 7055 It would be useful to have the cardnumber as well. This patch adds the card number to the lists of errors. It is not easy to trigger an error (see comments). For testing, I tweaked the sub ModMember in C4/Members.pm to always return false. TEST PLAN --------- 1) Log in as a superlibrarian and create a test user 2) Change the cardnumber to a number differing from the borrower number. 3) Home -> Tools -> Batch patron modification 4) Type in the cardnumber of that test user 5) Check the Library checkbox. 6) Click Save -- nice error, but it is borrower number instead of the card number which was entered. 7) Apply the patch 8) Repeat steps 3-6 -- nice error, but it is now more informative. 9) run koha qa test tools. Signed-off-by: Mark Tompsett Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 3b3f82de377c87f9108bf07dd0d293182e5b9bdc) Signed-off-by: Chris Cormack Signed-off-by: Liz Rea --- .../intranet-tmpl/prog/en/modules/tools/modborrowers.tt | 7 +++++-- tools/modborrowers.pl | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt index c0a5baad00..aada2fc8b5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt @@ -201,7 +201,10 @@
    [% FOREACH error IN errors %] [% IF ( error.error == 'can_not_update' ) %] -
  • Can not update patron with borrowernumber [% error.borrowernumber %]
  • +
  • Can not update patron. + [% IF ( error.cardnumber ) %] Cardnumber: [% error.cardnumber %] [% END %] + (Borrowernumber: [% error.borrowernumber %]) +
  • [% ELSE %]
  • [% error.error %]
  • [% END %] @@ -362,4 +365,4 @@ [% INCLUDE 'tools-menu.inc' %] -[% INCLUDE 'intranet-bottom.inc' %] \ No newline at end of file +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl index 5bd21033a4..fa86ce8f79 100755 --- a/tools/modborrowers.pl +++ b/tools/modborrowers.pl @@ -247,7 +247,11 @@ if ( $op eq 'do' ) { if ( defined $infos ) { $infos->{borrowernumber} = $borrowernumber; my $success = ModMember(%$infos); - push @errors, { error => "can_not_update", borrowernumber => $infos->{borrowernumber} } if not $success; + if (!$success) { + my $borrowerinfo = GetBorrowerInfos( borrowernumber => $borrowernumber ); + $infos->{cardnumber} = $borrowerinfo->{cardnumber} || ''; + push @errors, { error => "can_not_update", borrowernumber => $infos->{borrowernumber}, cardnumber => $infos->{cardnumber} }; + } } # -- 2.39.5