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

(-)a/C4/Members.pm (-26 lines)
Lines 109-115 BEGIN { Link Here
109
    push @EXPORT, qw(
109
    push @EXPORT, qw(
110
        &ModMember
110
        &ModMember
111
        &changepassword
111
        &changepassword
112
         &ModPrivacy
113
    );
112
    );
114
113
115
    #Delete data
114
    #Delete data
Lines 2169-2199 sub GetBorrowersNamesAndLatestIssue { Link Here
2169
    return $results;
2168
    return $results;
2170
}
2169
}
2171
2170
2172
=head2 ModPrivacy
2173
2174
=over 4
2175
2176
my $success = ModPrivacy( $borrowernumber, $privacy );
2177
2178
Update the privacy of a patron.
2179
2180
return :
2181
true on success, false on failure
2182
2183
=back
2184
2185
=cut
2186
2187
sub ModPrivacy {
2188
    my $borrowernumber = shift;
2189
    my $privacy = shift;
2190
    return unless defined $borrowernumber;
2191
    return unless $borrowernumber =~ /^\d+$/;
2192
2193
    return ModMember( borrowernumber => $borrowernumber,
2194
                      privacy        => $privacy );
2195
}
2196
2197
=head2 AddMessage
2171
=head2 AddMessage
2198
2172
2199
  AddMessage( $borrowernumber, $message_type, $message, $branchcode );
2173
  AddMessage( $borrowernumber, $message_type, $message, $branchcode );
(-)a/C4/Reserves.pm (-1 / +13 lines)
Lines 260-269 sub GetReserve { Link Here
260
    my ($reserve_id) = @_;
260
    my ($reserve_id) = @_;
261
261
262
    my $dbh = C4::Context->dbh;
262
    my $dbh = C4::Context->dbh;
263
263
    my $query = "SELECT * FROM reserves WHERE reserve_id = ?";
264
    my $query = "SELECT * FROM reserves WHERE reserve_id = ?";
264
    my $sth = $dbh->prepare( $query );
265
    my $sth = $dbh->prepare( $query );
265
    $sth->execute( $reserve_id );
266
    $sth->execute( $reserve_id );
266
    return $sth->fetchrow_hashref();
267
    my $res = $sth->fetchrow_hashref();
268
269
    unless ($res) {
270
        $query = "SELECT * FROM old_reserves WHERE reserve_id = ?";
271
        $sth   = $dbh->prepare($query);
272
        $sth->execute($reserve_id);
273
        $res = $sth->fetchrow_hashref();
274
    }
275
276
    carp("No hold for for reserve_id $reserve_id") unless $res;
277
278
    return $res;
267
}
279
}
268
280
269
=head2 GetReservesFromBiblionumber
281
=head2 GetReservesFromBiblionumber
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+13 lines)
Lines 1170-1175 Link Here
1170
			[% END %]
1170
			[% END %]
1171
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
1171
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
1172
		</li>
1172
		</li>
1173
        <li>
1174
            <label for="privacy_relative_checkouts">Show checkouts to relatives</label>
1175
            <select name="privacy_relative_checkouts" id="privacy_relative_checkouts">
1176
                [% IF privacy_relative_checkouts %]
1177
                    <option value="0">No</option>
1178
                    <option value="1" selected>Yes</option>
1179
                [% ELSE %]
1180
                    <option value="0" selected>No</option>
1181
                    <option value="1">Yes</option>
1182
                [% END %]
1183
            </select>
1184
            <div class="hint">Allow linked patron accounts to view this patron's checkouts from the OPAC</div>
1185
        </li>
1173
		</ol>
1186
		</ol>
1174
		</fieldset>
1187
		</fieldset>
