From 630585f9645468029e2849ddf65852c10412272a Mon Sep 17 00:00:00 2001
From: Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
Date: Thu, 10 Aug 2017 13:33:36 +0200
Subject: [PATCH] Bug 19074: Fix category display in Batch patron modification.

* tools/modborrowers.pl (GetBorrowerInfos): Fix setting of patron
  category description.
* koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt: Use
  it.
---
 koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt | 2 +-
 tools/modborrowers.pl                                         | 3 ++-
 2 files changed, 3 insertions(+), 2 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 0ff04f5b27..74705639a5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt
@@ -282,7 +282,7 @@
                                                     <td>[% borrower.surname %]</td>
                                                     <td>[% borrower.firstname %]</td>
                                                     <td>[% Branches.GetName( borrower.branchcode ) %]</td>
-                                                    <td>[% borrower.categorycode %]</td>
+                                                    <td>[% borrower.category_description %]</td>
                                                     <td>[% borrower.city %]</td>
                                                     <td>[% borrower.state %]</td>
                                                     <td>[% borrower.zipcode %]</td>
diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl
index 720e2a107e..7acc9a8a33 100755
--- a/tools/modborrowers.pl
+++ b/tools/modborrowers.pl
@@ -367,6 +367,7 @@ exit;
 sub GetBorrowerInfos {
     my ( %info ) = @_;
     my $borrower = Koha::Patrons->find( \%info );
+    my $catdesc = $borrower->category->description;
     if ( $borrower ) {
         $borrower = $borrower->unblessed;
         for ( qw(dateenrolled dateexpiry) ) {
@@ -377,7 +378,7 @@ sub GetBorrowerInfos {
             }
             $borrower->{$_} = $userdate || '';
         }
-        $borrower->{category_description} = Koha::Patron::Categories->find( $borrower->{categorycode} )->{description};
+        $borrower->{category_description} = $catdesc;
         my $attr_loop = C4::Members::Attributes::GetBorrowerAttributes( $borrower->{borrowernumber} );
         $borrower->{patron_attributes} = $attr_loop;
     }
-- 
2.13.4