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

(-)a/C4/Members.pm (-26 lines)
Lines 112-118 BEGIN { Link Here
112
    push @EXPORT, qw(
112
    push @EXPORT, qw(
113
        &ModMember
113
        &ModMember
114
        &changepassword
114
        &changepassword
115
         &ModPrivacy
116
    );
115
    );
117
116
118
    #Delete data
117
    #Delete data
Lines 2216-2246 sub GetBorrowersNamesAndLatestIssue { Link Here
2216
    return $results;
2215
    return $results;
2217
}
2216
}
2218
2217
2219
=head2 ModPrivacy
2220
2221
=over 4
2222
2223
my $success = ModPrivacy( $borrowernumber, $privacy );
2224
2225
Update the privacy of a patron.
2226
2227
return :
2228
true on success, false on failure
2229
2230
=back
2231
2232
=cut
2233
2234
sub ModPrivacy {
2235
    my $borrowernumber = shift;
2236
    my $privacy = shift;
2237
    return unless defined $borrowernumber;
2238
    return unless $borrowernumber =~ /^\d+$/;
2239
2240
    return ModMember( borrowernumber => $borrowernumber,
2241
                      privacy        => $privacy );
2242
}
2243
2244
=head2 AddMessage
2218
=head2 AddMessage
2245
2219
2246
  AddMessage( $borrowernumber, $message_type, $message, $branchcode );
2220
  AddMessage( $borrowernumber, $message_type, $message, $branchcode );
(-)a/C4/Reserves.pm (+11 lines)
Lines 258-267 sub GetReserve { Link Here
258
    my ($reserve_id) = @_;
258
    my ($reserve_id) = @_;
259
259
260
    my $dbh = C4::Context->dbh;
260
    my $dbh = C4::Context->dbh;
261
261
    my $query = "SELECT * FROM reserves WHERE reserve_id = ?";
262
    my $query = "SELECT * FROM reserves WHERE reserve_id = ?";
262
    my $sth = $dbh->prepare( $query );
263
    my $sth = $dbh->prepare( $query );
263
    $sth->execute( $reserve_id );
264
    $sth->execute( $reserve_id );
264
    my $res = $sth->fetchrow_hashref();
265
    my $res = $sth->fetchrow_hashref();
266
267
    unless ($res) {
268
        $query = "SELECT * FROM old_reserves WHERE reserve_id = ?";
269
        $sth   = $dbh->prepare($query);
270
        $sth->execute($reserve_id);
271
        $res = $sth->fetchrow_hashref();
272
    }
273
274
    carp("No hold for for reserve_id $reserve_id") unless $res;
275
265
    return $res;
276
    return $res;
266
}
277
}
267
278
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+13 lines)
Lines 1157-1162 Link Here
1157
			[% END %]
1157
			[% END %]
1158
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
1158
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
1159
		</li>
1159
		</li>
1160
        <li>
1161
            <label for="privacy_relative_checkouts">Show checkouts to relatives</label>
1162
            <select name="privacy_relative_checkouts" id="privacy_relative_checkouts">
1163
                [% IF privacy_relative_checkouts %]
1164
                    <option value="0">No</option>
1165
                    <option value="1" selected>Yes</option>
1166
                [% ELSE %]
1167
                    <option value="0" selected>No</option>
1168
                    <option value="1">Yes</option>
1169
                [% END %]
1170
            </select>
1171
            <div class="hint">Allow linked patron accounts to view this patron's checkouts from the OPAC</div>
1172
        </li>
1160
		</ol>
1173
		</ol>
1161
		</fieldset>
1174
		</fieldset>