1175
        [% END # hide fieldset %][% END %]
1188
        [% END # hide fieldset %][% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt (-2 / +16 lines)
Lines 48-54 Link Here
48
                                <input type="hidden" name="op" value="update_privacy" />
48
                                <input type="hidden" name="op" value="update_privacy" />
49
                                    <fieldset>
49
                                    <fieldset>
50
                                    <label for="privacy">Please choose your privacy rule:</label>
50
                                    <label for="privacy">Please choose your privacy rule:</label>
51
                                    <div class="input-append">
51
                                    <div>
52
                                        <select name="privacy" id="privacy">
52
                                        <select name="privacy" id="privacy">
53
                                            [% IF ( privacy0 ) %]
53
                                            [% IF ( privacy0 ) %]
54
                                                <option value="0" selected="selected" class="privacy0">Forever</option>
54
                                                <option value="0" selected="selected" class="privacy0">Forever</option>
Lines 66-73 Link Here
66
                                                <option value="2" class="privacy2">Never</option>
66
                                                <option value="2" class="privacy2">Never</option>
67
                                            [% END %]
67
                                            [% END %]
68
                                        </select>
68
                                        </select>
69
                                        <button type="Submit" class="btn">Submit</button>
70
                                    </div>
69
                                    </div>
70
71
                                    <div>
72
                                        <label for="privacy_relative_checkouts">Allow relatives to view your current checkouts?</label>
73
                                        <select name="privacy_relative_checkouts">
74
                                            [% IF borrower.privacy_relative_checkouts %]
75
                                                <option value="0">No</option>
76
                                                <option value="1" selected>Yes</option>
77
                                            [% ELSE %]
78
                                                <option value="0" selected>No</option>
79
                                                <option value="1">Yes</option>
80
                                            [% END %]
81
                                        </select>
82
                                    </div>
83
84
                                    <button type="Submit" class="btn">Save</button>
71
                                </fieldset>
85
                                </fieldset>
72
                            </form>
86
                            </form>
73
                        <h2>Immediate deletion</h2>
87
                        <h2>Immediate deletion</h2>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-1 / +49 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE EncodeUTF8 %]
3
4
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home
6
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home
Lines 104-109 Link Here
104
                    <div id="opac-user-views" class="toptabs">
105
                    <div id="opac-user-views" class="toptabs">
105
                        <ul>
106
                        <ul>
106
                            <li><a href="#opac-user-checkouts">Checked out ([% issues_count %])</a></li>
107
                            <li><a href="#opac-user-checkouts">Checked out ([% issues_count %])</a></li>
108
                            [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
107
                            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count %])</a></li>[% END %]
109
                            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count %])</a></li>[% END %]
108
                            [% IF ( OPACFinesTab ) %]
110
                            [% IF ( OPACFinesTab ) %]
109
                                [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% BORROWER_INF.amountoutstanding %])</a></li>[% END %]
111
                                [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% BORROWER_INF.amountoutstanding %])</a></li>[% END %]
Lines 360-365 Link Here
360
                            </div> <!-- /#opac-user-waiting -->
362
                            </div> <!-- /#opac-user-waiting -->
