Guaranteed by
[% FOREACH gr IN patron.guarantor_relationships %]
@@ -1019,20 +1038,39 @@
}
});
- [% IF patron.guarantor_relationships && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
- $('#update_privacy_guarantor_checkouts').click( function() {
- $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_guarantor_checkouts: $('#privacy_guarantor_checkouts').val() }, null, 'json')
- .done(function( data ) {
- var message;
- if ( data.success ) {
- message = _("Your setting has been updated!");
- } else {
- message = _("Unable to update your setting!");
- }
-
- $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
- });
- });
+ [% IF patron.guarantor_relationships && !Koha.Preference('OPACPrivacy') %]
+
+ [% IF Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
+ $('#update_privacy_guarantor_checkouts').click( function() {
+ $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_guarantor_checkouts: $('#privacy_guarantor_checkouts').val() }, null, 'json')
+ .done(function( data ) {
+ var message;
+ if ( data.success ) {
+ message = _("Your setting has been updated!");
+ } else {
+ message = _("Unable to update your setting!");
+ }
+
+ $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
+ });
+ });
+ [% END %]
+
+ [% IF Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') %]
+ $('#update_privacy_guarantor_fines').click( function() {
+ $.post( "/cgi-bin/koha/svc/patron/show_fines_to_relatives", { privacy_guarantor_fines: $('#privacy_guarantor_fines').val() }, null, 'json')
+ .done(function( data ) {
+ var message;
+ if ( data.success ) {
+ message = _("Your setting has been updated!");
+ } else {
+ message = _("Unable to update your setting!");
+ }
+
+ $('#update_privacy_guarantor_fines_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
+ });
+ });
+ [% END %]
[% END %]
$(".patron-attributes").on( 'click', '.clear-attribute', function() {
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt
@@ -71,18 +71,32 @@
- [% IF borrower.guarantor_relationships && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
+ [% IF borrower.guarantor_relationships && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') || Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') %]
-
-
+ [% IF Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
+
+
+ [% END %]
+ [% IF Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') %]
+
+
+ [% END %]
Guaranteed by
[% FOREACH gr IN borrower.guarantor_relationships %]
--- a/opac/opac-memberentry.pl
+++ a/opac/opac-memberentry.pl
@@ -333,7 +333,7 @@ my $captcha = random_string("CCCCC");
$template->param(
captcha => $captcha,
captcha_digest => md5_base64($captcha),
- patron => Koha::Patrons->find( $borrowernumber ),
+ patron => scalar Koha::Patrons->find( $borrowernumber ),
);
output_html_with_http_headers $cgi, $cookie, $template->output, undef, { force_no_caching => 1 };
--- a/opac/opac-privacy.pl
+++ a/opac/opac-privacy.pl
@@ -47,6 +47,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
my $op = $query->param("op");
my $privacy = $query->param("privacy");
my $privacy_guarantor_checkouts = $query->param("privacy_guarantor_checkouts");
+my $privacy_guarantor_fines = $query->param("privacy_guarantor_fines");
if ( $op eq "update_privacy" ) {
my $patron = Koha::Patrons->find( $borrowernumber );
@@ -54,6 +55,7 @@ if ( $op eq "update_privacy" ) {
$patron->set({
privacy => $privacy,
privacy_guarantor_checkouts => $privacy_guarantor_checkouts,
+ privacy_guarantor_fines => $privacy_guarantor_fines,
})->store;
$template->param( 'privacy_updated' => 1 );
}
--- a/opac/svc/patron/show_fines_to_relatives
+++ a/opac/svc/patron/show_fines_to_relatives
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+
+# Copyright 2014 ByWater Solutions
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 3 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use Modern::Perl;
+
+use CGI;
+use JSON qw( to_json );
+
+use C4::Auth;
+use C4::Context;
+
+use Koha::Patrons;
+
+my $cgi = CGI->new();
+
+my $privacy_guarantor_fines = $cgi->param('privacy_guarantor_fines');
+
+my ( $userid, $cookie, $sessionID, $flags ) = checkauth( $cgi, 1, {}, 'opac' );
+
+my $borrowernumber = C4::Context->userenv ? C4::Context->userenv->{number} : undef;
+
+my $success = 0;
+if ( $borrowernumber && defined($privacy_guarantor_fines) ) {
+ my $patron = Koha::Patrons->find($borrowernumber);
+
+ if ( $patron ) {
+ $patron->privacy_guarantor_fines($privacy_guarantor_fines);
+ $success = $patron->store();
+ }
+}
+
+binmode STDOUT, ":encoding(UTF-8)";
+print $cgi->header(
+ -type => 'application/json',
+ -charset => 'UTF-8'
+);
+
+print to_json(
+ {
+ success => $success ? 1 : 0,
+ privacy_guarantor_fines => $privacy_guarantor_fines,
+ }
+);
--