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