Bug 24163: Allow to define CSV profile for late orders export
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / cleanborrowers.tt
index 40aae31..df223c7 100644 (file)
@@ -5,7 +5,7 @@
 [% USE Branches %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Tools &rsaquo; Batch patron deletion/anonymization [% IF step == 2 %]&rsaquo; Confirm[% END %][% IF step == 3 %]&rsaquo; Finished[% END %]</title>
+<title>Koha &rsaquo; Tools &rsaquo; Batch patron deletion and anonymization [% IF step == 2 %]&rsaquo; Confirm[% END %][% IF step == 3 %]&rsaquo; Finished[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
 
@@ -17,9 +17,9 @@
     <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 %]
-        Batch patron deletion/anonymization
+        Batch patron deletion and anonymization
     [% ELSE %]
-        <a href="/cgi-bin/koha/tools/cleanborrowers.pl">Batch patron deletion/anonymization</a> &rsaquo;
+        <a href="/cgi-bin/koha/tools/cleanborrowers.pl">Batch patron deletion and anonymization</a> &rsaquo;
     [% END %]
     [% IF step == 2 %] Confirm [% END %]
     [% IF step == 3 %] Finished [% END %]
             <main>
 
 [% IF !OnlyMine %]
+  [% IF current_branch == '*' %]
+    <h1>Batch patron deletion and anonymization</h1>
+  [% ELSE %]
+    <h1>Batch patron deletion and anonymization for [% Branches.GetName( current_branch ) | html %]</h1>
+  [% END %]
+    [% IF step == 1 %]
     <form method="get" action="/cgi-bin/koha/tools/cleanborrowers.pl" id="selectlibrary">
     Select a library :
         <select name="branch" id="branch" style="width:20em;">
         [% END %]
         </select>
     </form>
-  [% IF current_branch == '*' %]
-    <h1>Batch patron deletion/anonymization</h1>
-  [% ELSE %]
-    <h1>Batch patron deletion/anonymization for [% Branches.GetName( current_branch ) | html %]</h1>
-  [% END %]
+    [% END %]
 [% ELSE %]
-    <h1>Batch patron deletion/anonymization for [% Branches.GetName( Branches.GetLoggedInBranchcode ) | html %]</h1>
+    <h1>Batch patron deletion and anonymization for [% Branches.GetName( Branches.GetLoggedInBranchcode ) | html %]</h1>
 [% END %]
 
 [% IF step == 1 %]
 <!-- step 1 START -->
 
 <div class="help">
-    <p>This tool allows you to delete patrons and anonymize checkout history. For deleting patrons, any combination of limits can be used.</p>
+    <p>This tool allows you to delete patrons and anonymize checkout history. For deleting patrons, any combination of limits can be used. Patrons will not be deleted if they meet one or more of the following conditions:</p>
+<ul>
+<li>They have items currently checked out.</li>
+<li>They have a non-zero account balance.</li>
+<li>They are the guarantor to another patron.</li>
+<li>They are in a patron category of type staff.</li>
+</ul>
 </div>
 <div id="step1">
     <form name="f1" id="delete_patrons_form" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post">
 <!-- STEP 2 START -->
 <div id="step2">
         <form name="f2" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post">
-    <fieldset>
-        <legend>Warnings</legend>
-        <ul>
-            <li>[% patrons_to_delete.size || 0 | html %] patrons will be deleted</li>
-            <li>[% patrons_to_anonymize.count || 0 | html %] patron's checkout histories will be anonymized</li>
-        </ul>
-
-        <br />
-            [% IF patrons_to_delete.size %]
-                <fieldset><legend>What do you want to do for deleted patrons?</legend>
-                <input id="delete" type="radio" name="radio" value="delete" />
-                <label for="delete">Permanently delete these patrons</label>
-
-                <br /><input id="trash" type="radio" name="radio" value="trash" />
-                <label for="trash">Move these patrons to the trash</label>
 
-                <br /><input id="testrun" type="radio" name="radio" value="testrun" checked="checked" />
-                <label for="testrun">Do not remove any patrons (test run)</label>
-                <input type="hidden" name="do_delete" value="[% patrons_to_delete.size | html %]" /></fieldset>
+        <div class="dialog alert">
+            <h3>Warning</h3>
+            <ul>
+                <li>[% patrons_to_delete.size || 0 | html %] patrons will be deleted</li>
+                <li>[% patrons_to_anonymize.count || 0 | html %] patrons' checkout histories will be anonymized</li>
+            </ul>
+        </div>
 
+            [% IF patrons_to_delete.size %]
+                <fieldset>
+                    <legend>How should patrons be deleted?</legend>
+                    <p>
+                        <input id="delete" type="radio" name="radio" value="delete" />
+                        <label for="delete">Permanently delete these patrons</label>
+                        <div class="hint">
+                            Delete patrons directly from the database. Patron data will not be recoverable.
+                        </div>
+                    </p>
+                    <p>
+                        <input id="trash" type="radio" name="radio" value="trash" />
+                        <label for="trash">Move these patrons to the trash</label>
+                        <div class="hint">
+                            Move patrons to the deleted patrons table. They can be deleted permanently by the <code>cleanup_database</code> script.
+                        </div>
+                    </p>
+                    <p>
+                        <input id="testrun" type="radio" name="radio" value="testrun" checked="checked" />
+                        <label for="testrun">Test run: Do not remove any patrons.</label>
+                        <input type="hidden" name="do_delete" value="[% patrons_to_delete.size | html %]" /></fieldset>
+                    </p>
+                </fieldset>
             [% END %]
+
             [% IF patrons_to_anonymize.count %]
+                <fieldset>
                 Checkout history for [% patrons_to_anonymize.count | html %] patrons will be anonymized
                 <input type="hidden" name="do_anonym" value="[% patrons_to_anonymize.count | html %]" />
+                </fieldset>
             [% END %]
 
             <input type="hidden" name="step" value="3" />
             <input type="hidden" name="borrower_categorycode" value="[% borrower_categorycode | html %]" />
             <input type="hidden" name="patron_list_id" value="[% patron_list_id | html %]" />
             <input type="hidden" name="branch" value="[% current_branch | html %]" />
-    </fieldset>
     <fieldset class="action"><input type="submit" value="Finish" /> <a class="cancel" href="/cgi-bin/koha/tools/cleanborrowers.pl">Cancel</a></fieldset>
         </form>
 </div>
             $('#branch').change(function() {
                 $('#selectlibrary').submit();
             });
+            $("form[name='f2']").on('submit',function(){
+                if( $("#delete").prop("checked") ){
+                    if( !confirm(_("These patrons will be permanently removed from the database and cannot be recovered")) ){
+                        return false;
+                    }
+                }
+            });
         });
 
         /**