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