@@ -, +, @@ attributes & picture to template. Refactor to use new information. --- .../prog/en/modules/members/housebound.tt | 11 +---------- members/housebound.pl | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 13 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt +++ a/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 %] --- a/members/housebound.pl +++ a/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, --