361
                        [% END # waiting_count && atdestination %]
363
                        [% END # waiting_count && atdestination %]
362
364
365
                        [% IF relatives %]
366
                            <div id="opac-user-relative-issues">
367
                                <table id="opac-user-relative-issues-table" class="table table-bordered table-striped">
368
                                    <thead>
369
                                        <tr>
370
                                            <th class="anti-the">Title</th>
371
                                            <th>Due</th>
372
                                            <th>Barcode</th>
373
                                            <th>Call No.</th>
374
                                            <th class="psort">Relative</th>
375
                                        </tr>
376
                                    </thead>
377
378
                                    <tbody>
379
                                        [% FOREACH r IN relatives %]
380
                                            [% FOREACH i IN r.issues %]
381
                                                <tr>
382
                                                    <td>
383
                                                        <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% i.item.biblio.biblionumber %]">
384
                                                            [% i.item.biblio.title | $EncodeUTF8 %]
385
                                                        </a>
386
                                                    </td>
387
388
                                                    <td>
389
                                                        [% i.date_due | $KohaDates %]
390
                                                    </td>
391
392
                                                    <td>
393
                                                        [% i.item.barcode %]
394
                                                    </td>
395
396
                                                    <td>
397
                                                        [% i.item.itemcallnumber | $EncodeUTF8 %]
398
                                                    </td>
399
400
                                                    <td>
401
                                                        [% r.firstname | $EncodeUTF8 %] [% r.surname | $EncodeUTF8 %]
402
                                                    </td>
403
                                                </tr>
404
                                            [% END %]
405
                                        [% END %]
406
                                    </tbody>
407
                                </table>
408
                            </div>
409
                        [% END %]
363
410
364
                        [% IF ( overdues_count ) %]
411
                        [% IF ( overdues_count ) %]
365
                            <div id="opac-user-overdues">
412
                            <div id="opac-user-overdues">
Lines 681-687 Link Here
681
            $(".js-hide").hide();
728
            $(".js-hide").hide();
682
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
729
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
683
            $(".suspend-until").prop("readonly",1);
730
            $(".suspend-until").prop("readonly",1);
684
            var dTables = $("#checkoutst,#holdst,#overduest");
731
732
            var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
685
            dTables.each(function(){
733
            dTables.each(function(){
686
                var thIndex = $(this).find("th.psort").index();
734
                var thIndex = $(this).find("th.psort").index();
687
                $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
735
                $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt (-2 / +19 lines)
Lines 35-41 Link Here
35
    </div>
35
    </div>
36
    <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-update-form">
36
    <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-update-form">
37
            <input type="hidden" name="op" value="update_privacy" />
37
            <input type="hidden" name="op" value="update_privacy" />
38
            <label for:"privacy">Please choose your privacy rule:</label>
38
39
            <label for="privacy">Please choose your privacy rule:</label>
39
            <select name="privacy">
40
            <select name="privacy">
40
                [% IF ( privacy0 ) %]
41
                [% IF ( privacy0 ) %]
41
                    <option value="0" selected="1" class="privacy0">Forever</option>
42
                    <option value="0" selected="1" class="privacy0">Forever</option>
Lines 53-59 Link Here
53
                    <option value="2" class="privacy2">Never</option>
54
                    <option value="2" class="privacy2">Never</option>
54
                [% END %]
55
                [% END %]
55
            </select>
56
            </select>
56
            <input type="Submit" value="Submit" />
57
58
            <p/>
59
60
            <label for="privacy_relative_checkouts">Allow relatives to view your current checkouts?</label>
61
            <select name="privacy_relative_checkouts">
62
                [% IF borrower.privacy_relative_checkouts %]
63
                    <option value="0">No</option>
64
                    <option value="1" selected>Yes</option>
65
                [% ELSE %]
66
                    <option value="0" selected>No</option>
67
                    <option value="1">Yes</option>
68
                [% END %]
69
            </select>
70
71
            <p/>
72
73
            <input type="Submit" value="Save" />
57
        </form>
74
        </form>
58
        <h2>Immediate deletion</h2>
75
        <h2>Immediate deletion</h2>
59
        <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-delete-form">
76
        <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-delete-form">
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (-1 / +49 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE EncodeUTF8 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home
5
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
Lines 15-21 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
15
16
16
        $('#opac-user-views').tabs();
17
        $('#opac-user-views').tabs();
17
18
18
        var dTables = $("#checkoutst,#holdst,#overduest");
19
        var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
19
        dTables.each(function(){
20
        dTables.each(function(){
20
            var thIndex = $(this).find("th.psort").index();
21
            var thIndex = $(this).find("th.psort").index();
21
            $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
22
            $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
Lines 146-151 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
146
<div id="opac-user-views" class="toptabs">
147
<div id="opac-user-views" class="toptabs">
147
        <ul>
148
        <ul>
148
            <li><a href="#opac-user-checkouts">Checked out</a></li>
149
            <li><a href="#opac-user-checkouts">Checked out</a></li>
150
            [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
149
            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue</a></li>[% END %]
151
            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue</a></li>[% END %]
150
[% IF ( OPACFinesTab ) %]
152
[% IF ( OPACFinesTab ) %]
151
            [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines</a></li>[% END %]
153
            [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines</a></li>[% END %]
Lines 325-330 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
325
        [% END %]
327
        [% END %]
326
    [% END %]
328
    [% END %]
327
329
330
    [% IF relatives %]
331
        <div id="opac-user-relative-issues">
332
            <table id="opac-user-relative-issues-table">
333
                <thead>
334
                    <tr>
335
                        <th class="anti-the">Title</th>
336
                        <th>Due</th>
337
                        <th>Barcode</th>
338
                        <th>Call No.</th>
339
                        <th class="psort">Relative</th>
340
                    </tr>
341
                </thead>
342
343
                <tbody>
344
                    [% FOREACH r IN relatives %]
345
                        [% FOREACH i IN r.issues %]
346
                            <tr>
347
                                <td>
348
                                    <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% i.item.biblio.biblionumber %]">
349
                                        [% i.item.biblio.title | $EncodeUTF8 %]
350
                                    </a>
351
                                </td>
352
353
                                <td>
354
                                    [% i.date_due | $KohaDates %]
355
                                </td>
356
357
                                <td>
358
                                    [% i.item.barcode %]
359
                                </td>
360
361
                                <td>
362
                                    [% i.item.itemcallnumber | $EncodeUTF8 %]
363
                                </td>
364
365
                                <td>
366
                                    [% r.firstname | $EncodeUTF8 %] [% r.surname | $EncodeUTF8 %]
367
                                </td>
368
                            </tr>
369
                        [% END %]
370
                    [% END %]
371
                </tbody>
372
            </table>
373
        </div>
374
    [% END %]
375
328
[% IF ( overdues_count ) %]
376
[% IF ( overdues_count ) %]
329
<div id="opac-user-overdues"><table id="overduest">
377
<div id="opac-user-overdues"><table id="overduest">
330
<caption>Overdues <span class="count">([% overdues_count %] total)</span></caption>
378
<caption>Overdues <span class="count">([% overdues_count %] total)</span></caption>
(-)a/opac/opac-privacy.pl (-14 / +24 lines)
Lines 40-57 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
40
    }
40
    }
41
);
41
);
42
42
43
my $op = $query->param("op");
43
my $op                         = $query->param("op");
44
my $privacy = $query->param("privacy");
44
my $privacy                    = $query->param("privacy");
45
my $privacy_relative_checkouts = $query->param("privacy_relative_checkouts");
45
46
46
if ($op eq "update_privacy")
47
if ( $op eq "update_privacy" ) {
47
{
48
    ModMember(
48
    ModPrivacy($borrowernumber,$privacy);
49
        borrowernumber             => $borrowernumber,
49
    $template->param('privacy_updated' => 1);
50
        privacy                    => $privacy,
51
        privacy_relative_checkouts => $privacy_relative_checkouts,
52
    );
53
    $template->param( 'privacy_updated' => 1 );
50
}
54
}
51
if ($op eq "delete_record") {
55
elsif ( $op eq "delete_record" ) {
56
52
    # delete all reading records for items returned
57
    # delete all reading records for items returned
53
    # uses a hardcoded date ridiculously far in the future
58
    # uses a hardcoded date ridiculously far in the future
54
    my ($rows,$err_history_not_deleted) = AnonymiseIssueHistory('2999-12-12',$borrowernumber);
59
    my ( $rows, $err_history_not_deleted ) =
60
      AnonymiseIssueHistory( '2999-12-12', $borrowernumber );
61
55
    # confirm the user the deletion has been done
62
    # confirm the user the deletion has been done
56
    if ( !$err_history_not_deleted ) {
63
    if ( !$err_history_not_deleted ) {
57
        $template->param( 'deleted' => 1 );
64
        $template->param( 'deleted' => 1 );
Lines 60-73 if ($op eq "delete_record") { Link Here
60
        $template->param( 'err_history_not_deleted' => 1 );
67
        $template->param( 'err_history_not_deleted' => 1 );
61
    }
68
    }
62
}
69
}
70
63
# get borrower privacy ....
71
# get borrower privacy ....
64
my ( $borr ) = GetMemberDetails( $borrowernumber );
72
my $borrower = GetMemberDetails( $borrowernumber );
65
73
66
$template->param( 'Ask_data'       => '1',
74
$template->param(
67
                    'privacy'.$borr->{'privacy'} => 1,
75
    'Ask_data'                         => 1,
68
                    'firstname' => $borr->{'firstname'},
76
    'privacy' . $borrower->{'privacy'} => 1,
69
                    'surname' => $borr->{'surname'},
77
    'privacyview'                      => 1,
70
                    'privacyview' => 1,
78
    'borrower'                         => $borrower,
79
    'surname'                          => $borrower->{surname},
80
    'firstname'                        => $borrower->{firstname},
71
);
81
);
72
82
73
output_html_with_http_headers $query, $cookie, $template->output;
83
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-user.pl (-10 / +18 lines)
Lines 35-40 use C4::Items; Link Here
35
use C4::Letters;
35
use C4::Letters;
36
use C4::Branch; # GetBranches
36
use C4::Branch; # GetBranches
37
use Koha::DateUtils;
37
use Koha::DateUtils;
38
use Koha::Database;
38
39
39
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
40
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
40
41
Lines 371-388 if ( $borr->{'opacnote'} ) { Link Here
371
  );
372
  );
372
}
373
}
373
374
375
my @borrowernumbers = GetMemberRelatives($borrowernumber);
376
if ( @borrowernumbers ) {
377
    my @relatives = Koha::Database->new()->schema()->resultset("Borrower")->search(
378
        { privacy_relative_checkouts => 1,  'me.borrowernumber' => { -in => \@borrowernumbers, } },
379
        { prefetch => [ { 'issues' => { 'item' => 'biblio' } } ] }
380
    );
381
    $template->param( relatives => \@relatives );
382
}
383
374
$template->param(
384
$template->param(
375
    bor_messages_loop    => GetMessages( $borrowernumber, 'B', 'NONE' ),
385
    borrower           => $borr,
386
    bor_messages_loop  => GetMessages( $borrowernumber, 'B', 'NONE' ),
376
    waiting_count      => $wcount,
387
    waiting_count      => $wcount,
377
    patronupdate => $patronupdate,
388
    patronupdate       => $patronupdate,
378
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
389
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
379
    userview => 1,
390
    userview           => 1,
380
);
391
    SuspendHoldsOpac   => C4::Context->preference('SuspendHoldsOpac'),
381
392
    OpacHoldNotes      => C4::Context->preference('OpacHoldNotes'),
382
$template->param(
393
    AutoResumeSuspendedHolds =>
383
    SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
394
      C4::Context->preference('AutoResumeSuspendedHolds'),
384
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
385
    OpacHoldNotes => C4::Context->preference('OpacHoldNotes'),
386
);
395
);
387
396
388
output_html_with_http_headers $query, $cookie, $template->output;
397
output_html_with_http_headers $query, $cookie, $template->output;
389
- 

Return to bug 9303