Browse Source

Bug 9303 [3] - relative's checkouts in the opac

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
new_12478_elasticsearch
Kyle Hall 9 years ago
parent
commit
3ebf343af6
  1. 1
      C4/Members.pm
  2. 1
      C4/Reserves.pm
  3. 7
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
  4. 6
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
  5. 16
      koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
  6. 10
      koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
  7. 44
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt
  8. 24
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt
  9. 54
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
  10. 1
      members/moremember.pl
  11. 37
      opac/opac-privacy.pl
  12. 16
      opac/opac-user.pl

1
C4/Members.pm

@ -115,7 +115,6 @@ BEGIN {
push @EXPORT, qw(
&ModMember
&changepassword
&ModPrivacy
);
#Delete data

1
C4/Reserves.pm

@ -261,6 +261,7 @@ sub GetReserve {
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 );

7
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref

@ -588,6 +588,13 @@ OPAC:
yes: Allow
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

6
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref

@ -136,6 +136,12 @@ Patrons:
yes: Do
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

16
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt

@ -1,5 +1,6 @@
[% USE Koha %]
[% USE KohaDates %]
[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Patrons &rsaquo; [% 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' %]
@ -490,6 +491,21 @@
[% 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>

10
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt

@ -355,6 +355,16 @@ function validate1(date) {
[% 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>

44
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt

@ -70,6 +70,33 @@
<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') %]
@ -822,6 +849,7 @@
[% ELSE %]
$( "#borrower_dateofbirth" ).datepicker({ yearRange: "c-120:c" });
[% END %]
$("#memberentry-form").validate({
rules: {
borrower_email: {
@ -853,6 +881,22 @@
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>

24
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt

@ -49,7 +49,7 @@
<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>
@ -67,8 +67,28 @@
<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>

54
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt

@ -110,6 +110,7 @@
<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 %]
@ -137,7 +138,7 @@
[% 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 %]
@ -332,6 +333,52 @@
[% 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">
@ -343,7 +390,7 @@
<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>
@ -671,7 +718,8 @@
$(".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, {

1
members/moremember.pl

@ -348,6 +348,7 @@ $template->param(
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'),

37
opac/opac-privacy.pl

@ -45,18 +45,25 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
}
);
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 );
@ -67,13 +74,15 @@ if ($op eq "delete_record") {
}
# 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 };

16
opac/opac-user.pl

@ -37,6 +37,7 @@ use C4::Branch; # GetBranches
use Koha::DateUtils;
use Koha::Borrower::Debarments qw(IsDebarred);
use Koha::Holds;
use Koha::Database;
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
@ -317,7 +318,22 @@ if ( $borr->{'opacnote'} ) {
);
}
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"),

Loading…
Cancel
Save