From 228473c035dbe5dee087b946eec9c79d6aa0d8fb Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 11 May 2015 07:31:27 -0400 Subject: [PATCH] Bug 9303 [QA Followup] - Restore ability for patron to control setting Signed-off-by: Nick Clemens --- Koha/Borrower.pm | 12 ++++++++++++ .../opac-tmpl/bootstrap/en/modules/opac-memberentry.tt | 3 +-- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt | 5 ++--- opac/opac-memberentry.pl | 5 ++++- opac/opac-privacy.pl | 15 ++++++++------- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/Koha/Borrower.pm b/Koha/Borrower.pm index 93426bf..6604b8a 100644 --- a/Koha/Borrower.pm +++ b/Koha/Borrower.pm @@ -35,6 +35,18 @@ Koha::Borrower - Koha Borrower Object class =cut +=head3 guarantor + +Returns a Koha::Borrower object for this borrower's guarantor + +=cut + +sub guarantor { + my ( $self ) = @_; + + return Koha::Borrowers->find( $self->guarantorid() ); +} + =head3 type =cut diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt index 1beb853..3a474ac 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -73,8 +73,7 @@ - [% SET g = Koha.Find('Borrower',borrower.guarantorid) %] - Your guarantor is [% g.firstname %] [% g.surname %] + Your guarantor is [% guarantor.firstname %] [% guarantor.surname %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt index 6fc0c31..c7465c3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt @@ -68,8 +68,7 @@ - [% SET b = Koha.Find('Borrower', borrower.borrowernumber) %] - [% IF b.guarantorid && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %] + [% IF borrower.guarantorid && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
- Your guarantor is [% b.guarantor.firstname %] [% b.guarantor.surname %] + Your guarantor is [% borrower.guarantor.firstname %] [% borrower.guarantor.surname %]
[% END %] diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 5a075ba..94ff114 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -24,6 +24,7 @@ use String::Random qw( random_string ); use C4::Auth; use C4::Output; use C4::Members; +use Koha::Borrowers; use Koha::Borrower::Modifications; use C4::Branch qw(GetBranchesLoop); use C4::Scrubber; @@ -209,7 +210,9 @@ elsif ( $action eq 'edit' ) { #Display logged in borrower's data } $template->param( - borrower => $borrower, ); + borrower => $borrower, + guarantor => Koha::Borrowers->find($borrowernumber)->guarantor(), + ); if (C4::Context->preference('OPACpatronimages')) { my ($image, $dberror) = GetPatronImage($borrower->{borrowernumber}); diff --git a/opac/opac-privacy.pl b/opac/opac-privacy.pl index b697011..b03daac 100755 --- a/opac/opac-privacy.pl +++ b/opac/opac-privacy.pl @@ -25,6 +25,7 @@ use C4::Circulation; use C4::Members; use C4::Output; use C4::Dates; +use Koha::Borrowers; my $query = new CGI; @@ -76,15 +77,15 @@ elsif ( $op eq "delete_record" ) { } # get borrower privacy .... -my $borrower = GetMemberDetails( $borrowernumber ); +my $borrower = Koha::Borrowers->find( $borrowernumber );; $template->param( - 'Ask_data' => 1, - 'privacy' . $borrower->{'privacy'} => 1, - 'privacyview' => 1, - 'borrower' => $borrower, - 'surname' => $borrower->{surname}, - 'firstname' => $borrower->{firstname}, + 'Ask_data' => 1, + 'privacy' . $borrower->privacy() => 1, + 'privacyview' => 1, + 'borrower' => $borrower, + 'surname' => $borrower->{surname}, + 'firstname' => $borrower->{firstname}, ); output_html_with_http_headers $query, $cookie, $template->output; -- 1.9.1