Bugzilla – Attachment 130259 Details for
Bug 29526
Add 'Immediately delete holds history' button to patron privacy tab in opac
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29526: Add a way for patrons to delete their hold history
Bug-29526-Add-a-way-for-patrons-to-delete-their-ho.patch (text/plain), 10.22 KB, created by
Martin Renvoize (ashimema)
on 2022-02-08 08:17:17 UTC
(
hide
)
Description:
Bug 29526: Add a way for patrons to delete their hold history
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-02-08 08:17:17 UTC
Size:
10.22 KB
patch
obsolete
>From bd746972112cb75e36e71e1cc3a0b8b6be860054 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 3 Jan 2022 11:53:32 -0300 >Subject: [PATCH] Bug 29526: Add a way for patrons to delete their hold history > >The same way we have a button to immediately delete the checkouts history in the OPAC, we should have a similar option for the holds history. > >This patch implements that. > >To test: >1. Have a patron with some old checkouts and old holds. >2. Have OPACPrivacy, OPACHoldsHistory and opacreadinghistory enabled. >3. Notice in the OPAC the patron has some old checkouts and holds. >4. Use the Privacy tab to clean checkouts >=> SUCCESS: They are still cleaned as before this patch >5. Try to clean the old holds >=> SUCCESS: They are cleaned! >6. Add some old checkouts and holds >7. Use the new 'All' button >=> SUCCESS: All cleaned >8. Sign off :-D > >Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../bootstrap/en/modules/opac-privacy.tt | 52 +++++++++++--- > opac/opac-privacy.pl | 71 ++++++++++++------- > 2 files changed, 90 insertions(+), 33 deletions(-) > >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 edeffaac19..adede9145a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt >@@ -37,12 +37,26 @@ > <div id="userprivacy" class="maincontent"> > <h1>Your privacy management</h1> > >- [% IF deleted %] >- <div class="alert alert-success">Your checkout history has been deleted.</div> >- [% ELSIF history_not_deleted %] >- <div class="alert alert-warning">The deletion of your checkout history failed, because there is a problem with the configuration of this feature. Please help to fix the system by informing your library of this error</div> >- [% ELSIF nothing_to_delete %] >- <div class="alert alert-warning">No checkout history to delete</div> >+ [% IF delete_all_requested || delete_checkouts_requested || delete_holds_requested %] >+ [% IF delete_all_requested || delete_checkouts_requested %] >+ [% IF deleted_checkouts %] >+ <div class="alert alert-success">Your checkout history has been deleted.</div> >+ [% ELSIF error_deleting_checkouts_history %] >+ <div class="alert alert-warning">The deletion of your checkout history failed, because there is a problem with the configuration of this feature. Please help to fix the system by informing your library of this error</div> >+ [% ELSIF no_checkouts_to_delete %] >+ <div class="alert alert-warning">No checkout history to delete</div> >+ [% END %] >+ [% END %] >+ >+ [% IF delete_all_requested || delete_holds_requested %] >+ [% IF deleted_holds %] >+ <div class="alert alert-success">Your hold history has been deleted.</div> >+ [% ELSIF error_deleting_holds_history %] >+ <div class="alert alert-warning">The deletion of your hold history failed. Please help to fix the system by informing your library of this error</div> >+ [% ELSIF no_holds_to_delete %] >+ <div class="alert alert-warning">No hold history to delete</div> >+ [% END %] >+ [% END %] > [% END %] > > [% IF ( privacy_updated ) %] >@@ -140,12 +154,32 @@ > > <h2>Immediate deletion</h2> > >+ <p>Whatever your privacy rule you choose, you can delete all your checkout and hold history immediately by clicking here. <strong>BE CAREFUL</strong>. Once you've confirmed the deletion, no one can retrieve the list!</p> >+ >+ <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-delete-form"> >+ <legend class="sr-only">Checkout history deletion</legend> >+ <input type="hidden" name="op" value="delete_record" /> >+ <input type="hidden" name="checkouts" value="1" /> >+ <fieldset class="action"> >+ <input type="submit" value="Checkout history" class="btn btn-danger" onclick="return confirmDelete(MSG_CONFIRM_AGAIN);" /> >+ </fieldset> >+ </form> >+ >+ <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-delete-form"> >+ <legend class="sr-only">Hold history deletion</legend> >+ <input type="hidden" name="op" value="delete_record" /> >+ <input type="hidden" name="holds" value="1" /> >+ <fieldset class="action"> >+ <input type="submit" value="Hold history" class="btn btn-danger" onclick="return confirmDelete(MSG_CONFIRM_AGAIN);" /> >+ </fieldset> >+ </form> >+ > <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-delete-form"> >- <legend class="sr-only">Immediate deletion</legend> >+ <legend class="sr-only">Checkout and hold history deletion</legend> > <input type="hidden" name="op" value="delete_record" /> >- <p>Whatever your privacy rule you choose, you can delete all your checkout history immediately by clicking here. <strong>BE CAREFUL</strong>. Once you've confirmed the deletion, no one can retrieve the list!</p> >+ <input type="hidden" name="all" value="1" /> > <fieldset class="action"> >- <input type="submit" value="Immediate deletion" class="btn btn-danger" onclick="return confirmDelete(MSG_CONFIRM_AGAIN);" /> >+ <input type="submit" value="Checkout and hold history" class="btn btn-danger" onclick="return confirmDelete(MSG_CONFIRM_AGAIN);" /> > </fieldset> > </form> > >diff --git a/opac/opac-privacy.pl b/opac/opac-privacy.pl >index 8ea6b12066..2c96b7ffa9 100755 >--- a/opac/opac-privacy.pl >+++ b/opac/opac-privacy.pl >@@ -32,8 +32,6 @@ if ( ! C4::Context->preference('OPACPrivacy') || ! C4::Context->preference('opac > exit; > } > >-my $dbh = C4::Context->dbh; >- > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { > template_name => "opac-privacy.tt", >@@ -42,13 +40,14 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > } > ); > >+my $patron = Koha::Patrons->find( $borrowernumber ); >+ > my $op = $query->param("op"); > my $privacy = $query->param("privacy"); > my $privacy_guarantor_checkouts = $query->param("privacy_guarantor_checkouts"); > my $privacy_guarantor_fines = $query->param("privacy_guarantor_fines"); > > if ( $op eq "update_privacy" ) { >- my $patron = Koha::Patrons->find( $borrowernumber ); > if ( $patron ) { > $patron->set({ > privacy => $privacy, >@@ -60,30 +59,54 @@ if ( $op eq "update_privacy" ) { > } > elsif ( $op eq "delete_record" ) { > >- # delete all reading records for items returned >- my $rows = eval { >- Koha::Patrons->search({ 'me.borrowernumber' => $borrowernumber })->anonymise_issue_history; >- }; >- $template->param( >- ( >- $@ ? ( history_not_deleted => 1 ) >- : $rows ? ( deleted => int($rows) ) >- : ( nothing_to_delete => 1 ) >- ) >- ); >-} >+ my $holds = $query->param('holds'); >+ my $checkouts = $query->param('checkouts'); >+ my $all = $query->param('all'); >+ >+ $template->param( delete_all_quested => 1 ) >+ if $all; >+ >+ if ( $all or $checkouts ) { >+ >+ # delete all reading records for items returned >+ my $rows = eval { >+ Koha::Patrons->search( { 'me.borrowernumber' => $borrowernumber } ) >+ ->anonymise_issue_history; >+ }; > >-# get borrower privacy .... >-my $borrower = Koha::Patrons->find( $borrowernumber );; >+ $template->param( >+ ( >+ $@ ? ( error_deleting_checkouts_history => 1 ) >+ : $rows ? ( deleted_checkouts => int($rows) ) >+ : ( no_checkouts_to_delete => 1 ) >+ ), >+ delete_checkouts_requested => 1, >+ ); >+ } >+ >+ if ( $all or $holds ) { >+ >+ my $rows = eval { $patron->old_holds->anonymize + 0 }; >+ >+ $template->param( >+ ( >+ $@ ? ( error_deleting_holds_history => 1 ) >+ : $rows ? ( deleted_holds => int($rows) ) >+ : ( no_holds_to_delete => 1 ) >+ ), >+ delete_holds_requested => 1, >+ ); >+ } >+} > > $template->param( >- 'Ask_data' => 1, >- 'privacy' . $borrower->privacy() => 1, >- 'privacyview' => 1, >- 'borrower' => $borrower, >- 'surname' => $borrower->surname, >- 'firstname' => $borrower->firstname, >- 'has_guarantor_flag' => $borrower->guarantor_relationships->guarantors->_resultset->count >+ 'Ask_data' => 1, >+ 'privacy' . $patron->privacy() => 1, >+ 'privacyview' => 1, >+ 'borrower' => $patron, >+ 'surname' => $patron->surname, >+ 'firstname' => $patron->firstname, >+ 'has_guarantor_flag' => $patron->guarantor_relationships->guarantors->_resultset->count > ); > > output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >-- >2.20.1
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 29526
:
128967
|
128974
|
128982
|
129027
|
129028
|
129029
| 130259 |
130260
|
130261