From 49a0b63f62a6af00e48af57833399a31067e09c9 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 Signed-off-by: Kyle M Hall --- Koha/Borrower.pm | 12 ++++++++++++ .../bootstrap/en/modules/opac-memberentry.tt | 3 +-- .../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 93426bfde3..6604b8afcb 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 999fe496f9..3f3428d8f0 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 d1ed47cde0..db378ad46a 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 ddaf914110..667f2016e7 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; @@ -225,7 +226,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 51fc7cd0bf..221589270c 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 = C4::Members::GetMember( borrowernumber => $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 }; -- 2.39.5