View | Details | Raw Unified | Return to bug 20691
Collapse All | Expand All

(-)a/Koha/Schema/Result/Borrower.pm (-2 / +10 lines)
Lines 402-407 __PACKAGE__->table("borrowers"); Link Here
402
  default_value: 1
402
  default_value: 1
403
  is_nullable: 0
403
  is_nullable: 0
404
404
405
=head2 privacy_guarantor_fines
406
407
  data_type: 'tinyint'
408
  default_value: 0
409
  is_nullable: 0
410
405
=head2 privacy_guarantor_checkouts
411
=head2 privacy_guarantor_checkouts
406
412
407
  data_type: 'tinyint'
413
  data_type: 'tinyint'
Lines 619-624 __PACKAGE__->add_columns( Link Here
619
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
625
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
620
  "privacy",
626
  "privacy",
621
  { data_type => "integer", default_value => 1, is_nullable => 0 },
627
  { data_type => "integer", default_value => 1, is_nullable => 0 },
628
  "privacy_guarantor_fines",
629
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
622
  "privacy_guarantor_checkouts",
630
  "privacy_guarantor_checkouts",
623
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
631
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
624
  "checkprevcheckout",
632
  "checkprevcheckout",
Lines 1552-1559 Composing rels: L</aqorder_users> -> ordernumber Link Here
1552
__PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber");
1560
__PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber");
1553
1561
1554
1562
1555
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-05-17 12:11:31
1563
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-05-22 04:33:29
1556
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rb0wEXHaSvYum10aZjbAOA
1564
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lbMdmIHlRt+zayG5+Rq4/w
1557
1565
1558
__PACKAGE__->add_columns(
1566
__PACKAGE__->add_columns(
1559
    '+anonymized' => { is_boolean => 1 },
1567
    '+anonymized' => { is_boolean => 1 },
(-)a/Koha/Schema/Result/Deletedborrower.pm (-2 / +10 lines)
Lines 399-404 __PACKAGE__->table("deletedborrowers"); Link Here
399
  default_value: 1
399
  default_value: 1
400
  is_nullable: 0
400
  is_nullable: 0
401
401
402
=head2 privacy_guarantor_fines
403
404
  data_type: 'tinyint'
405
  default_value: 0
406
  is_nullable: 0
407
402
=head2 privacy_guarantor_checkouts
408
=head2 privacy_guarantor_checkouts
403
409
404
  data_type: 'tinyint'
410
  data_type: 'tinyint'
Lines 604-609 __PACKAGE__->add_columns( Link Here
604
  { data_type => "integer", is_nullable => 1 },
610
  { data_type => "integer", is_nullable => 1 },
605
  "privacy",
611
  "privacy",
606
  { data_type => "integer", default_value => 1, is_nullable => 0 },
612
  { data_type => "integer", default_value => 1, is_nullable => 0 },
613
  "privacy_guarantor_fines",
614
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
607
  "privacy_guarantor_checkouts",
615
  "privacy_guarantor_checkouts",
608
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
616
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
609
  "checkprevcheckout",
617
  "checkprevcheckout",
Lines 642-649 __PACKAGE__->add_columns( Link Here
642
);
650
);
643
651
644
652
645
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-05-17 12:11:31
653
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-05-22 04:33:29
646
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:STNFbPgDGWmyrZUFj/n+MA
654
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zK1jC6Wawwj8B2ch9KFByw
647
655
648
656
649
# You can replace this text with custom code or comments, and it will be preserved on regeneration
657
# You can replace this text with custom code or comments, and it will be preserved on regeneration
(-)a/api/v1/swagger/definitions/patron.json (+4 lines)
Lines 243-248 Link Here
243
      "type": "integer",
243
      "type": "integer",
244
      "description": "controls if relatives can see this patron's checkouts"
244
      "description": "controls if relatives can see this patron's checkouts"
245
    },
245
    },
246
    "privacy_guarantor_fines": {
247
      "type": "integer",
248
      "description": "controls if relatives can see this patron's fines"
249
    },
246
    "check_previous_checkout": {
250
    "check_previous_checkout": {
247
      "type": "string",
251
      "type": "string",
248
      "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'"
252
      "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'"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+7 lines)
Lines 707-712 OPAC: Link Here
707
                  no: "Don't allow"
707
                  no: "Don't allow"
708
            - patrons to choose their own privacy settings for showing the patron's checkouts to the patron's guarantor".
708
            - patrons to choose their own privacy settings for showing the patron's checkouts to the patron's guarantor".
709
        -
709
        -
710
            - pref: AllowPatronToSetFinesVisibilityForGuarantor
711
              default: 0
712
              choices:
713
                  yes: Allow
714
                  no: "Don't allow"
715
            - patrons to choose their own privacy settings for showing the patron's fines to the patron's guarantor".
716
        -
710
            - Use borrowernumber
717
            - Use borrowernumber
711
            - pref: AnonymousPatron
718
            - pref: AnonymousPatron
712
              class: integer
719
              class: integer
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (+6 lines)
Lines 185-190 Patrons: Link Here
185
               no: "Don't allow"
185
               no: "Don't allow"
186
         - staff to set the ability for a patron's checkouts to be viewed by linked patrons in the OPAC.
186
         - staff to set the ability for a patron's checkouts to be viewed by linked patrons in the OPAC.
187
     -
187
     -
188
         - pref: AllowStaffToSetFinesVisibilityForGuarantor
189
           choices:
190
               yes: Allow
191
               no: "Don't allow"
192
         - staff to set the ability for a patron's fines to be viewed by linked patrons in the OPAC.
193
     -
188
         - Card numbers for patrons must be
194
         - Card numbers for patrons must be
189
         - pref: CardnumberLength
195
         - pref: CardnumberLength
190
         - "characters long. The length can be a single number to specify an exact length, a range separated by a comma (i.e., 'Min,Max'), or a maximum with no minimum (i.e., ',Max')."
196
         - "characters long. The length can be a single number to specify an exact length, a range separated by a comma (i.e., 'Min,Max'), or a maximum with no minimum (i.e., ',Max')."
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+15 lines)
Lines 429-434 Link Here
429
                        <div class="hint">Allow guarantors of this patron to view this patron's checkouts from the OPAC</div>
429
                        <div class="hint">Allow guarantors of this patron to view this patron's checkouts from the OPAC</div>
430
                    </li>
430
                    </li>
431
                [% END %]
431
                [% END %]
432
                [% IF relationships && Koha.Preference('AllowStaffToSetFinesVisibilityForGuarantor') %]
433
                    <li>
434
                        <label for="privacy_guarantor_fines">Show fines to guarantors</label>
435
                        <select name="privacy_guarantor_fines" id="privacy_guarantor_fines">
436
                            [% IF privacy_guarantor_fines %]
437
                                <option value="0">No</option>
438
                                <option value="1" selected>Yes</option>
439
                            [% ELSE %]
440
                                <option value="0" selected>No</option>
441
                                <option value="1">Yes</option>
442
                            [% END %]
443
                        </select>
444
                        <div class="hint">Allow guarantors of this patron to view this patron's fines from the OPAC</div>
445
                    </li>
446
                [% END %]
432
            </ol>
447
            </ol>
433
    </fieldset>
448
    </fieldset>
434
[% END %]
449
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+9 lines)
Lines 492-497 Link Here
492
                                            [% END %]
