Bug 20222: Make bread crumb for cleanborrowers.pl match the link text in tools-home.pl
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / cleanborrowers.tt
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% USE Branches %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Tools &rsaquo; Batch patron deletion/anonymization [% IF step == 2 %]&rsaquo; Confirm[% END %][% IF step == 3 %]&rsaquo; Finished[% END %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 </head>
9
10 <body id="tools_cleanborrowers" class="tools">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'cat-search.inc' %]
13
14 <div id="breadcrumbs">
15     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
16     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
17     [% IF step == 1 %]
18         Batch patron deletion/anonymization
19     [% ELSE %]
20         <a href="/cgi-bin/koha/tools/cleanborrowers.pl">Batch patron deletion/anonymization</a> &rsaquo;
21     [% END %]
22     [% IF step == 2 %] Confirm [% END %]
23     [% IF step == 3 %] Finished [% END %]
24 </div>
25
26 <div id="doc3" class="yui-t2">
27
28    <div id="bd">
29     <div id="yui-main">
30     <div class="yui-b">
31 [% IF !OnlyMine %]
32     <form method="get" action="/cgi-bin/koha/tools/cleanborrowers.pl" id="selectlibrary">
33     Select a library :
34         <select name="branch" id="branch" style="width:20em;">
35             <option value="*">All libraries</option>
36         [% FOREACH branch IN Branches.all( selected => current_branch ) %]
37           [% IF branch.selected %]
38             <option value="[% branch.branchcode %]" selected="selected">[% branch.branchname %]</option>
39           [% ELSE %]
40             <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
41           [% END %]
42         [% END %]
43         </select>
44     </form>
45   [% IF current_branch == '*' %]
46     <h1>Batch patron deletion/anonymization</h1>
47   [% ELSE %]
48     <h1>Batch patron deletion/anonymization for [% Branches.GetName( current_branch ) %]</h1>
49   [% END %]
50 [% ELSE %]
51     <h1>Batch patron deletion/anonymization for [% Branches.GetName( Branches.GetLoggedInBranchcode ) %]</h1>
52 [% END %]
53
54 [% IF step == 1 %]
55 <!-- step 1 START -->
56
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 <div id="step1">
61     <form name="f1" id="delete_patrons_form" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post">
62     <fieldset>
63     <legend>Delete patrons</legend>
64         <h3><input id="checkborrower" type="checkbox" name="checkbox" value="borrower" /><label for="checkborrower"> Verify you want to delete patrons</label></h3>
65         <br />
66         <h5>Delete patrons who meet the following criteria:</h5>
67         <ul>
68                 <li>
69                     <label for="date1">who have not borrowed since:</label>
70                     <input size="10" id="date1" name="not_borrowed_since" type="text" class="datepicker" />
71                     <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
72                 </li>
73                 <li>
74                     <label for="borrower_dateexpiry">whose expiration date is before:</label>
75                     <input size="10" id="borrower_dateexpiry" name="borrower_dateexpiry" type="text" class="datepicker" />
76                     <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
77                 </li>
78                 [% IF Koha.Preference('TrackLastPatronActivity') %]
79                     <li>
80                         <label for="borrower_lastseen">who have not been connected since:</label>
81                         <input size="10" id="borrower_lastseen" name="borrower_lastseen" type="text" class="datepicker" />
82                         <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
83                     </li>
84                 [% END %]
85                 <li>
86                     <label for="borrower_categorycode">whose patron category is:</label>
87                     <select id="borrower_categorycode" name="borrower_categorycode">
88                         <option value="" selected="selected">Any</option>
89                         [% FOREACH bc IN borrower_categorycodes %]
90                             [% UNLESS bc.category_type == 'S' %]
91                                 <option value="[% bc.categorycode %]">[% bc.description %]</option>
92                             [% END %]
93                         [% END %]
94                     </select>
95                 </li>
96                 [% IF patron_lists %]
97                 <li>
98                     <label for="patron_list_id">who are in patron list: </label>
99                     <select id="patron_list_id" name="patron_list_id">
100                         <option value=""></option>
101                         [% FOREACH pl IN patron_lists %]
102                             <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
103                         [% END %]
104                     </select>
105                 </li>
106                 [% END %]
107             </ul>
108         </fieldset>
109
110         <fieldset>
111         <legend>Anonymize checkout history</legend>
112         [% UNLESS Koha.Preference('AnonymousPatron') %]
113             <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>
114         [% END %]
115         <h3><input id="checkissue" type="checkbox" name="checkbox" value="issue" /><label for="checkissue"> Verify you want to anonymize patron checkout history</label></h3>
116         <br />
117         <ul>
118             <li>
119                 <label for="date2">Permanently delete checkout history older than</label>
120                 <input size="10" id="date2" name="last_issue_date" type="text" class="datepicker" />
121                 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
122             </li>
123         </ul>
124
125             <!-- hidden here -->
126             <input type="hidden" name="step" value="2" />
127             <input type="hidden" name="branch" value="[% current_branch %]" />
128             </fieldset>
129             <fieldset class="action"><input type="submit" value="Next &gt;&gt;" /></fieldset>
130     </form>
131 </div>
132 <!-- step 1 END -->
133 [% END %]
134
135 [% IF step == 2 %]
136 <!-- STEP 2 START -->
137 <div id="step2">
138         <form name="f2" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post">
139     <fieldset>
140         <legend>Warnings</legend>
141         <ul>
142             <li>[% patrons_to_delete.size || 0 %] patrons will be deleted</li>
143             <li>[% patrons_to_anonymize.count || 0 %] patron's checkout histories will be anonymized</li>
144         </ul>
145
146         <br />
147             [% IF patrons_to_delete.size %]
148                 <fieldset><legend>What do you want to do for deleted patrons?</legend>
149                 <input id="delete" type="radio" name="radio" value="delete" />
150                 <label for="delete">Permanently delete these patrons</label>
151
152                 <br /><input id="trash" type="radio" name="radio" value="trash" />
153                 <label for="trash">Move these patrons to the trash</label>
154
155                 <br /><input id="testrun" type="radio" name="radio" value="testrun" checked="checked" />
156                 <label for="testrun">Do not remove any patrons (test run)</label>
157                 <input type="hidden" name="do_delete" value="[% patrons_to_delete.size %]" /></fieldset>
158
159             [% END %]
160             [% IF patrons_to_anonymize.count %]
161                 Checkout history for [% patrons_to_anonymize.count %] patrons will be anonymized
162                 <input type="hidden" name="do_anonym" value="[% patrons_to_anonymize.count %]" />
163             [% END %]
164
165             <input type="hidden" name="step" value="3" />
166             <input type="hidden" name="not_borrowed_since" value="[% not_borrowed_since | $KohaDates %]" />
167             <input type="hidden" name="last_issue_date" value="[% last_issue_date | $KohaDates %]" />
168             <input type="hidden" name="borrower_dateexpiry" value="[% borrower_dateexpiry | $KohaDates %]" />
169             [% IF Koha.Preference('TrackLastPatronActivity') %]
170                 <input type="hidden" name="borrower_lastseen" value="[% borrower_lastseen | $KohaDates %]" />
171             [% END %]
172             <input type="hidden" name="borrower_categorycode" value="[% borrower_categorycode %]" />
173             <input type="hidden" name="patron_list_id" value="[% patron_list_id %]" />
174             <input type="hidden" name="branch" value="[% current_branch %]" />
175     </fieldset>
176     <fieldset class="action"><input type="submit" value="Finish" /> <a class="cancel" href="/cgi-bin/koha/tools/cleanborrowers.pl">Cancel</a></fieldset>
177         </form>
178 </div>
179 <!-- STEP 2 END -->
180 [% END %]
181
182 [% IF step == 3 %]
183 <!-- Step 3 START -->
184
185     <div id="step3">
186         [% IF ( testrun ) %]
187             <h4>[% TotalDel %] patrons would have been removed (if it wasn't a test run)</h4>
188             <h4>No patron records have been actually removed</h4>
189         [% ELSE %]
190             [% IF ( do_delete ) %]
191                 [% IF ( trash ) %]
192                     <h4>[% TotalDel %] patrons have been successfully moved to trash</h4>
193                 [% ELSE %]
194                     <h4>[% TotalDel %] patrons have been successfully deleted</h4>
195                 [% END %]
196             [% ELSE %]
197                 <h4>No patron records have been removed</h4>
198             [% END %]
199         [% END %]
200         [% IF do_anonym %]
201             <h4>All checkouts ([% do_anonym %]) older than [% last_issue_date | $KohaDates %] have been anonymized</h4>
202         [% ELSE %]
203             <h4>No patron records have been anonymized</h4>
204         [% END %]
205
206     </div>
207 <!-- Step 3 END -->
208 [% END %]
209
210 </div>
211 </div>
212 <div class="yui-b noprint">
213 [% INCLUDE 'tools-menu.inc' %]
214 </div>
215 </div>
216
217 [% MACRO jsinclude BLOCK %]
218     <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu_[% KOHA_VERSION %].js"></script>
219     [% INCLUDE 'calendar.inc' %]
220     <script type="text/javascript">
221         $(document).ready(function(){
222             $("#delete_patrons_form").on("submit",function(){
223                 return checkForm( this );
224             });
225
226             $('#branch').change(function() {
227                 $('#selectlibrary').submit();
228             });
229         });
230
231         /**
232          *  checkForm(form)
233          *  This function check the form is correctly filled.
234          */
235         function checkForm(form) {
236             if((form.checkbox[0].checked)){
237                 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)){
238                   alert(_("Please enter at least one criterion for deletion!"));
239                   return false;
240                 }
241             }
242             if((form.checkbox[1].checked)){
243                 if(!(form.date2.value)){
244                     alert(_("Please enter a date!"));
245                     return false;
246                 }
247             }
248             if(!form.checkbox[0].checked && !form.checkbox[1].checked) {
249               alert( _("Please check at least one action") );
250               return false;
251             }
252             return true;
253         }
254     </script>
255 [% END %]
256
257 [% INCLUDE 'intranet-bottom.inc' %]