Bug 5670: [QA Followup] Fix `div.patroninfo`.
authorAlex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
Wed, 21 Sep 2016 15:17:25 +0000 (17:17 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 21 Oct 2016 18:18:01 +0000 (18:18 +0000)
* members/housebound.pl: Provide full patron hash keys, extended patron
  attributes & picture to template.
* koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt:
  Refactor to use new information.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt
members/housebound.pl

index f0a60f9..01e2872 100644 (file)
@@ -1,15 +1,6 @@
 [% USE Koha %]
 [% USE KohaDates %]
 [% USE AuthorisedValues %]
-[% borrowernumber = patron.borrowernumber %]
-[% branchname = branch.branchname %]
-[% categoryname = category.description %]
-[% categorycode = category.categorycode %]
-[% category_type = category.category_type %]
-[% firstname = patron.firstname %]
-[% surname = patron.surname %]
-[% othernames = patron.othernames %]
-[% invert_name = 0 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Housebound &rsaquo; Details for [% INCLUDE 'patron-title.inc' %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -37,7 +28,7 @@
         <div class="yui-g">
 
           <!-- Title -->
-          <h3>Housebound details for [% patron.title %] [% patron.firstname %] [% patron.surname %] ([% patron.cardnumber %])</h3>
+          <h3>Housebound details for [% INCLUDE 'patron-title.inc' %]</h3>
           <div class="first">
 
             [% FOR m IN messages %]
index fe26d82..77974e4 100755 (executable)
@@ -27,6 +27,8 @@
 use Modern::Perl;
 use CGI;
 use C4::Auth;
+use C4::Context;
+use C4::Members::Attributes qw(GetBorrowerAttributes);
 use C4::Output;
 use DateTime;
 use Koha::DateUtils;
@@ -56,14 +58,15 @@ my $visit_id = $input->param('visit_id') // q{};
 # Get patron
 my $patron = eval {
     my $borrowernumber = $input->param('borrowernumber') // q{};
-    return Koha::Patrons->new->find($borrowernumber);
+    return Koha::Patrons->find($borrowernumber);
 };
 push @messages, { type => 'error', code => 'error_on_patron_load' }
     if ( $@ or !$patron );
 
 # Get supporting cast
-my ( $branch, $category, $houseboundprofile, $visit );
+my ( $branch, $category, $houseboundprofile, $visit, $patron_image );
 if ( $patron ) {
+    $patron_image = Koha::Patron::Images->find($patron->borrowernumber);
     $branch = Koha::Libraries->new->find($patron->branchcode);
     $category = Koha::Patron::Categories->new->find($patron->categorycode);
     $houseboundprofile = $patron->housebound_profile;
@@ -156,8 +159,20 @@ if ( $method eq 'updateconfirm' and $houseboundprofile ) {
 # We don't have any profile information, so we must display a creation form.
 $method = 'update_or_create' if ( !$houseboundprofile );
 
+# Ensure template has all patron details.
+$template->param(%{$patron->unblessed}) if ( $patron );
+
+# Load extended patron attributes if necessary (taken from members/files.pl).
+if ( C4::Context->preference('ExtendedPatronAttributes') and $patron ) {
+    my $attributes = GetBorrowerAttributes($patron->borrowernumber);
+    $template->param(
+        ExtendedPatronAttributes => 1,
+        extendedattributes => $attributes
+    );
+}
+
 $template->param(
-    patron             => $patron,
+    picture            => $patron_image,
     housebound_profile => $houseboundprofile,
     visit              => $houseboundvisit,
     branch             => $branch,