492
                                            [% END %]
493
                                        </li>
493
                                        </li>
494
494
495
                                        <li>
496
                                            <span class="label">Show fines to guarantor</span>
497
                                            [% IF privacy_guarantor_fines %]
498
                                                Yes
499
                                            [% ELSE %]
500
                                                No
501
                                            [% END %]
502
                                        </li>
503
495
                                        [% IF ( patron.sort1 ) %]
504
                                        [% IF ( patron.sort1 ) %]
496
                                            <li id="patron-sort1">
505
                                            <li id="patron-sort1">
497
                                                <span class="label">Sort field 1:</span>
506
                                                <span class="label">Sort field 1:</span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-15 / +53 lines)
Lines 100-106 Link Here
100
                    <div class="alert">You typed in the wrong characters in the box before submitting. Please try again.</div>
100
                    <div class="alert">You typed in the wrong characters in the box before submitting. Please try again.</div>
101
                [% END %]
101
                [% END %]
102
102
103
                [% IF patron.guarantor_relationships && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
103
                [% IF patron.guarantor_relationships && !Koha.Preference('OPACPrivacy') && ( Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') || Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') ) %]
104
                    <fieldset class="rows" id="memberentry_privacy">
104
                    <fieldset class="rows" id="memberentry_privacy">
105
                        <legend id="privacy_legend">Privacy</legend>
105
                        <legend id="privacy_legend">Privacy</legend>
106
                        <ol>
106
                        <ol>
Lines 118-123 Link Here
118
                                    <a id="update_privacy_guarantor_checkouts" href="#" class="btn">Update</a>
118
                                    <a id="update_privacy_guarantor_checkouts" href="#" class="btn">Update</a>
119
                                    <span id="update_privacy_guarantor_checkouts_message" class="alert" style="display:none"></span>