1162
        [% END # hide fieldset %][% END %]
1175
        [% 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 (-2 / +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 83-88 Link Here
83
                    <div id="opac-user-views" class="toptabs">
84
                    <div id="opac-user-views" class="toptabs">
84
                        <ul>
85
                        <ul>
85
                            <li><a href="#opac-user-checkouts">Checked out</a></li>
86
                            <li><a href="#opac-user-checkouts">Checked out</a></li>
87
                            [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
86
                            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue</a></li>[% END %]
88
                            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue</a></li>[% END %]
87
                            [% IF ( OPACFinesTab ) %]
89
                            [% IF ( OPACFinesTab ) %]
88
                                [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines</a></li>[% END %]
90
                                [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines</a></li>[% END %]
Lines 341-346 Link Here
341
                            </div> <!-- /#opac-user-waiting -->
343
                            </div> <!-- /#opac-user-waiting -->
342
                        [% END # waiting_count && atdestination %]
344
                        [% END # waiting_count && atdestination %]
343
345
346
                        [% IF relatives %]
347
                            <div id="opac-user-relative-issues">
348
                                <table id="opac-user-relative-issues-table" class="table table-bordered table-striped">
349
                                    <thead>
350
                                        <tr>
351
                                            <th class="anti-the">Title</th>
352
                                            <th>Due</th>
353
                                            <th>Barcode</th>
354
                                            <th>Call No.</th>
355
                                            <th class="psort">Relative</th>
356
                                        </tr>
357
                                    </thead>
358
359
                                    <tbody>
360
                                        [% FOREACH r IN relatives %]
361
                                            [% FOREACH i IN r.issues %]
362
                                                <tr>
363
                                                    <td>
364
                                                        <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% i.item.biblio.biblionumber %]">
365
                                                            [% i.item.biblio.title | $EncodeUTF8 %]
366
                                                        </a>
367
                                                    </td>
368
369
                                                    <td>
370
                                                        [% i.date_due | $KohaDates %]
371
                                                    </td>
372
373
                                                    <td>
374
                                                        [% i.item.barcode %]
375
                                                    </td>
376
377
                                                    <td>
378
                                                        [% i.item.itemcallnumber | $EncodeUTF8 %]
379
                                                    </td>
380
381
                                                    <td>
382
                                                        [% r.firstname | $EncodeUTF8 %] [% r.surname | $EncodeUTF8 %]
383
                                                    </td>
384
                                                </tr>
385
                                            [% END %]
386
                                        [% END %]
387
                                    </tbody>
388
                                </table>
389
                            </div>
390
                        [% END %]
344
391
345
                        [% IF ( overdues_count ) %]
392
                        [% IF ( overdues_count ) %]
346
                            <div id="opac-user-overdues">
393
                            <div id="opac-user-overdues">
Lines 609-615 Link Here
609
        $(function() {
656
        $(function() {
610
            $('#opac-user-views').tabs();
657
            $('#opac-user-views').tabs();
611
658
612
            var dTables = $("#checkoutst,#holdst,#overduest");
659
            var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
613
            dTables.each(function(){
660
            dTables.each(function(){
614
                var thIndex = $(this).find("th.psort").index();
661
                var thIndex = $(this).find("th.psort").index();
615
                $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
662
                $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
Lines 648-651 Link Here
648
        });
695
        });
649
        //]]>
696
        //]]>
650
    </script>
697
    </script>
651
[% END %]
698
[% END %]
(-)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 14-20 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
14
            $(function() {
15
            $(function() {
15
            $('#opac-user-views').tabs();
16
            $('#opac-user-views').tabs();
16
17
17
        var dTables = $("#checkoutst,#holdst,#overduest");
18
        var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
18
        dTables.each(function(){
19
        dTables.each(function(){
19
            var thIndex = $(this).find("th.psort").index();
20
            var thIndex = $(this).find("th.psort").index();
20
            $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
21
            $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
Lines 117-122 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
117
<div id="opac-user-views" class="toptabs">
118
<div id="opac-user-views" class="toptabs">
118
        <ul>
119
        <ul>
119
            <li><a href="#opac-user-checkouts">Checked out</a></li>
120
            <li><a href="#opac-user-checkouts">Checked out</a></li>
121
            [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
120
            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue</a></li>[% END %]
122
            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue</a></li>[% END %]
121
[% IF ( OPACFinesTab ) %]
123
[% IF ( OPACFinesTab ) %]
122
            [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines</a></li>[% END %]
124
            [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines</a></li>[% END %]
Lines 285-290 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
285
        [% END %]
287
        [% END %]
286
    [% END %]
288
    [% END %]
287
289
290
    [% IF relatives %]
291
        <div id="opac-user-relative-issues">
292
            <table id="opac-user-relative-issues-table">
293
                <thead>
294
                    <tr>
295
                        <th class="anti-the">Title</th>
296
                        <th>Due</th>
297
                        <th>Barcode</th>
298
                        <th>Call No.</th>
299
                        <th class="psort">Relative</th>
300
                    </tr>
301
                </thead>
302
303
                <tbody>
304
                    [% FOREACH r IN relatives %]
305
                        [% FOREACH i IN r.issues %]
306
                            <tr>
307
                                <td>
308
                                    <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% i.item.biblio.biblionumber %]">
309
                                        [% i.item.biblio.title | $EncodeUTF8 %]
310
                                    </a>
311
                                </td>
312
313
                                <td>
314
                                    [% i.date_due | $KohaDates %]
315
                                </td>
316
317
                                <td>
318
                                    [% i.item.barcode %]
319
                                </td>
320
321
                                <td>
322
                                    [% i.item.itemcallnumber | $EncodeUTF8 %]
323
                                </td>
324
325
                                <td>
326
                                    [% r.firstname | $EncodeUTF8 %] [% r.surname | $EncodeUTF8 %]
327
                                </td>
328
                            </tr>
329
                        [% END %]
330
                    [% END %]
331
                </tbody>
332
            </table>
333
        </div>
334
    [% END %]
335
288
[% IF ( overdues_count ) %]
336
[% IF ( overdues_count ) %]
289
<div id="opac-user-overdues"><table id="overduest">
337
<div id="opac-user-overdues"><table id="overduest">
290
<caption>Overdues <span class="count">([% overdues_count %] total)</span></caption>
338
<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 352-369 if ( $borr->{'opacnote'} ) { Link Here
352
  );
353
  );
353
}
354
}
354
355
356
my @borrowernumbers = GetMemberRelatives($borrowernumber);
357
if ( @borrowernumbers ) {
358
    my @relatives = Koha::Database->new()->schema()->resultset("Borrower")->search(
359
        { privacy_relative_checkouts => 1,  'me.borrowernumber' => { -in => \@borrowernumbers, } },
360
        { prefetch => [ { 'issues' => { 'item' => 'biblio' } } ] }
361
    );
362
    $template->param( relatives => \@relatives );
363
}
364
355
$template->param(
365
$template->param(
356
    bor_messages_loop    => GetMessages( $borrowernumber, 'B', 'NONE' ),
366
    borrower           => $borr,
367
    bor_messages_loop  => GetMessages( $borrowernumber, 'B', 'NONE' ),
357
    waiting_count      => $wcount,
368
    waiting_count      => $wcount,
358
    patronupdate => $patronupdate,
369
    patronupdate       => $patronupdate,
359
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
370
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
360
    userview => 1,
371
    userview           => 1,
361
);
372
    SuspendHoldsOpac   => C4::Context->preference('SuspendHoldsOpac'),
362
373
    OpacHoldNotes      => C4::Context->preference('OpacHoldNotes'),
363
$template->param(
374
    AutoResumeSuspendedHolds =>
364
    SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
375
      C4::Context->preference('AutoResumeSuspendedHolds'),
365
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
366
    OpacHoldNotes => C4::Context->preference('OpacHoldNotes'),
367
);
376
);
368
377
369
output_html_with_http_headers $query, $cookie, $template->output;
378
output_html_with_http_headers $query, $cookie, $template->output;
370
- 

Return to bug 9303