From 01873ebd51a1b7920760a03a5fbe05b0808c5511 Mon Sep 17 00:00:00 2001 From: Alex Sassmannshausen Date: Wed, 21 Sep 2016 17:17:25 +0200 Subject: [PATCH] Bug 5670: [QA Followup] Fix `div.patroninfo`. * 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 Signed-off-by: Kyle M Hall --- .../prog/en/modules/members/housebound.tt | 11 +--------- members/housebound.pl | 21 ++++++++++++++++--- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt index f0a60f9a32..01e2872d9d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt @@ -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' %] Koha › Housebound › Details for [% INCLUDE 'patron-title.inc' %] [% INCLUDE 'doc-head-close.inc' %] @@ -37,7 +28,7 @@
-

Housebound details for [% patron.title %] [% patron.firstname %] [% patron.surname %] ([% patron.cardnumber %])

+

Housebound details for [% INCLUDE 'patron-title.inc' %]

[% FOR m IN messages %] diff --git a/members/housebound.pl b/members/housebound.pl index fe26d821b2..77974e4628 100755 --- a/members/housebound.pl +++ b/members/housebound.pl @@ -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, -- 2.39.5