Bug 10904: Limit patron update request management by branch
[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) ){
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.categorycode == 'S' || bc.category_type == 'S' ) %]
86                                 <option value="[% bc.categorycode %]">[% bc.description %]</option>
87                             [% END %]
88                         [% END %]
89                     </select>
90                 </li>
91             </ul>
92         </fieldset>
93         <fieldset>
94         <legend>Anonymize checkout history</legend>
95         [% UNLESS Koha.Preference('AnonymousPatron') %]
96             <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>
97         [% END %]
98         <h3><input id="checkissue" type="checkbox" name="checkbox" value="issue" /><label for="checkissue"> Verify you want to anonymize patron checkout history</label></h3>
99         <br />
100         <ul>
101             <li>
102                 <label for="date2">Permanently delete checkout history older than</label>
103                 <input size="10" id="date2" name="last_issue_date" type="text" class="datepicker" />
104                 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
105             </li>
106         </ul>
107
108             <!-- hidden here -->
109             <input type="hidden" name="step" value="2" />
110             </fieldset>
111             <fieldset class="action"><input type="submit" value="Next &gt;&gt;" /></fieldset>
112     </form>
113 </div>
114 <!-- step 1 END -->
115 [% END %]
116
117 [% IF step == 2 %]
118 <!-- STEP 2 START -->
119 <div id="step2">
120         <form name="f2" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post" onsubmit="return checkForm2(this);">
121     <fieldset>
122         <legend>Warnings</legend>
123         <ul>
124             <li>[% IF ( totalToDelete ) %][% totalToDelete %] [% ELSE %]0 [% END %] patrons will be deleted</li>
125             <li>[% IF ( totalToAnonymize ) %][% totalToAnonymize %] [% ELSE %]0 [% END %] checkout history will be anonymized</li>
126         </ul>
127
128         <br />
129             [% IF ( totalToDelete ) %]
130                 <fieldset><legend>What do you want to do for deleted patrons?</legend>
131                 <input id="delete" type="radio" name="radio" value="delete" />
132                 <label for="delete">Permanently delete these patrons</label>
133
134                 <br /><input id="trash" type="radio" name="radio" value="trash" />
135                 <label for="trash">Move these patrons to the trash</label>
136
137                 <br /><input id="testrun" type="radio" name="radio" value="testrun" checked="checked" />
138                 <label for="testrun">Do not remove any patrons (test run)</label>
139                 <input type="hidden" name="do_delete" value="[% totalToDelete %]" /></fieldset>
140
141             [% END %]
142             [% IF ( totalToAnonymize ) %]
143                 Checkout history for [% totalToAnonymize %] patrons will be anonymized
144                 <input type="hidden" name="do_anonym" value="[% totalToAnonymize %]" />
145             [% END %]
146
147             <input type="hidden" name="step" value="3" />
148             <input type="hidden" name="not_borrowed_since" value="[% not_borrowed_since | $KohaDates %]" />
149             <input type="hidden" name="last_issue_date" value="[% last_issue_date | $KohaDates %]" />
150             <input type="hidden" name="borrower_dateexpiry" value="[% borrower_dateexpiry | $KohaDates %]" />
151             <input type="hidden" name="borrower_categorycode" value="[% borrower_categorycode %]" />
152     </fieldset>
153     <fieldset class="action"><input type="submit" value="Finish" /> <a class="cancel" href="/cgi-bin/koha/tools/cleanborrowers.pl">Cancel</a></fieldset>
154         </form>
155 </div>
156 <!-- STEP 2 END -->
157 [% END %]
158
159 [% IF step == 3 %]
160 <!-- Step 3 START -->
161
162     <div id="step3">
163         [% IF ( testrun ) %]
164             <h4>[% TotalDel %] patrons would have been removed (if it wasn't a test run)</h4>
165             <h4>No patron records have been actually removed</h4>
166         [% ELSE %]
167             [% IF ( do_delete ) %]
168                 [% IF ( trash ) %]
169                     <h4>[% TotalDel %] patrons have been successfully moved to trash</h4>
170                 [% ELSE %]
171                     <h4>[% TotalDel %] patrons have been successfully deleted</h4>
172                 [% END %]
173             [% ELSE %]
174                 <h4>No patron records have been removed</h4>
175             [% END %]
176         [% END %]
177         [% IF ( do_anonym ) %]
178             <h4>All patrons with checkouts older than [% last_issue_date | $KohaDates %] have been anonymized</h4>
179         [% ELSE %]
180             <h4>No patron records have been anonymized</h4>
181         [% END %]
182
183     </div>
184 <!-- Step 3 END -->
185 [% END %]
186
187 </div>
188 </div>
189 <div class="yui-b noprint">
190 [% INCLUDE 'tools-menu.inc' %]
191 </div>
192 </div>
193 [% INCLUDE 'intranet-bottom.inc' %]