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 2136-2166 sub GetBorrowersNamesAndLatestIssue { Link Here
2136
    return $results;
2135
    return $results;
2137
}
2136
}
2138
2137
2139
=head2 ModPrivacy
2140
2141
=over 4
2142
2143
my $success = ModPrivacy( $borrowernumber, $privacy );
2144
2145
Update the privacy of a patron.
2146
2147
return :
2148
true on success, false on failure
2149
2150
=back
2151
2152
=cut
2153
2154
sub ModPrivacy {
2155
    my $borrowernumber = shift;
2156
    my $privacy = shift;
2157
    return unless defined $borrowernumber;
2158
    return unless $borrowernumber =~ /^\d+$/;
2159
2160
    return ModMember( borrowernumber => $borrowernumber,
2161
                      privacy        => $privacy );
2162
}
2163
2164
=head2 AddMessage
2138
=head2 AddMessage
2165
2139
2166
  AddMessage( $borrowernumber, $message_type, $message, $branchcode );
2140
  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 1178-1183 Link Here
1178
			[% END %]
1178
			[% END %]
1179
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
1179
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
1180
		</li>
1180
		</li>
1181
        <li>
1182
            <label for="privacy_relative_checkouts">Show checkouts to relatives</label>
1183
            <select name="privacy_relative_checkouts" id="privacy_relative_checkouts">
1184
                [% IF privacy_relative_checkouts %]
1185
                    <option value="0">No</option>
1186
                    <option value="1" selected>Yes</option>
1187
                [% ELSE %]
1188
                    <option value="0" selected>No</option>
1189
                    <option value="1">Yes</option>
1190
                [% END %]
1191
            </select>
1192
            <div class="hint">Allow linked patron accounts to view this patron's checkouts from the OPAC</div>
1193
        </li>
1181
		</ol>
1194
		</ol>
1182
		</fieldset>
1195
		</fieldset>
1183
        [% END # hide fieldset %][% END %]
1196
        [% 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 86-91 Link Here
86
                    <div id="opac-user-views" class="toptabs">
87
                    <div id="opac-user-views" class="toptabs">
87
                        <ul>
88
                        <ul>
88
                            <li><a href="#opac-user-checkouts">Checked out ([% issues_count %])</a></li>
89
                            <li><a href="#opac-user-checkouts">Checked out ([% issues_count %])</a></li>
90
                            [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
89
                            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count %])</a></li>[% END %]
91
                            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count %])</a></li>[% END %]
90
                            [% IF ( OPACFinesTab ) %]
92
                            [% IF ( OPACFinesTab ) %]
91
                                [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% BORROWER_INF.amountoutstanding %])</a></li>[% END %]
93
                                [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% BORROWER_INF.amountoutstanding %])</a></li>[% END %]
Lines 342-347 Link Here
342
                            </div> <!-- /#opac-user-waiting -->
344
                            </div> <!-- /#opac-user-waiting -->
