push @EXPORT, qw(
&ModMember
&changepassword
- &ModPrivacy
);
#Delete data
my ($reserve_id) = @_;
my $dbh = C4::Context->dbh;
+
my $query = "SELECT * FROM reserves WHERE reserve_id = ?";
my $sth = $dbh->prepare( $query );
$sth->execute( $reserve_id );
no: "Don't allow"
- patrons to choose their own privacy settings for their reading history. This requires opacreadinghistory and AnonymousPatron
-
+ - pref: AllowPatronToSetCheckoutsVisibilityForGuarantor
+ default: 0
+ choices:
+ yes: Allow
+ no: "Don't allow"
+ - patrons to choose their own privacy settings for showing the patron's checkouts to the patron's guarantor".
+ -
- Use borrowernumber
- pref: AnonymousPatron
class: integer
no: "Don't"
- enable the ability to upload and attach arbitrary files to a borrower record.
-
+ - pref: AllowStaffToSetCheckoutsVisibilityForGuarantor
+ choices:
+ yes: Allow
+ no: "Don't allow"
+ - staff to set the ability for a patron's checkouts to be viewed by linked patrons in the OPAC.
+ -
- Card numbers for patrons must be
- pref: CardnumberLength
- "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')."
[% USE Koha %]
[% USE KohaDates %]
+[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patrons › [% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] patron [% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]([%IF ( categoryname ) %][% categoryname %][% ELSE %][% IF ( I ) %]Organization[% END %][% IF ( A ) %]Adult[% END %][% IF ( C ) %]Child[% END %][% IF ( P ) %]Professional[% END %][% IF ( S ) %]Staff[% END %][% END %])</title>
[% INCLUDE 'doc-head-close.inc' %]
[% END %]
<input id="guarantordelete" type="button" value="Delete" />
</li>
+ [% IF guarantorid && Koha.Preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') %]
+ <li>
+ <label for="privacy_guarantor_checkouts">Show checkouts to guarantor</label>
+ <select name="privacy_guarantor_checkouts" id="privacy_guarantor_checkouts">
+ [% IF privacy_guarantor_checkouts %]
+ <option value="0">No</option>
+ <option value="1" selected>Yes</option>
+ [% ELSE %]
+ <option value="0" selected>No</option>
+ <option value="1">Yes</option>
+ [% END %]
+ </select>
+ <div class="hint">Allow guarantor of this patron to view this patron's checkouts from the OPAC</div>
+ </li>
+ [% END %]
</ol>
</fieldset>
[% IF ( privacy1 ) %]Default[% END %]
[% IF ( privacy2 ) %]Never[% END %]
</li>[% END %]
+
+ <li>
+ <span class="label">Show checkouts to guarantor</span>
+ [% IF privacy_guarantor_checkouts %]
+ Yes
+ [% ELSE %]
+ No
+ [% END %]
+ </li>
+
[% IF ( sort1 ) %]<li><span class="label">Sort field 1:</span>[% lib1 %]</li>[% END %]
[% IF ( sort2 ) %]<li><span class="label">Sort field 2:</span>[% lib2 %]</li>[% END %]
<li><span class="label">Username: </span>[% userid %]</li>
<div class="alert">You typed in the wrong characters in the box before submitting. Please try again.</div>
[% END %]
+ [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
+ <fieldset class="rows" id="memberentry_privacy">
+ <legend id="privacy_legend">Privacy</legend>
+ <ol>
+ <li>
+ <label>Allow your guarantor to view your current checkouts?</label>
+ <select id="privacy_guarantor_checkouts">
+ <option value="0">No</option>
+ [% IF borrower.privacy_guarantor_checkouts %]
+ <option value="1" selected="selected">Yes</option>
+ [% ELSE %]
+ <option value="1">Yes</option>
+ [% END %]
+ </select>
+ <span class="hint">
+ <a id="update_privacy_guarantor_checkouts" href="#" class="btn">Update</a>
+ <span id="update_privacy_guarantor_checkouts_message" class="alert" style="display:none"></span>
+ </span>
+ <span class="hint">
+ [% SET g = Koha.Find('Borrower',borrower.guarantorid) %]
+ Your guarantor is <i>[% g.firstname %] [% g.surname %]</i>
+ </span>
+ </li>
+ </ol>
+ </fieldset>
+ [% END %]
+
<form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form">
[% UNLESS hidden.defined('branchcode') %]
[% ELSE %]
$( "#borrower_dateofbirth" ).datepicker({ yearRange: "c-120:c" });
[% END %]
+
$("#memberentry-form").validate({
rules: {
borrower_email: {
error.css('width', 'auto');
}
});
+
+ [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
+ $('#update_privacy_guarantor_checkouts').click( function() {
+ $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_guarantor_checkouts: $('#privacy_guarantor_checkouts').val() }, null, 'json')
+ .done(function( data ) {
+ var message;
+ if ( data.success ) {
+ message = _("Your setting has been updated!");
+ } else {
+ message = _("Unable to update your setting!");
+ }
+
+ $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
+ });
+ });
+ [% END %]
});
//]]>
</script>
<input type="hidden" name="op" value="update_privacy" />
<fieldset>
<label for="privacy">Please choose your privacy rule:</label>
- <div class="input-append">
+ <div>
<select name="privacy" id="privacy">
[% IF ( privacy0 ) %]
<option value="0" selected="selected" class="privacy0">Forever</option>
<option value="2" class="privacy2">Never</option>
[% END %]
</select>
- <button type="Submit" class="btn">Submit</button>
</div>
+
+ [% SET b = Koha.Find('Borrower', borrower.borrowernumber) %]
+ [% IF b.guarantorid && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
+ <div>
+ <label for="privacy_guarantor_checkouts">Allow your guarantor to view your current checkouts?</label>
+ <select name="privacy_guarantor_checkouts">
+ [% IF borrower.privacy_guarantor_checkouts %]
+ <option value="0">No</option>
+ <option value="1" selected>Yes</option>
+ [% ELSE %]
+ <option value="0" selected>No</option>
+ <option value="1">Yes</option>
+ [% END %]
+ </select>
+ <span class="hint">
+ Your guarantor is <i>[% b.guarantor.firstname %] [% b.guarantor.surname %]</i>
+ </span>
+ </div>
+ [% END %]
+
+ <button type="Submit" class="btn">Save</button>
</fieldset>
</form>
<h2>Immediate deletion</h2>
<div id="opac-user-views" class="toptabs">
<ul>
<li><a href="#opac-user-checkouts">Checked out ([% issues_count %])</a></li>
+ [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
[% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count %])</a></li>[% END %]
[% IF ( OPACFinesTab ) %]
[% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% BORROWER_INF.amountoutstanding %])</a></li>[% END %]
[% IF ( show_barcode ) %]
<th>Barcode</th>
[% END %]
- <th>Call No.</th>
+ <th>Call number</th>
[% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
<th class="nosort">Renew</th>
[% END %]
[% END %]
[% END # / OPACFinesTab %]
+ [% IF relatives %]
+ <div id="opac-user-relative-issues">
+ <table id="opac-user-relative-issues-table" class="table table-bordered table-striped">
+ <thead>
+ <tr>
+ <th class="anti-the">Title</th>
+ <th>Due</th>
+ <th>Barcode</th>
+ <th>Call number</th>
+ <th class="psort">Relative</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ [% FOREACH r IN relatives %]
+ [% FOREACH i IN r.issues %]
+ <tr>
+ <td>
+ <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% i.item.biblio.biblionumber %]">
+ [% i.item.biblio.title %]
+ </a>
+ </td>
+
+ <td>
+ [% i.date_due | $KohaDates %]
+ </td>
+
+ <td>
+ [% i.item.barcode %]
+ </td>
+
+ <td>
+ [% i.item.itemcallnumber %]
+ </td>
+
+ <td>
+ [% r.firstname %] [% r.surname %]
+ </td>
+ </tr>
+ [% END %]
+ [% END %]
+ </tbody>
+ </table>
+ </div>
+ [% END %]
+
[% IF ( overdues_count ) %]
<div id="opac-user-overdues">
<table id="overduest" class="table table-bordered table-striped">
<th class="anti-the">Title</th>
[% UNLESS ( item_level_itypes ) %]<th>Item type</th> [% END %]
[% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
- <th>Call no.</th>
+ <th>Call number</th>
<th class="title-string psort">Due</th>
[% IF ( OpacRenewalAllowed ) %]
<th class="nosort">Renew</th>
$(".js-hide").hide();
$(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
$(".suspend-until").prop("readonly",1);
- var dTables = $("#checkoutst,#holdst,#overduest");
+
+ var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
dTables.each(function(){
var thIndex = $(this).find("th.psort").index();
$(this).dataTable($.extend(true, {}, dataTablesDefaults, {
is_child => ($category_type eq 'C'),
samebranch => $samebranch,
quickslip => $quickslip,
+ privacy_guarantor_checkouts => $data->{'privacy_guarantor_checkouts'},
activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'),
}
);
-my $op = $query->param("op");
-my $privacy = $query->param("privacy");
+my $op = $query->param("op");
+my $privacy = $query->param("privacy");
+my $privacy_guarantor_checkouts = $query->param("privacy_guarantor_checkouts");
-if ($op eq "update_privacy")
-{
- ModPrivacy($borrowernumber,$privacy);
- $template->param('privacy_updated' => 1);
+if ( $op eq "update_privacy" ) {
+ ModMember(
+ borrowernumber => $borrowernumber,
+ privacy => $privacy,
+ privacy_guarantor_checkouts => $privacy_guarantor_checkouts,
+ );
+ $template->param( 'privacy_updated' => 1 );
}
-if ($op eq "delete_record") {
+elsif ( $op eq "delete_record" ) {
+
# delete all reading records for items returned
# uses a hardcoded date ridiculously far in the future
- my ($rows,$err_history_not_deleted) = AnonymiseIssueHistory('2999-12-12',$borrowernumber);
+ my ( $rows, $err_history_not_deleted ) =
+ AnonymiseIssueHistory( '2999-12-12', $borrowernumber );
+
# confirm the user the deletion has been done
if ( !$err_history_not_deleted ) {
$template->param( 'deleted' => 1 );
}
# get borrower privacy ....
-my $borr = C4::Members::GetMember( borrowernumber => $borrowernumber );
+my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber );
-$template->param( 'Ask_data' => '1',
- 'privacy'.$borr->{'privacy'} => 1,
- 'firstname' => $borr->{'firstname'},
- 'surname' => $borr->{'surname'},
- 'privacyview' => 1,
+$template->param(
+ 'Ask_data' => 1,
+ 'privacy' . $borrower->{'privacy'} => 1,
+ 'privacyview' => 1,
+ 'borrower' => $borrower,
+ 'surname' => $borrower->{surname},
+ 'firstname' => $borrower->{firstname},
);
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
use Koha::DateUtils;
use Koha::Borrower::Debarments qw(IsDebarred);
use Koha::Holds;
+use Koha::Database;
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
);
}
+if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor')
+ || C4::Context->preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') )
+{
+ my @relatives =
+ Koha::Database->new()->schema()->resultset("Borrower")->search(
+ {
+ privacy_guarantor_checkouts => 1,
+ 'me.guarantorid' => $borrowernumber
+ },
+ { prefetch => [ { 'issues' => { 'item' => 'biblio' } } ] }
+ );
+ $template->param( relatives => \@relatives );
+}
+
$template->param(
+ borrower => $borr,
bor_messages_loop => GetMessages( $borrowernumber, 'B', 'NONE' ),
patronupdate => $patronupdate,
OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),