119
                                    <span id="update_privacy_guarantor_checkouts_message" class="alert" style="display:none"></span>
120
                                </span>
120
                                </span>
121
                            </li>
122
123
                            <li>
124
                                <label>Allow your guarantor to view your current fines?</label>
125
                                <select id="privacy_guarantor_fines">
126
                                    <option value="0">No</option>
127
                                    [% IF borrower.privacy_guarantor_fines %]
128
                                        <option value="1" selected="selected">Yes</option>
129
                                    [% ELSE %]
130
                                        <option value="1">Yes</option>
131
                                    [% END %]
132
                                </select>
133
                                <span class="hint">
134
                                    <a id="update_privacy_guarantor_fines" href="#" class="btn">Update</a>
135
                                    <span id="update_privacy_guarantor_fines_message" class="alert" style="display:none"></span>
136
                                </span>
137
                            </li>
138
139
                            <li>
121
                                <span class="hint">
140
                                <span class="hint">
122
                                    Guaranteed by
141
                                    Guaranteed by
123
                                    [% FOREACH gr IN patron.guarantor_relationships %]
142
                                    [% FOREACH gr IN patron.guarantor_relationships %]
Lines 1019-1038 Link Here
1019
                }
1038
                }
1020
            });
1039
            });
1021
1040
1022
            [% IF patron.guarantor_relationships && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
1041
            [% IF patron.guarantor_relationships && !Koha.Preference('OPACPrivacy') %]
1023
                $('#update_privacy_guarantor_checkouts').click( function() {
1042
1024
                    $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_guarantor_checkouts: $('#privacy_guarantor_checkouts').val() }, null, 'json')
1043
                [% IF Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
1025
                     .done(function( data ) {
1044
                    $('#update_privacy_guarantor_checkouts').click( function() {
1026
                         var message;
1045
                        $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_guarantor_checkouts: $('#privacy_guarantor_checkouts').val() }, null, 'json')
1027
                         if ( data.success ) {
1046
                         .done(function( data ) {
1028
                             message = _("Your setting has been updated!");
1047
                            var message;
1029
                         } else {
1048
                            if ( data.success ) {
1030
                             message = _("Unable to update your setting!");
1049
                                message = _("Your setting has been updated!");
1031
                         }
1050
                            } else {
1032
1051
                                message = _("Unable to update your setting!");
1033
                         $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
1052
                            }
1034
                     });
1053
1035
                });
1054
                            $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
1055
                        });
1056
                    });
1057
                [% END %]
