Bug 10612 - Add ability to delete patrons with batch patron deletion tool
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / cleanborrowers.tt
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Tools &rsaquo; Batch patron deletion/anonymization [% IF step == 2 %]&rsaquo; Confirm[% END %][% IF step == 3 %]&rsaquo; Finished[% END %]</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 [% INCLUDE 'calendar.inc' %]
7 <script type="text/javascript">
8 // <![CDATA[
9         /**
10          *  checkForm(form)
11          *  This function check the form is correctly filled.
12          */
13           function checkForm(form) {
14               if((form.checkbox[0].checked)){
15                   if ( (!form.date1.value) && (!form.borrower_dateexpiry.value) && (!form.borrower_categorycode.value) && (!form.patron_list_id.value)){
16                     alert(_("Please enter at least one criterion for deletion!"));
17                     return false;
18                   }
19               }
20               if((form.checkbox[1].checked)){
21                   if(!(form.date2.value)){
22                       alert(_("please enter a date!"));
23                       return false;
24                   }
25               }
26               if(!form.checkbox[0].checked && !form.checkbox[1].checked) {
27                 alert( _("Please check at least one action") );
28                 return false;
29               }
30               return true;
31           }
32
33         /**
34          *  checkForm2(form)
35          *  This function check the form2 is correctly filled.
36          */
37           function checkForm2(form) {
38               return true;
39           }
40      // ]]>
41 </script>
42
43 </head>
44 <body id="tools_cleanborrowers" class="tools">
45 [% INCLUDE 'header.inc' %]
46 [% INCLUDE 'cat-search.inc' %]
47
48 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>  &rsaquo; [% IF step == 1 %]Clean Patron Records[% ELSE %]<a href="/cgi-bin/koha/tools/cleanborrowers.pl">Clean patron records</a> &rsaquo; [% END %][% IF step == 2 %]Confirm[% END %][% IF step == 3 %]Finished[% END %]</div>
49
50 <div id="doc3" class="yui-t2">
51
52    <div id="bd">
53     <div id="yui-main">
54     <div class="yui-b">
55
56 <h1>Batch patron deletion/anonymization</h1>
57 <div class="help">
58     <p>This tool allows you to delete patrons and anonymize checkout history. For deleting patrons, any combination of limits can be used.</p>
59 </div>
60 [% IF step == 1 %]
61 <!-- step 1 START -->
62 <div id="step1">
63     <form name="f1" onsubmit="return checkForm(this);" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post">
64     <fieldset>
65     <legend>Delete patrons</legend>
66         <h3><input id="checkborrower" type="checkbox" name="checkbox" value="borrower" /><label for="checkborrower"> Verify you want to delete patrons</label></h3>
67         <br />
68         <h5>Delete patrons who meet the following criteria:</h5>
69         <ul>
70                 <li>
71                     <label for="date1">who have not borrowed since:</label>
72                     <input size="10" id="date1" name="not_borrowed_since" type="text" class="datepicker" />
73                     <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
74                 </li>
75                 <li>
76                     <label for="borrower_dateexpiry">whose expiration date is before:</label>
77                     <input size="10" id="borrower_dateexpiry" name="borrower_dateexpiry" type="text" class="datepicker" />
78                     <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
79                 </li>
80                 <li>
81                     <label for="borrower_categorycode">whose patron category is:</label>
82                     <select id="borrower_categorycode" name="borrower_categorycode">
83                         <option value="" selected="selected">Any</option>
84                         [% FOREACH bc IN borrower_categorycodes %]
85                             [% UNLESS bc.category_type == 'S' %]
86                                 <option value="[% bc.categorycode %]">[% bc.description %]</option>
87                             [% END %]
88                         [% END %]
89                     </select>
90                 </li>
91                 [% IF patron_lists %]
92                 <li>
93                     <label for="patron_list_id">who are in patron list: </label>
94                     <select id="patron_list_id" name="patron_list_id">
95                         <option value=""></option>
96                         [% FOREACH pl IN patron_lists %]
97                             <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
98                         [% END %]
99                     </select>
100                 </li>
101                 [% END %]
102             </ul>
103         </fieldset>
104
105         <fieldset>
106         <legend>Anonymize checkout history</legend>
107         [% UNLESS Koha.Preference('AnonymousPatron') %]
108             <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>
109         [% END %]
110         <h3><input id="checkissue" type="checkbox" name="checkbox" value="issue" /><label for="checkissue"> Verify you want to anonymize patron checkout history</label></h3>
111         <br />
112         <ul>
113             <li>
114                 <label for="date2">Permanently delete checkout history older than</label>
115                 <input size="10" id="date2" name="last_issue_date" type="text" class="datepicker" />
116                 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
117             </li>
118         </ul>
119
120             <!-- hidden here -->
121             <input type="hidden" name="step" value="2" />
122             </fieldset>
123             <fieldset class="action"><input type="submit" value="Next &gt;&gt;" /></fieldset>
124     </form>
125 </div>
126 <!-- step 1 END -->
127 [% END %]
128
129 [% IF step == 2 %]
130 <!-- STEP 2 START -->
131 <div id="step2">
132         <form name="f2" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post" onsubmit="return checkForm2(this);">
133     <fieldset>
134         <legend>Warnings</legend>
135         <ul>
136             <li>[% patrons_to_delete.size || 0 %] patrons will be deleted</li>
137             <li>[% patrons_to_anonymize.size || 0 %] patron's checkout histories will be anonymized</li>
138         </ul>
139
140         <br />
141             [% IF patrons_to_delete.size %]
142                 <fieldset><legend>What do you want to do for deleted patrons?</legend>
143                 <input id="delete" type="radio" name="radio" value="delete" />
144                 <label for="delete">Permanently delete these patrons</label>
145
146                 <br /><input id="trash" type="radio" name="radio" value="trash" />
147                 <label for="trash">Move these patrons to the trash</label>
148
149                 <br /><input id="testrun" type="radio" name="radio" value="testrun" checked="checked" />
150                 <label for="testrun">Do not remove any patrons (test run)</label>
151                 <input type="hidden" name="do_delete" value="[% patrons_to_delete.size %]" /></fieldset>
152
153             [% END %]
154             [% IF patrons_to_anonymize.size %]
155                 Checkout history for [% patrons_to_anonymize.size %] patrons will be anonymized
156                 <input type="hidden" name="do_anonym" value="[% patrons_to_anonymize.size %]" />
157             [% END %]
158
159             <input type="hidden" name="step" value="3" />
160             <input type="hidden" name="not_borrowed_since" value="[% not_borrowed_since | $KohaDates %]" />
161             <input type="hidden" name="last_issue_date" value="[% last_issue_date | $KohaDates %]" />
162             <input type="hidden" name="borrower_dateexpiry" value="[% borrower_dateexpiry | $KohaDates %]" />
163             <input type="hidden" name="borrower_categorycode" value="[% borrower_categorycode %]" />
164             <input type="hidden" name="patron_list_id" value="[% patron_list_id %]" />
165     </fieldset>
166     <fieldset class="action"><input type="submit" value="Finish" /> <a class="cancel" href="/cgi-bin/koha/tools/cleanborrowers.pl">Cancel</a></fieldset>
167         </form>
168 </div>
169 <!-- STEP 2 END -->
170 [% END %]
171
172 [% IF step == 3 %]
173 <!-- Step 3 START -->
174
175     <div id="step3">
176         [% IF ( testrun ) %]
177             <h4>[% TotalDel %] patrons would have been removed (if it wasn't a test run)</h4>
178             <h4>No patron records have been actually removed</h4>
179         [% ELSE %]
180             [% IF ( do_delete ) %]
181                 [% IF ( trash ) %]
182                     <h4>[% TotalDel %] patrons have been successfully moved to trash</h4>
183                 [% ELSE %]
184                     <h4>[% TotalDel %] patrons have been successfully deleted</h4>
185                 [% END %]
186             [% ELSE %]
187                 <h4>No patron records have been removed</h4>
188             [% END %]
189         [% END %]
190         [% IF ( do_anonym ) %]
191             <h4>All checkouts older than [% last_issue_date | $KohaDates %] have been anonymized</h4>
192         [% ELSE %]
193             <h4>No patron records have been anonymized</h4>
194         [% END %]
195
196     </div>
197 <!-- Step 3 END -->
198 [% END %]
199
200 </div>
201 </div>
202 <div class="yui-b noprint">
203 [% INCLUDE 'tools-menu.inc' %]
204 </div>
205 </div>
206 [% INCLUDE 'intranet-bottom.inc' %]