343
                        [% END # waiting_count && atdestination %]
345
                        [% END # waiting_count && atdestination %]
344
346
347
                        [% IF relatives %]
348
                            <div id="opac-user-relative-issues">
349
                                <table id="opac-user-relative-issues-table" class="table table-bordered table-striped">
350
                                    <thead>
351
                                        <tr>
352
                                            <th class="anti-the">Title</th>
353
                                            <th>Due</th>
354
                                            <th>Barcode</th>
355
                                            <th>Call No.</th>
356
                                            <th class="psort">Relative</th>
357
                                        </tr>
358
                                    </thead>
359
360
                                    <tbody>
361
                                        [% FOREACH r IN relatives %]
362
                                            [% FOREACH i IN r.issues %]
363
                                                <tr>
364
                                                    <td>
365
                                                        <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% i.item.biblio.biblionumber %]">
366
                                                            [% i.item.biblio.title | $EncodeUTF8 %]
367
                                                        </a>
368
                                                    </td>
369
370
                                                    <td>
371
                                                        [% i.date_due | $KohaDates %]
372
                                                    </td>
373
374
                                                    <td>
375
                                                        [% i.item.barcode %]
376
                                                    </td>
377
378
                                                    <td>
379
                                                        [% i.item.itemcallnumber | $EncodeUTF8 %]
380
                                                    </td>
381
382
                                                    <td>
383
                                                        [% r.firstname | $EncodeUTF8 %] [% r.surname | $EncodeUTF8 %]
384
                                                    </td>
385
                                                </tr>
386
                                            [% END %]
387
                                        [% END %]
388
                                    </tbody>
389
                                </table>
390
                            </div>
391
                        [% END %]
345
392
346
                        [% IF ( overdues_count ) %]
393
                        [% IF ( overdues_count ) %]
347
                            <div id="opac-user-overdues">
394
                            <div id="opac-user-overdues">
Lines 663-669 Link Here
663
            $(".js-hide").hide();
710
            $(".js-hide").hide();
664
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
711
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
665
            $(".suspend-until").prop("readonly",1);
712
            $(".suspend-until").prop("readonly",1);
666
            var dTables = $("#checkoutst,#holdst,#overduest");
713
714
            var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
667
            dTables.each(function(){
715
            dTables.each(function(){
668
                var thIndex = $(this).find("th.psort").index();
716
                var thIndex = $(this).find("th.psort").index();
669
                $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
717
                $(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 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 120-125 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
120
<div id="opac-user-views" class="toptabs">
121
<div id="opac-user-views" class="toptabs">
121
        <ul>
122
        <ul>
122
            <li><a href="#opac-user-checkouts">Checked out</a></li>
123
            <li><a href="#opac-user-checkouts">Checked out</a></li>
124
            [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
123
            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue</a></li>[% END %]
125
            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue</a></li>[% END %]
124
[% IF ( OPACFinesTab ) %]
126
[% IF ( OPACFinesTab ) %]
125
            [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines</a></li>[% END %]
127
            [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines</a></li>[% END %]
Lines 299-304 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
299
        [% END %]
301
        [% END %]
300
    [% END %]
302
    [% END %]
301
303
304
    [% IF relatives %]
305
        <div id="opac-user-relative-issues">
306
            <table id="opac-user-relative-issues-table">
307
                <thead>
308
                    <tr>
309
                        <th class="anti-the">Title</th>
310
                        <th>Due</th>
311
                        <th>Barcode</th>
312
                        <th>Call No.</th>
313
                        <th class="psort">Relative</th>
314
                    </tr>
315
                </thead>
316
317
                <tbody>
318
                    [% FOREACH r IN relatives %]
319
                        [% FOREACH i IN r.issues %]
320
                            <tr>
321
                                <td>
322
                                    <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% i.item.biblio.biblionumber %]">
323
                                        [% i.item.biblio.title | $EncodeUTF8 %]
324
                                    </a>
325
                                </td>
326
327
                                <td>
328
                                    [% i.date_due | $KohaDates %]
329
                                </td>
330
331
                                <td>
332
                                    [% i.item.barcode %]
333
                                </td>
334
335
                                <td>
336
                                    [% i.item.itemcallnumber | $EncodeUTF8 %]
337
                                </td>
338
339
                                <td>
340
                                    [% r.firstname | $EncodeUTF8 %] [% r.surname | $EncodeUTF8 %]
341
                                </td>
342
                            </tr>
343
                        [% END %]
344
                    [% END %]
345
                </tbody>
346
            </table>
347
        </div>
348
    [% END %]
349
302
[% IF ( overdues_count ) %]
350
[% IF ( overdues_count ) %]
303
<div id="opac-user-overdues"><table id="overduest">
351
<div id="opac-user-overdues"><table id="overduest">
304
<caption>Overdues <span class="count">([% overdues_count %] total)</span></caption>
352
<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 365-382 if ( $borr->{'opacnote'} ) { Link Here
365
  );
366
  );
366
}
367
}
367
368
369
my @borrowernumbers = GetMemberRelatives($borrowernumber);
370
if ( @borrowernumbers ) {
371
    my @relatives = Koha::Database->new()->schema()->resultset("Borrower")->search(
372
        { privacy_relative_checkouts => 1,  'me.borrowernumber' => { -in => \@borrowernumbers, } },
373
        { prefetch => [ { 'issues' => { 'item' => 'biblio' } } ] }
374
    );
375
    $template->param( relatives => \@relatives );
376
}
377
368
$template->param(
378
$template->param(
369
    bor_messages_loop    => GetMessages( $borrowernumber, 'B', 'NONE' ),
379
    borrower           => $borr,
380
    bor_messages_loop  => GetMessages( $borrowernumber, 'B', 'NONE' ),
370
    waiting_count      => $wcount,
381
    waiting_count      => $wcount,
371
    patronupdate => $patronupdate,
382
    patronupdate       => $patronupdate,
372
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
383
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
373
    userview => 1,
384
    userview           => 1,
374
);
385
    SuspendHoldsOpac   => C4::Context->preference('SuspendHoldsOpac'),
375
386
    OpacHoldNotes      => C4::Context->preference('OpacHoldNotes'),
376
$template->param(
387
    AutoResumeSuspendedHolds =>
377
    SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
388
      C4::Context->preference('AutoResumeSuspendedHolds'),
378
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
379
    OpacHoldNotes => C4::Context->preference('OpacHoldNotes'),
380
);
389
);
381
390
382
output_html_with_http_headers $query, $cookie, $template->output;
391
output_html_with_http_headers $query, $cookie, $template->output;
383
- 

Return to bug 9303