7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › Tools › Batch patron deletion and anonymization [% IF step == 2 %]› Confirm[% END %][% IF step == 3 %]› Finished[% END %]</title>
9 [% INCLUDE 'doc-head-close.inc' %]
12 <body id="tools_cleanborrowers" class="tools">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
16 <div id="breadcrumbs">
17 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
18 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
20 Batch patron deletion and anonymization
22 <a href="/cgi-bin/koha/tools/cleanborrowers.pl">Batch patron deletion and anonymization</a> ›
24 [% IF step == 2 %] Confirm [% END %]
25 [% IF step == 3 %] Finished [% END %]
28 <div class="main container-fluid">
30 <div class="col-sm-10 col-sm-push-2">
34 [% IF current_branch == '*' %]
35 <h1>Batch patron deletion and anonymization</h1>
37 <h1>Batch patron deletion and anonymization for [% Branches.GetName( current_branch ) | html %]</h1>
40 <form method="get" action="/cgi-bin/koha/tools/cleanborrowers.pl" id="selectlibrary">
42 <select name="branch" id="branch" style="width:20em;">
43 <option value="*">All libraries</option>
44 [% FOREACH branch IN Branches.all( selected => current_branch ) %]
45 [% IF branch.selected %]
46 <option value="[% branch.branchcode | html %]" selected="selected">[% branch.branchname | html %]</option>
48 <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
55 <h1>Batch patron deletion and anonymization for [% Branches.GetLoggedInBranchname | html %]</h1>
62 <p>This tool allows you to delete patrons and anonymize checkout history. For deleting patrons, any combination of limits can be used. Patrons will not be deleted if they meet one or more of the following conditions:</p>
64 <li>They have items currently checked out.</li>
65 <li>They have a non-zero account balance.</li>
66 <li>They are the guarantor to another patron.</li>
67 <li>They are in a patron category of type staff.</li>
71 <form name="f1" id="delete_patrons_form" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post">
73 <legend>Delete patrons</legend>
74 <h3><input id="checkborrower" type="checkbox" name="checkbox" value="borrower" /><label for="checkborrower"> Verify you want to delete patrons</label></h3>
76 <h5>Delete patrons who meet the following criteria:</h5>
79 <label for="date1">who have not borrowed since:</label>
80 <input size="10" id="date1" name="not_borrowed_since" type="text" class="datepicker" />
81 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
84 <label for="borrower_dateexpiry">whose expiration date is before:</label>
85 <input size="10" id="borrower_dateexpiry" name="borrower_dateexpiry" type="text" class="datepicker" />
86 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
88 [% IF Koha.Preference('TrackLastPatronActivity') %]
90 <label for="borrower_lastseen">who have not been connected since:</label>
91 <input size="10" id="borrower_lastseen" name="borrower_lastseen" type="text" class="datepicker" />
92 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
96 <label for="borrower_categorycode">whose patron category is:</label>
97 <select id="borrower_categorycode" name="borrower_categorycode">
98 <option value="" selected="selected">Any</option>
99 [% FOREACH bc IN borrower_categorycodes %]
100 [% UNLESS bc.category_type == 'S' %]
101 <option value="[% bc.categorycode | html %]">[% bc.description | html %]</option>
106 [% IF patron_lists %]
108 <label for="patron_list_id">who are in patron list: </label>
109 <select id="patron_list_id" name="patron_list_id">
110 <option value=""></option>
111 [% FOREACH pl IN patron_lists %]
112 <option value="[% pl.patron_list_id | html %]">[% pl.name | html %]</option>
121 <legend>Anonymize checkout history</legend>
122 [% UNLESS Koha.Preference('AnonymousPatron') %]
123 <div class="dialog message">The AnonymousPatron system preference is not defined. You can use this feature anyway but NULL will be used to update the checkout history.</div>
125 <h3><input id="checkissue" type="checkbox" name="checkbox" value="issue" /><label for="checkissue"> Verify you want to anonymize patron checkout history</label></h3>
129 <label for="date2">Permanently delete checkout history older than</label>
130 <input size="10" id="date2" name="last_issue_date" type="text" class="datepicker" />
131 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
136 <input type="hidden" name="step" value="2" />
137 <input type="hidden" name="branch" value="[% current_branch | html %]" />
139 <fieldset class="action"><input type="submit" value="Next >>" /></fieldset>
146 <!-- STEP 2 START -->
148 <form name="f2" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post">
150 <div class="dialog alert">
153 <li>[% patrons_to_delete.size || 0 | html %] patrons will be deleted</li>
154 <li>[% patrons_to_anonymize.count || 0 | html %] patrons' checkout histories will be anonymized</li>
158 [% IF patrons_to_delete.size %]
160 <legend>How should patrons be deleted?</legend>
162 <input id="delete" type="radio" name="radio" value="delete" />
163 <label for="delete">Permanently delete these patrons</label>
165 Delete patrons directly from the database. Patron data will not be recoverable.
169 <input id="trash" type="radio" name="radio" value="trash" />
170 <label for="trash">Move these patrons to the trash</label>
172 Move patrons to the deleted patrons table. They can be deleted permanently by the <code>cleanup_database</code> script.
176 <input id="testrun" type="radio" name="radio" value="testrun" checked="checked" />
177 <label for="testrun">Test run: Do not remove any patrons.</label>
178 <input type="hidden" name="do_delete" value="[% patrons_to_delete.size | html %]" /></fieldset>
183 [% IF patrons_to_anonymize.count %]
185 Checkout history for [% patrons_to_anonymize.count | html %] patrons will be anonymized
186 <input type="hidden" name="do_anonym" value="[% patrons_to_anonymize.count | html %]" />
190 <input type="hidden" name="step" value="3" />
191 <input type="hidden" name="not_borrowed_since" value="[% not_borrowed_since | $KohaDates %]" />
192 <input type="hidden" name="last_issue_date" value="[% last_issue_date | $KohaDates %]" />
193 <input type="hidden" name="borrower_dateexpiry" value="[% borrower_dateexpiry | $KohaDates %]" />
194 [% IF Koha.Preference('TrackLastPatronActivity') %]
195 <input type="hidden" name="borrower_lastseen" value="[% borrower_lastseen | $KohaDates %]" />
197 <input type="hidden" name="borrower_categorycode" value="[% borrower_categorycode | html %]" />
198 <input type="hidden" name="patron_list_id" value="[% patron_list_id | html %]" />
199 <input type="hidden" name="branch" value="[% current_branch | html %]" />
200 <fieldset class="action"><input type="submit" value="Finish" /> <a class="cancel" href="/cgi-bin/koha/tools/cleanborrowers.pl">Cancel</a></fieldset>
207 <!-- Step 3 START -->
211 <h4>[% TotalDel | html %] patrons would have been removed (if it wasn't a test run)</h4>
212 <h4>No patron records have been actually removed</h4>
214 [% IF ( do_delete ) %]
216 <h4>[% TotalDel | html %] patrons have been successfully moved to trash</h4>
218 <h4>[% TotalDel | html %] patrons have been successfully deleted</h4>
221 <h4>No patron records have been removed</h4>
225 <h4>All checkouts ([% do_anonym | html %]) older than [% last_issue_date | $KohaDates %] have been anonymized</h4>
227 <h4>No patron records have been anonymized</h4>
235 </div> <!-- /.col-sm-10.col-sm-push-2 -->
237 <div class="col-sm-2 col-sm-pull-10">
239 [% INCLUDE 'tools-menu.inc' %]
241 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
242 </div> <!-- /.row -->
244 [% MACRO jsinclude BLOCK %]
245 [% Asset.js("js/tools-menu.js") | $raw %]
246 [% INCLUDE 'calendar.inc' %]
248 $(document).ready(function(){
249 $("#delete_patrons_form").on("submit",function(){
250 return checkForm( this );
253 $('#branch').change(function() {
254 $('#selectlibrary').submit();
256 $("form[name='f2']").on('submit',function(){
257 if( $("#delete").prop("checked") ){
258 if( !confirm(_("These patrons will be permanently removed from the database and cannot be recovered")) ){
267 * This function check the form is correctly filled.
269 function checkForm(form) {
270 if((form.checkbox[0].checked)){
271 if ( (!form.date1.value) && (!form.borrower_dateexpiry.value) [% IF Koha.Preference('TrackLastPatronActivity') %]&& (!form.borrower_lastseen.value) [% END %]&& (!form.borrower_categorycode.value) && (!form.patron_list_id.value)){
272 alert(_("Please enter at least one criterion for deletion!"));
276 if((form.checkbox[1].checked)){
277 if(!(form.date2.value)){
278 alert(_("Please enter a date!"));
282 if(!form.checkbox[0].checked && !form.checkbox[1].checked) {
283 alert( _("Please check at least one action") );
291 [% INCLUDE 'intranet-bottom.inc' %]