Bug 10904: Limit patron update request management by branch
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / import_borrowers.tt
1 [% USE Koha %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Tools &rsaquo; Import patrons [% IF ( uploadborrowers ) %]&rsaquo; Results[% END %]</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <style type="text/css">
6     .yui-u fieldset.rows .widelabel { width: 12em; }
7     label.description { width: 20em; }
8     .line_error { width: 100%; }
9     code { background-color: yellow; }
10 </style>
11 <script type="text/javascript">
12 //<![CDATA[
13     $(document).ready(function() {
14         [%# Make date fields have the datepicker %]
15         $("#dateenrolled").addClass('datepicker');
16         $("#dateexpiry").addClass('datepicker');
17         $("#dateofbirth").addClass('datepicker');
18     });
19 </script>
20 </head>
21 <body id="tools_import_borrowers" class="tools">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'patron-search.inc' %]
24 [% INCLUDE 'calendar.inc' %]
25
26 <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; <a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a>[% IF ( uploadborrowers ) %] &rsaquo; Results[% END %]</div>
27
28 <div id="doc3" class="yui-t2">
29  <div id="bd">
30   <div id="yui-main">
31    <div class="yui-b">
32     <div class="yui-g">
33      <div class="yui-u first">
34 <h1>Import patrons</h1>
35 [% IF ( uploadborrowers ) %]
36 <h5>Import results :</h5>
37 <ul>
38         <li>[% imported %] imported records [% IF ( lastimported ) %](last was [% lastimported %])[% END %]</li>
39         <li>[% overwritten %] overwritten [% IF ( lastoverwritten ) %](last was [% lastoverwritten %])[% END %]</li>
40         <li>[% alreadyindb %] not imported because already in borrowers table and overwrite disabled [% IF ( lastalreadyindb ) %](last was [% lastalreadyindb %])[% END %]</li>
41         <li>[% invalid %] not imported because they are not in the expected format [% IF ( lastinvalid ) %](last was [% lastinvalid %])[% END %]</li>
42         <li>[% total %] records parsed</li>
43         <li><a href="/cgi-bin/koha/tools/tools-home.pl">Back to Tools</a></li>
44 </ul>
45   [% IF ( FEEDBACK ) %]
46   <br /><br />
47     <div>
48     <h5>Feedback:</h5>
49     <ul class="feedback">
50     [% FOREACH FEEDBAC IN FEEDBACK %]
51     <li>
52         [% IF ( FEEDBAC.filename ) %]Parsing upload file <span class="filename">[% FEEDBAC.filename %]</span>
53         [% ELSIF ( FEEDBAC.backend ) %]Upload parsed using [% FEEDBAC.backend %]
54         [% ELSIF ( FEEDBAC.headerrow ) %]These fields found: [% FEEDBAC.value %]
55         [% ELSE %][% FEEDBAC.name %] : [% FEEDBAC.value %]
56         [% END %]
57     </li>
58     [% END %]
59     </ul>
60     </div>
61   [% END %]
62   [% IF ( ERRORS ) %]
63   <br /><br />
64     <div>
65     <h5>Error analysis:</h5>
66     <ul>
67     [% FOREACH ERROR IN ERRORS %]
68         [% IF ( ERROR.badheader ) %]<li>Header row could not be parsed</li>[% END %]
69         [% FOREACH missing_critical IN ERROR.missing_criticals %]
70         <li class="line_error">
71             Line <span class="linenumber">[% missing_critical.line %]</span>
72             [% IF ( missing_critical.badparse ) %]
73                 could not be parsed!
74             [% ELSIF ( missing_critical.bad_date ) %]
75                 has &quot;[% missing_critical.key %]&quot; in unrecognized format: &quot;[% missing_critical.value %]&quot;
76             [% ELSE %]
77                 Critical field &quot;[% missing_critical.key %]&quot;
78                 [% IF ( missing_critical.branch_map ) %]has unrecognized value &quot;[% missing_critical.value %]&quot;
79                 [% ELSIF ( missing_critical.category_map ) %]has unrecognized value &quot;[% missing_critical.value %]&quot;
80                 [% ELSE %]missing
81                 [% END %]
82                 (borrowernumber: [% missing_critical.borrowernumber %]; surname: [% missing_critical.surname %]).
83             [% END %]
84             <br /><code>[% missing_critical.lineraw %]</code>
85         </li>
86         [% END %]
87         [% IF ERROR.invalid_cardnumber %]
88             <li class="line_error">
89                 Cardnumber [% ERROR.cardnumber %] is not a valid cardnumber
90                 [% IF ERROR.borrowernumber %] (for patron with borrowernumber [% ERROR.borrowernumber %])[% END %]
91             </li>
92         [% END %]
93     [% END %]
94     </ul>
95     </div>
96   [% END %]
97 [% ELSE %]
98 <ul>
99         <li>Select a file to import into the borrowers table</li>
100         <li>If a cardnumber exists in the table, you can choose whether to ignore the new one or overwrite the old one.</li>
101 </ul>
102 <form method="post" action="[% SCRIPT_NAME %]" enctype="multipart/form-data">
103 <fieldset class="rows">
104 <legend>Import into the borrowers table</legend>
105 <ol>
106         <li>
107                 <label for="uploadborrowers">Select the file to import: </label>
108                 <input type="file" id="uploadborrowers" name="uploadborrowers" />
109         </li>
110 </ol></fieldset>
111     <fieldset class="rows">
112         <legend>Field to use for record matching</legend>
113         <ol>
114             <li class="radio">
115                 <select name="matchpoint" id="matchpoint">
116                     <option value="cardnumber">Cardnumber</option>
117                     <option value="userid">Username</option>
118                     [% FOREACH matchpoint IN matchpoints %]
119                         <option value="[% matchpoint.code %]">[% matchpoint.description %]</option>
120                     [% END %]
121                 </select>
122             </li>
123         </ol>
124     </fieldset>
125 <fieldset class="rows">
126 <legend>Default values</legend>
127 <ol>
128 [% FOREACH borrower_field IN borrower_fields %]
129   [% SWITCH borrower_field.field %]
130   [% CASE 'branchcode' %]
131     <li>
132         <label class="description" for="branchcode">[% borrower_field.description %]: </label>
133         <select id="branchcode" name="branchcode">
134             <option value="" selected="selected"></option>
135         [% FOREACH branch IN branches %]
136             <option value="[% branch.branchcode %]">
137                 [% branch.branchname %]</option>
138         [% END %]
139         </select><span class="field_hint">[% borrower_field.field %]</span>
140     </li>
141   [% CASE 'categorycode' %]
142     <li>
143         <label class="description" for="categorycode">[% borrower_field.description %]: </label>
144         <select id="categorycode" name="categorycode">
145             <option value="" selected="selected"></option>
146         [% FOREACH category IN categories %]
147             <option value="[% category.categorycode %]">
148                 [% category.description %]</option>
149         [% END %]
150         </select><span class="field_hint">[% borrower_field.field %]</span>
151     </li>
152   [% CASE %]
153     <li>
154         <label class="description" for="[% borrower_field.field %]">[% borrower_field.description %]: </label>
155         <input id="[% borrower_field.field %]" name="[% borrower_field.field %]" /><span class="field_hint">[% borrower_field.field %]</span>
156     </li>
157   [% END %]
158 [% END %]
159 [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
160     <li>
161         <label class="description" for="patron_attributes">Patron attributes: </label>
162         <input id="patron_attributes" name="patron_attributes" />
163         <span class="field_hint">patron_attributes</span>
164     </li>
165 [% END %]
166 </ol></fieldset>
167         <fieldset class="rows">
168         <legend>If matching record is already in the borrowers table:</legend>
169     <ol><li class="radio">
170         <input type="radio" id="overwrite_cardnumberno" name="overwrite_cardnumber" value="0" checked="checked" /><label for="overwrite_cardnumberno">Ignore this one, keep the existing one</label>
171         </li>
172         <li class="radio">
173                 <input type="radio" id="overwrite_cardnumberyes" name="overwrite_cardnumber" value="1" /><label for="overwrite_cardnumberyes">Overwrite the existing one with this</label>
174         </li>
175     </ol>
176     </fieldset>
177     [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
178         <fieldset class="rows">
179     <legend>Patron attributes</legend>
180     <ol><li class="radio">
181         <input type="radio" id="ext_preserve_0" name="ext_preserve" value="0" checked="checked" /><label for="ext_preserve_0">Replace all patron attributes</label>
182         </li>
183         <li class="radio">
184         <input type="radio" id="ext_preserve_1" name="ext_preserve" value="1" /><label for="ext_preserve_1">Replace only included patron attributes</label>
185         </li>
186     </ol>
187     </fieldset>
188     [% END %]
189         <fieldset class="action"><input type="submit" value="Import" /></fieldset>
190 </form>
191 [% END %]
192 </div>
193 <div class="yui-u">
194 <h2>Notes:</h2>
195 <ul>
196 <li>The first line in the file must be a header row defining which columns you are supplying in the import file.</li>
197 <li><b>Download a starter CSV file with all the columns <a href="?sample=1">here</a>.</b>  Values are comma-separated.</li>
198 <li>OR choose which fields you want to supply from the following list:<ul><li>
199     [% FOREACH columnkey IN borrower_fields %]'[% columnkey.field %]', [% END %]
200 </li></ul></li>
201 [% IF ( ExtendedPatronAttributes ) %]
202 <li>If loading patron attributes, the 'patron_attributes' field should contain a comma-separated list of attribute types and values. The attribute type code and a colon should precede each value. For example: <b>INSTID:12345,LANG:fr</b> or <b>STARTDATE:January 1 2010,TRACK:Day</b>. If an input record has more than one attribute, the fields should either be entered as an unquoted string (previous examples), or with each field wrapped in separate double quotes and delimited by a comma: <b>&quot;STARTDATE:January 1, 2010&quot;,&quot;TRACK:Day&quot;</b>.  The second syntax would be required if the data might have a comma in it, like a date string.
203 </li>
204 [% END %]
205 <li>The fields 'branchcode' and 'categorycode' are <b>required</b> and <b>must match</b> valid entries in your database.</li>
206 <li>'password' should be stored in plaintext, and will be converted to a Bcrypt hash (if your passwords are already encrypted, talk to your system administrator about options).</li>
207 <li>Date formats should match your system preference, and <b>must</b> be zero-padded, e.g. '01/02/2008'.  Alternatively,
208 you can supply dates in ISO format (e.g., '2010-10-28').
209 </li>
210 </ul>
211
212      </div>
213     </div>
214    </div>
215   </div>
216   <div class="yui-b noprint">
217 [% INCLUDE 'tools-menu.inc' %]
218   </div>
219  </div>
220 [% INCLUDE 'intranet-bottom.inc' %]