From d81f7776cac7d9bfdd02b681b05dd3b83a16ffbf 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 ++++++++++++ .../bootstrap/en/modules/opac-memberentry.tt | 3 +-- .../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 88fe922..2e635d5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -89,8 +89,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 d1ed47c..db378ad 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt @@ -69,8 +69,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 9a18afa..8b9e59e 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -25,6 +25,7 @@ use C4::Auth; use C4::Output; use C4::Members; use C4::Form::MessagingPreferences; +use Koha::Borrowers; use Koha::Borrower::Modifications; use C4::Branch qw(GetBranchesLoop); use C4::Scrubber; @@ -224,7 +225,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 75d902d..fe7e179 100755 --- a/opac/opac-privacy.pl +++ b/opac/opac-privacy.pl @@ -24,6 +24,7 @@ use C4::Context; use C4::Circulation; use C4::Members; use C4::Output; +use Koha::Borrowers; my $query = new CGI; @@ -74,15 +75,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, undef, { force_no_caching => 1 }; -- 1.7.2.5