1058
1059
                [% IF Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') %]
1060
                    $('#update_privacy_guarantor_fines').click( function() {
1061
                        $.post( "/cgi-bin/koha/svc/patron/show_fines_to_relatives", { privacy_guarantor_fines: $('#privacy_guarantor_fines').val() }, null, 'json')
1062
                         .done(function( data ) {
1063
                            var message;
1064
                            if ( data.success ) {
1065
                                message = _("Your setting has been updated!");
1066
                            } else {
1067
                                message = _("Unable to update your setting!");
1068
                            }
1069
1070
                            $('#update_privacy_guarantor_fines_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
1071
                        });
1072
                    });
1073
                [% END %]
1036
            [% END %]
1074
            [% END %]
1037
1075
1038
            $(".patron-attributes").on( 'click', '.clear-attribute', function() {
1076
            $(".patron-attributes").on( 'click', '.clear-attribute', function() {
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt (-11 / +25 lines)
Lines 71-88 Link Here
71
                                        </select>
71
                                        </select>
72
                                    </div>
72
                                    </div>
73
73
74
                                    [% IF borrower.guarantor_relationships && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
74
                                    [% IF borrower.guarantor_relationships && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') || Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') %]
75
                                        <div>
75
                                        <div>
76
                                            <label for="privacy_guarantor_checkouts">Allow your guarantor to view your current checkouts?</label>
76
                                            [% IF Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
77
                                            <select name="privacy_guarantor_checkouts">
77
                                                <label for="privacy_guarantor_checkouts">Allow your guarantor to view your current checkouts?</label>
78
                                                [% IF borrower.privacy_guarantor_checkouts %]
78
                                                <select name="privacy_guarantor_checkouts">
79
                                                    <option value="0">No</option>
79
                                                    [% IF borrower.privacy_guarantor_checkouts %]
80
                                                    <option value="1" selected>Yes</option>
80
                                                        <option value="0">No</option>
81
                                                [% ELSE %]
81
                                                        <option value="1" selected>Yes</option>
82
                                                    <option value="0" selected>No</option>
82
                                                    [% ELSE %]
83
                                                    <option value="1">Yes</option>
83
                                                        <option value="0" selected>No</option>
84
                                                [% END %]
84
                                                        <option value="1">Yes</option>
85
                                            </select>
85
                                                    [% END %]
86
                                                </select>
87
                                            [% END %]
88
                                            [% IF Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') %]
89
                                                <label for="privacy_guarantor_fines">Allow your guarantor to view your current fines?</label>
90
                                                <select name="privacy_guarantor_fines">
91
                                                    [% IF borrower.privacy_guarantor_fines %]
92
                                                        <option value="0">No</option>
93
                                                        <option value="1" selected>Yes</option>
94
                                                    [% ELSE %]
95
                                                        <option value="0" selected>No</option>
96
                                                        <option value="1">Yes</option>
97
                                                    [% END %]
98
                                                </select>
99
                                            [% END %]
86
                                            <span class="hint">
100
                                            <span class="hint">
87
                                                Guaranteed by
101
                                                Guaranteed by
88
                                                [% FOREACH gr IN borrower.guarantor_relationships %]
102
                                                [% FOREACH gr IN borrower.guarantor_relationships %]
(-)a/opac/opac-memberentry.pl (-1 / +1 lines)
Lines 333-339 my $captcha = random_string("CCCCC"); Link Here
333
$template->param(
333
$template->param(
334
    captcha        => $captcha,
334
    captcha        => $captcha,
335
    captcha_digest => md5_base64($captcha),
335
    captcha_digest => md5_base64($captcha),
336
    patron         => Koha::Patrons->find( $borrowernumber ),
336
    patron         => scalar Koha::Patrons->find( $borrowernumber ),
337
);
337
);
338
338
339
output_html_with_http_headers $cgi, $cookie, $template->output, undef, { force_no_caching => 1 };
339
output_html_with_http_headers $cgi, $cookie, $template->output, undef, { force_no_caching => 1 };
(-)a/opac/opac-privacy.pl (+2 lines)
Lines 47-52 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
47
my $op                         = $query->param("op");
47
my $op                         = $query->param("op");
48
my $privacy                    = $query->param("privacy");
48
my $privacy                    = $query->param("privacy");
49
my $privacy_guarantor_checkouts = $query->param("privacy_guarantor_checkouts");
49
my $privacy_guarantor_checkouts = $query->param("privacy_guarantor_checkouts");
50
my $privacy_guarantor_fines     = $query->param("privacy_guarantor_fines");
50
51
51
if ( $op eq "update_privacy" ) {
52
if ( $op eq "update_privacy" ) {
52
    my $patron = Koha::Patrons->find( $borrowernumber );
53
    my $patron = Koha::Patrons->find( $borrowernumber );
Lines 54-59 if ( $op eq "update_privacy" ) { Link Here
54
        $patron->set({
55
        $patron->set({
55
            privacy                    => $privacy,
56
            privacy                    => $privacy,
56
            privacy_guarantor_checkouts => $privacy_guarantor_checkouts,
57
            privacy_guarantor_checkouts => $privacy_guarantor_checkouts,
58
            privacy_guarantor_fines     => $privacy_guarantor_fines,
57
        })->store;
59
        })->store;
58
        $template->param( 'privacy_updated' => 1 );
60
        $template->param( 'privacy_updated' => 1 );
59
    }
61
    }
(-)a/opac/svc/patron/show_fines_to_relatives (-1 / +59 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2014 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
use JSON qw( to_json );
24
25
use C4::Auth;
26
use C4::Context;
27
28
use Koha::Patrons;
29
30
my $cgi = CGI->new();
31
32
my $privacy_guarantor_fines = $cgi->param('privacy_guarantor_fines');
33
34
my ( $userid, $cookie, $sessionID, $flags ) = checkauth( $cgi, 1, {}, 'opac' );
35
36
my $borrowernumber = C4::Context->userenv ? C4::Context->userenv->{number} : undef;
37
38
my $success = 0;
39
if ( $borrowernumber && defined($privacy_guarantor_fines) ) {
40
    my $patron = Koha::Patrons->find($borrowernumber);
41
42
    if ( $patron ) {
43
        $patron->privacy_guarantor_fines($privacy_guarantor_fines);
44
        $success = $patron->store();
45
    }
46
}
47
48
binmode STDOUT, ":encoding(UTF-8)";
49
print $cgi->header(
50
    -type    => 'application/json',
51
    -charset => 'UTF-8'
52
);
53
54
print to_json(
55
    {
56
        success => $success ? 1 : 0,
57
        privacy_guarantor_fines => $privacy_guarantor_fines,
58
    }
59
);

Return to bug 20691