Bugzilla – Attachment 27539 Details for
Bug 9303
relative's checkouts in the opac
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9303 [3] - relative's checkouts in the opac
Bug-9303-3---relatives-checkouts-in-the-opac.patch (text/plain), 20.08 KB, created by
Kyle M Hall (khall)
on 2014-04-24 14:32:22 UTC
(
hide
)
Description:
Bug 9303 [3] - relative's checkouts in the opac
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-04-24 14:32:22 UTC
Size:
20.08 KB
patch
obsolete
>From f0e84ebfab1187244cfd25a1b2336d6663ba8bd2 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 13 Dec 2013 12:41:54 -0500 >Subject: [PATCH] Bug 9303 [3] - relative's checkouts in the opac > >Signed-off-by: Joel Sasse <jsasse@plumcreeklibrary.net> > >Signed-off-by: Heather Braum <hbraum@nekls.org> >--- > C4/Members.pm | 26 ---------- > C4/Reserves.pm | 14 +++++- > .../prog/en/modules/members/memberentrygen.tt | 13 +++++ > .../opac-tmpl/bootstrap/en/modules/opac-privacy.tt | 18 ++++++- > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 50 +++++++++++++++++++- > .../opac-tmpl/prog/en/modules/opac-privacy.tt | 21 +++++++- > koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 50 +++++++++++++++++++- > opac/opac-privacy.pl | 38 +++++++++------ > opac/opac-user.pl | 27 +++++++---- > 9 files changed, 201 insertions(+), 56 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 1d098c5..67e0213 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -109,7 +109,6 @@ BEGIN { > push @EXPORT, qw( > &ModMember > &changepassword >- &ModPrivacy > ); > > #Delete data >@@ -2136,31 +2135,6 @@ sub GetBorrowersNamesAndLatestIssue { > return $results; > } > >-=head2 ModPrivacy >- >-=over 4 >- >-my $success = ModPrivacy( $borrowernumber, $privacy ); >- >-Update the privacy of a patron. >- >-return : >-true on success, false on failure >- >-=back >- >-=cut >- >-sub ModPrivacy { >- my $borrowernumber = shift; >- my $privacy = shift; >- return unless defined $borrowernumber; >- return unless $borrowernumber =~ /^\d+$/; >- >- return ModMember( borrowernumber => $borrowernumber, >- privacy => $privacy ); >-} >- > =head2 AddMessage > > AddMessage( $borrowernumber, $message_type, $message, $branchcode ); >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 49f8c11..92bf3d6 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -260,10 +260,22 @@ 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 ); >- return $sth->fetchrow_hashref(); >+ my $res = $sth->fetchrow_hashref(); >+ >+ unless ($res) { >+ $query = "SELECT * FROM old_reserves WHERE reserve_id = ?"; >+ $sth = $dbh->prepare($query); >+ $sth->execute($reserve_id); >+ $res = $sth->fetchrow_hashref(); >+ } >+ >+ carp("No hold for for reserve_id $reserve_id") unless $res; >+ >+ return $res; > } > > =head2 GetReservesFromBiblionumber >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 694432e..377928b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1178,6 +1178,19 @@ > [% END %] > [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %] > </li> >+ <li> >+ <label for="privacy_relative_checkouts">Show checkouts to relatives</label> >+ <select name="privacy_relative_checkouts" id="privacy_relative_checkouts"> >+ [% IF privacy_relative_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 linked patron accounts to view this patron's checkouts from the OPAC</div> >+ </li> > </ol> > </fieldset> > [% END # hide fieldset %][% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt >index bc731cd..7c894d5 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt >@@ -48,7 +48,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> >@@ -66,8 +66,22 @@ > <option value="2" class="privacy2">Never</option> > [% END %] > </select> >- <button type="Submit" class="btn">Submit</button> > </div> >+ >+ <div> >+ <label for="privacy_relative_checkouts">Allow relatives to view your current checkouts?</label> >+ <select name="privacy_relative_checkouts"> >+ [% IF borrower.privacy_relative_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> >+ >+ <button type="Submit" class="btn">Save</button> > </fieldset> > </form> > <h2>Immediate deletion</h2> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 95c597c..c01cec5 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -1,5 +1,6 @@ > [% USE Koha %] > [% USE KohaDates %] >+[% USE EncodeUTF8 %] > > [% INCLUDE 'doc-head-open.inc' %] > [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your library home >@@ -86,6 +87,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 %] >@@ -342,6 +344,51 @@ > </div> <!-- /#opac-user-waiting --> > [% END # waiting_count && atdestination %] > >+ [% 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 No.</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 | $EncodeUTF8 %] >+ </a> >+ </td> >+ >+ <td> >+ [% i.date_due | $KohaDates %] >+ </td> >+ >+ <td> >+ [% i.item.barcode %] >+ </td> >+ >+ <td> >+ [% i.item.itemcallnumber | $EncodeUTF8 %] >+ </td> >+ >+ <td> >+ [% r.firstname | $EncodeUTF8 %] [% r.surname | $EncodeUTF8 %] >+ </td> >+ </tr> >+ [% END %] >+ [% END %] >+ </tbody> >+ </table> >+ </div> >+ [% END %] > > [% IF ( overdues_count ) %] > <div id="opac-user-overdues"> >@@ -663,7 +710,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, { >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt >index 1106973..632c9c7 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt >@@ -35,7 +35,8 @@ > </div> > <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-update-form"> > <input type="hidden" name="op" value="update_privacy" /> >- <label for:"privacy">Please choose your privacy rule:</label> >+ >+ <label for="privacy">Please choose your privacy rule:</label> > <select name="privacy"> > [% IF ( privacy0 ) %] > <option value="0" selected="1" class="privacy0">Forever</option> >@@ -53,7 +54,23 @@ > <option value="2" class="privacy2">Never</option> > [% END %] > </select> >- <input type="Submit" value="Submit" /> >+ >+ <p/> >+ >+ <label for="privacy_relative_checkouts">Allow relatives to view your current checkouts?</label> >+ <select name="privacy_relative_checkouts"> >+ [% IF borrower.privacy_relative_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> >+ >+ <p/> >+ >+ <input type="Submit" value="Save" /> > </form> > <h2>Immediate deletion</h2> > <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-delete-form"> >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >index e9fe2d2..ee8cdce 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >@@ -1,5 +1,6 @@ > [% USE Koha %] > [% USE KohaDates %] >+[% USE EncodeUTF8 %] > [% INCLUDE 'doc-head-open.inc' %] > [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your library home > [% INCLUDE 'doc-head-close.inc' %] >@@ -14,7 +15,7 @@ var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended > $(function() { > $('#opac-user-views').tabs(); > >- 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, { >@@ -120,6 +121,7 @@ var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended > <div id="opac-user-views" class="toptabs"> > <ul> > <li><a href="#opac-user-checkouts">Checked out</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</a></li>[% END %] > [% IF ( OPACFinesTab ) %] > [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines</a></li>[% END %] >@@ -299,6 +301,52 @@ var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended > [% END %] > [% END %] > >+ [% IF relatives %] >+ <div id="opac-user-relative-issues"> >+ <table id="opac-user-relative-issues-table"> >+ <thead> >+ <tr> >+ <th class="anti-the">Title</th> >+ <th>Due</th> >+ <th>Barcode</th> >+ <th>Call No.</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 | $EncodeUTF8 %] >+ </a> >+ </td> >+ >+ <td> >+ [% i.date_due | $KohaDates %] >+ </td> >+ >+ <td> >+ [% i.item.barcode %] >+ </td> >+ >+ <td> >+ [% i.item.itemcallnumber | $EncodeUTF8 %] >+ </td> >+ >+ <td> >+ [% r.firstname | $EncodeUTF8 %] [% r.surname | $EncodeUTF8 %] >+ </td> >+ </tr> >+ [% END %] >+ [% END %] >+ </tbody> >+ </table> >+ </div> >+ [% END %] >+ > [% IF ( overdues_count ) %] > <div id="opac-user-overdues"><table id="overduest"> > <caption>Overdues <span class="count">([% overdues_count %] total)</span></caption> >diff --git a/opac/opac-privacy.pl b/opac/opac-privacy.pl >index 22fe694..c41e394 100755 >--- a/opac/opac-privacy.pl >+++ b/opac/opac-privacy.pl >@@ -40,18 +40,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_relative_checkouts = $query->param("privacy_relative_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_relative_checkouts => $privacy_relative_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 ); >@@ -60,14 +67,17 @@ if ($op eq "delete_record") { > $template->param( 'err_history_not_deleted' => 1 ); > } > } >+ > # get borrower privacy .... >-my ( $borr ) = GetMemberDetails( $borrowernumber ); >+my $borrower = GetMemberDetails( $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; >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 7ca64bd..30a5dda 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -35,6 +35,7 @@ use C4::Items; > use C4::Letters; > use C4::Branch; # GetBranches > use Koha::DateUtils; >+use Koha::Database; > > use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; > >@@ -365,18 +366,26 @@ if ( $borr->{'opacnote'} ) { > ); > } > >+my @borrowernumbers = GetMemberRelatives($borrowernumber); >+if ( @borrowernumbers ) { >+ my @relatives = Koha::Database->new()->schema()->resultset("Borrower")->search( >+ { privacy_relative_checkouts => 1, 'me.borrowernumber' => { -in => \@borrowernumbers, } }, >+ { prefetch => [ { 'issues' => { 'item' => 'biblio' } } ] } >+ ); >+ $template->param( relatives => \@relatives ); >+} >+ > $template->param( >- bor_messages_loop => GetMessages( $borrowernumber, 'B', 'NONE' ), >+ borrower => $borr, >+ bor_messages_loop => GetMessages( $borrowernumber, 'B', 'NONE' ), > waiting_count => $wcount, >- patronupdate => $patronupdate, >+ patronupdate => $patronupdate, > OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"), >- userview => 1, >-); >- >-$template->param( >- SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'), >- AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), >- OpacHoldNotes => C4::Context->preference('OpacHoldNotes'), >+ userview => 1, >+ SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'), >+ OpacHoldNotes => C4::Context->preference('OpacHoldNotes'), >+ AutoResumeSuspendedHolds => >+ C4::Context->preference('AutoResumeSuspendedHolds'), > ); > > output_html_with_http_headers $query, $cookie, $template->output; >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9303
:
22757
|
22770
|
22771
|
22772
|
22783
|
22789
|
22790
|
22809
|
22966
|
22967
|
22968
|
22974
|
22975
|
23086
|
23087
|
23088
|
23089
|
23090
|
23525
|
23526
|
23527
|
24009
|
24010
|
24011
|
24773
|
24774
|
24775
|
24776
|
25008
|
25584
|
25585
|
25586
|
27537
|
27538
|
27539
|
27540
|
27541
|
27542
|
27543
|
27698
|
27699
|
28153
|
28154
|
28155
|
28156
|
28157
|
28158
|
28159
|
28160
|
28161
|
28912
|
29171
|
29172
|
29215
|
29286
|
29287
|
29288
|
29289
|
29290
|
29299
|
29302
|
29303
|
29304
|
29932
|
29933
|
29934
|
29935
|
29936
|
29937
|
30287
|
30288
|
30289
|
30297
|
30298
|
30299
|
30300
|
32053
|
32054
|
32055
|
33049
|
34629
|
34630
|
34631
|
34632
|
34633
|
35519
|
35520
|
35521
|
35522
|
35523
|
35524
|
35525
|
35526
|
35527
|
35528
|
35529
|
35530
|
35531
|
35532
|
35678
|
35679
|
35680
|
35681
|
35682
|
35683
|
35684
|
35686
|
35687
|
35688
|
35689
|
35690
|
35691
|
35832
|
36287
|
36288
|
36289
|
37110
|
37111
|
37112
|
38264
|
38265
|
38266
|
38267
|
38328
|
38329
|
38330
|
38331
|
38446
|
38447
|
38448
|
38449
|
38450
|
38820
|
38821
|
38822
|
38823
|
38824
|
39042
|
39043
|
39044
|
39045
|
39046
|
39047
|
39048
|
39811
|
39817
|
39818
|
39819
|
39820
|
39821
|
39822
|
39823
|
44430
|
44431
|
44432
|
44433
|
44434
|
44435
|
44436
|
44511
|
44512
|
44513
|
44514
|
44515
|
44516
|
44517
|
46136
|
46137
|
46138
|
46139
|
46140
|
46141
|
46142