Bugzilla – Attachment 74970 Details for
Bug 20691
Add ability for guarantors to view guarantee's fines in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20691: Add ability to turn feature on and off
Bug-20691-Add-ability-to-turn-feature-on-and-off.patch (text/plain), 20.13 KB, created by
Kyle M Hall (khall)
on 2018-05-02 13:13:51 UTC
(
hide
)
Description:
Bug 20691: Add ability to turn feature on and off
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-05-02 13:13:51 UTC
Size:
20.13 KB
patch
obsolete
>From d15a8a9fec389e55792577461c007b4dec6e5cb5 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 1 May 2018 17:39:26 +0000 >Subject: [PATCH] Bug 20691: Add ability to turn feature on and off > >--- > C4/Members.pm | 1 + > api/v1/swagger/definitions/patron.json | 4 ++ > .../prog/en/modules/admin/preferences/opac.pref | 7 +++ > .../prog/en/modules/admin/preferences/patrons.pref | 6 ++ > .../prog/en/modules/members/memberentrygen.tt | 16 +++++ > .../prog/en/modules/members/moremember.tt | 9 +++ > .../bootstrap/en/modules/opac-memberentry.tt | 73 +++++++++++++++++----- > .../opac-tmpl/bootstrap/en/modules/opac-privacy.tt | 38 +++++++---- > opac/opac-memberentry.pl | 2 +- > opac/opac-privacy.pl | 10 +-- > opac/svc/patron/show_fines_to_relatives | 59 +++++++++++++++++ > 11 files changed, 194 insertions(+), 31 deletions(-) > create mode 100755 opac/svc/patron/show_fines_to_relatives > >diff --git a/C4/Members.pm b/C4/Members.pm >index 4817e2b5fa..c5a51e5e20 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -438,6 +438,7 @@ sub AddMember { > : undef; > > $data{'privacy_guarantor_checkouts'} = 0 unless defined( $data{'privacy_guarantor_checkouts'} ); >+ $data{'privacy_guarantor_fines'} = 0 unless defined( $data{'privacy_guarantor_fines'} ); > > # Make a copy of the plain text password for later use > my $plain_text_password = $data{'password'}; >diff --git a/api/v1/swagger/definitions/patron.json b/api/v1/swagger/definitions/patron.json >index 549b470f0b..73905f2535 100644 >--- a/api/v1/swagger/definitions/patron.json >+++ b/api/v1/swagger/definitions/patron.json >@@ -243,6 +243,10 @@ > "type": "integer", > "description": "controls if relatives can see this patron's checkouts" > }, >+ "privacy_guarantor_fines": { >+ "type": "integer", >+ "description": "controls if relatives can see this patron's fines" >+ }, > "check_previous_checkout": { > "type": "string", > "description": "produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'" >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index f46dda3948..5df04d2f3b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -655,6 +655,13 @@ OPAC: > yes: Allow > no: "Don't allow" > - patrons to choose their own privacy settings for showing the patron's checkouts to the patron's guarantor". >+ - >+ - pref: AllowPatronToSetFinesVisibilityForGuarantor >+ default: 0 >+ choices: >+ yes: Allow >+ no: "Don't allow" >+ - patrons to choose their own privacy settings for showing the patron's fines to the patron's guarantor". > - > - Use borrowernumber > - pref: AnonymousPatron >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 348e1dd9ed..7fd06addd0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -164,6 +164,12 @@ Patrons: > yes: Allow > no: "Don't allow" > - staff to set the ability for a patron's checkouts to be viewed by linked patrons in the OPAC. >+ - >+ - pref: AllowStaffToSetFinesVisibilityForGuarantor >+ choices: >+ yes: Allow >+ no: "Don't allow" >+ - staff to set the ability for a patron's fines to be viewed by linked patrons in the OPAC. > - > - Card numbers for patrons must be > - pref: CardnumberLength >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 50b4d8ecbb..c99382658b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -448,6 +448,22 @@ > <div class="hint">Allow guarantors of this patron to view this patron's checkouts from the OPAC</div> > </li> > [% END %] >+ >+ [% IF relationships && Koha.Preference('AllowStaffToSetFinesVisibilityForGuarantor') %] >+ <li> >+ <label for="privacy_guarantor_fines">Show fines to guarantors</label> >+ <select name="privacy_guarantor_fines" id="privacy_guarantor_fines"> >+ [% IF privacy_guarantor_fines %] >+ <option value="0">No</option> >+ <option value="1" selected>Yes</option> >+ [% ELSE %] >+ <option value="0" selected>No</option> >+ <option value="1">Yes</option> >+ [% END %] >+ </select> >+ <div class="hint">Allow guarantors of this patron to view this patron's fines from the OPAC</div> >+ </li> >+ [% END %] > </ol> > </fieldset> > </fieldset> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 667f3048ae..0f7fb14373 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -323,6 +323,15 @@ > [% END %] > </li> > >+ <li> >+ <span class="label">Show fines to guarantor</span> >+ [% IF privacy_guarantor_fines %] >+ Yes >+ [% ELSE %] >+ No >+ [% END %] >+ </li> >+ > [% IF ( patron.sort1 ) %]<li><span class="label">Sort field 1:</span>[% AuthorisedValues.GetByCode('Bsort1', patron.sort1) |html %]</li>[% END %] > [% IF ( patron.sort2 ) %]<li><span class="label">Sort field 2:</span>[% AuthorisedValues.GetByCode('Bsort2', patron.sort2) |html %]</li>[% END %] > <li><span class="label">Username: </span>[% patron.userid |html %]</li> >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 655cc41d56..8d52c0e104 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >@@ -99,7 +99,11 @@ > <div class="alert">You typed in the wrong characters in the box before submitting. Please try again.</div> > [% END %] > >- [% IF patron.guarantor_relationships && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %] >+ [% IF patron.guarantor_relationships >+ && !Koha.Preference('OPACPrivacy') >+ && ( Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') >+ || Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') ) >+ %] > <fieldset class="rows" id="memberentry_privacy"> > <legend id="privacy_legend">Privacy</legend> > <ol> >@@ -117,6 +121,25 @@ > <a id="update_privacy_guarantor_checkouts" href="#" class="btn">Update</a> > <span id="update_privacy_guarantor_checkouts_message" class="alert" style="display:none"></span> > </span> >+ </li> >+ >+ <li> >+ <label>Allow your guarantor to view your current fines?</label> >+ <select id="privacy_guarantor_fines"> >+ <option value="0">No</option> >+ [% IF borrower.privacy_guarantor_fines %] >+ <option value="1" selected="selected">Yes</option> >+ [% ELSE %] >+ <option value="1">Yes</option> >+ [% END %] >+ </select> >+ <span class="hint"> >+ <a id="update_privacy_guarantor_fines" href="#" class="btn">Update</a> >+ <span id="update_privacy_guarantor_fines_message" class="alert" style="display:none"></span> >+ </span> >+ </li> >+ >+ <li> > <span class="hint"> > Guaranteed by > [% FOREACH gr IN patron.guarantor_relationships %] >@@ -129,6 +152,7 @@ > </ol> > </fieldset> > [% END %] >+ > [% IF ( extended_unique_id_failed_code ) %] > <div class="alert" id="extended_unique_id_failed"><a href="#patron-attr-start-[% extended_unique_id_failed_code %]">[% extended_unique_id_failed_description _ ': ' %]</a> Value is already in use ([% extended_unique_id_failed_value %])</div> > [% END %] >@@ -1002,20 +1026,39 @@ > } > }); > >- [% IF borrower.guarantorid && !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() { >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 99314bd261..e12fb6a0ec 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt >@@ -71,18 +71,34 @@ > </select> > </div> > >- [% IF borrower.guarantor_relationships && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %] >+ [% IF borrower.guarantor_relationships && >+ Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') || Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') >+ %] > <div> >- <label for="privacy_guarantor_checkouts">Allow your guarantor to view your current checkouts?</label> >- <select name="privacy_guarantor_checkouts"> >- [% IF borrower.privacy_guarantor_checkouts %] >- <option value="0">No</option> >- <option value="1" selected>Yes</option> >- [% ELSE %] >- <option value="0" selected>No</option> >- <option value="1">Yes</option> >- [% END %] >- </select> >+ [% IF Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %] >+ <label for="privacy_guarantor_checkouts">Allow your guarantor to view your current checkouts?</label> >+ <select name="privacy_guarantor_checkouts"> >+ [% IF borrower.privacy_guarantor_checkouts %] >+ <option value="0">No</option> >+ <option value="1" selected>Yes</option> >+ [% ELSE %] >+ <option value="0" selected>No</option> >+ <option value="1">Yes</option> >+ [% END %] >+ </select> >+ [% END %] >+ [% IF Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') %] >+ <label for="privacy_guarantor_fines">Allow your guarantor to view your current fines?</label> >+ <select name="privacy_guarantor_fines"> >+ [% IF borrower.privacy_guarantor_fines %] >+ <option value="0">No</option> >+ <option value="1" selected>Yes</option> >+ [% ELSE %] >+ <option value="0" selected>No</option> >+ <option value="1">Yes</option> >+ [% END %] >+ </select> >+ [% END %] > <span class="hint"> > Guaranteed by > [% FOREACH gr IN borrower.guarantor_relationships %] >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index ab833c1cd7..600e30edc2 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -320,7 +320,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 }; >diff --git a/opac/opac-privacy.pl b/opac/opac-privacy.pl >index 8796a7a8dd..3a3fb0f414 100755 >--- a/opac/opac-privacy.pl >+++ b/opac/opac-privacy.pl >@@ -45,15 +45,17 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > } > ); > >-my $op = $query->param("op"); >-my $privacy = $query->param("privacy"); >+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" ) { > ModMember( >- borrowernumber => $borrowernumber, >- privacy => $privacy, >+ borrowernumber => $borrowernumber, >+ privacy => $privacy, > privacy_guarantor_checkouts => $privacy_guarantor_checkouts, >+ privacy_guarantor_fines => $privacy_guarantor_fines, > ); > $template->param( 'privacy_updated' => 1 ); > } >diff --git a/opac/svc/patron/show_fines_to_relatives b/opac/svc/patron/show_fines_to_relatives >new file mode 100755 >index 0000000000..223e5b9f3b >--- /dev/null >+++ b/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, >+ } >+); >-- >2.15.1 (Apple Git-101)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20691
:
74968
|
74969
|
74970
|
74971
|
74972
|
74973
|
74974
|
74975
|
89951
|
89952
|
89953
|
89990
|
89991
|
89992
|
89993
|
90093
|
90094
|
90095
|
90096
|
91025
|
91026
|
91159
|
91160
|
91161
|
91162
|
92385
|
92386
|
92387
|
92388
|
92485
|
92700
|
92701
|
92702
|
92703
|
92704
|
92705
|
92897