Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / import_borrowers.tt
blobf2b5c3c588db68e2ad8e32c16a8adab26cc6b522
1 [% USE Asset %]
2 [% USE Koha %]
3 [% USE Branches %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Tools &rsaquo; Import patrons [% IF ( uploadborrowers ) %]&rsaquo; Results[% END %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <style type="text/css">
9     .yui-u fieldset.rows .widelabel { width: 12em; }
10     label.description { width: 20em; }
11     .line_error { width: 100%; }
12     code { background-color: yellow; }
13 </style>
14 </head>
16 <body id="tools_import_borrowers" class="tools">
17 [% INCLUDE 'header.inc' %]
18 [% INCLUDE 'patron-search.inc' %]
20 <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>
22 <div id="doc3" class="yui-t2">
23  <div id="bd">
24   <div id="yui-main">
25    <div class="yui-b">
26     <div class="yui-g">
27      <div class="yui-u first">
28 <h1>Import patrons</h1>
29 [% IF ( uploadborrowers ) %]
30     <h5>Import results :</h5>
31     <ul>
32         <li>[% imported %] imported records [% IF ( lastimported ) %](last was [% lastimported %])[% END %]</li>
33         [% IF imported and patronlistname %]
34             <li>Patronlist with imported patrons: [% patronlistname %]</li>
35         [% END %]
36         <li>[% overwritten %] overwritten [% IF ( lastoverwritten ) %](last was [% lastoverwritten %])[% END %]</li>
37         <li>[% alreadyindb %] not imported because already in borrowers table and overwrite disabled [% IF ( lastalreadyindb ) %](last was [% lastalreadyindb %])[% END %]</li>
38         <li>[% invalid %] not imported because they are not in the expected format [% IF ( lastinvalid ) %](last was [% lastinvalid %])[% END %]</li>
39         <li>[% total %] records parsed</li>
40         <li><a href="/cgi-bin/koha/tools/tools-home.pl">Back to Tools</a></li>
41     </ul>
43     [% IF ( feedback ) %]
44         <br /><br />
46         <div>
47             <h5>Feedback:</h5>
48                 <ul class="feedback">
49                     [% FOREACH f IN feedback %]
50                         <li>
51                             [% IF ( f.filename ) %]
52                                 Parsing upload file <span class="filename">[% f.filename %]</span>
53                             [% ELSIF ( f.backend ) %]
54                                 Upload parsed using [% f.backend %]
55                             [% ELSIF ( f.headerrow ) %]
56                                 These fields found: [% f.value %]
57                             [% ELSIF ( f.already_in_db ) %]
58                                 Patron already in database: [% f.value %]
59                             [% ELSE %]
60                                 [% f.name %] : [% f.value %]
61                             [% END %]
62                         </li>
63                     [% END %]
64                 </ul>
65         </div>
66     [% END %]
68     [% IF ( errors ) %]
69         <br /><br />
71         <div>
72             <h5>Error analysis:</h5>
73             <ul>
74                 [% FOREACH e IN errors %]
75                     [% IF ( e.badheader ) %]<li>Header row could not be parsed</li>[% END %]
77                     [% FOREACH missing_critical IN e.missing_criticals %]
78                         <li class="line_error">
79                             Line <span class="linenumber">[% missing_critical.line %]</span>
81                             [% IF ( missing_critical.badparse ) %]
82                                 could not be parsed!
83                             [% ELSIF ( missing_critical.bad_date ) %]
84                                 has &quot;[% missing_critical.key %]&quot; in unrecognized format: &quot;[% missing_critical.value %]&quot;
85                             [% ELSE %]
86                                 Critical field &quot;[% missing_critical.key %]&quot;
88                                 [% IF ( missing_critical.branch_map ) %]
89                                     has unrecognized value &quot;[% missing_critical.value %]&quot;
90                                 [% ELSIF ( missing_critical.category_map ) %]
91                                     has unrecognized value &quot;[% missing_critical.value %]&quot;
92                                 [% ELSE %]
93                                     missing
94                                 [% END %]
96                                 (borrowernumber: [% missing_critical.borrowernumber %]; surname: [% missing_critical.surname %]).
97                             [% END %]
99                             <br/>
100                             <code>[% missing_critical.lineraw %]</code>
101                         </li>
102                     [% END %]
104                     [% IF e.invalid_cardnumber %]
105                         <li class="line_error">
106                             Cardnumber [% e.cardnumber %] is not a valid cardnumber
107                             [% IF e.borrowernumber %] (for patron with borrowernumber [% e.borrowernumber %])[% END %]
108                         </li>
109                     [% END %]
110                     [% IF e.duplicate_userid %]
111                         <li class="line_error">
112                             Userid [% e.userid %] is already used by another patron.
113                         </li>
114                     [% END %]
115                 [% END %]
116             </ul>
117         </div>
118     [% END %]
119 [% ELSE %]
120     <ul>
121         <li>Select a file to import into the borrowers table</li>
122         <li>If a cardnumber exists in the table, you can choose whether to ignore the new one or overwrite the old one.</li>
123     </ul>
125     <form method="post" action="[% SCRIPT_NAME %]" enctype="multipart/form-data">
126         <fieldset class="rows">
127             <legend>Import into the borrowers table</legend>
129             <ol>
130                 <li>
131                     <label for="uploadborrowers">Select the file to import: </label>
132                     <input type="file" id="uploadborrowers" name="uploadborrowers" />
133                 </li>
135                 <li>
136                     <label for "createpatronlist">Create patron list: </label>
137                     <input name="createpatronlist" id="createpatronlist" value="1" type="checkbox">
138                     <span class="hint">List name will be file name with timestamp</span>
139                 </li>
140             </ol>
141         </fieldset>
143         <fieldset class="rows">
144             <legend>Field to use for record matching</legend>
145             <ol>
146                 <li class="radio">
147                     <select name="matchpoint" id="matchpoint">
148                         <option value="cardnumber">Cardnumber</option>
149                         <option value="userid">Username</option>
150                         [% FOREACH matchpoint IN matchpoints %]
151                             <option value="[% matchpoint.code %]">[% matchpoint.description %]</option>
152                         [% END %]
153                     </select>
154                 </li>
155             </ol>
156         </fieldset>
158         <fieldset class="rows">
159             <legend>Default values</legend>
161             <ol>
162                 [% FOREACH borrower_field IN borrower_fields %]
164                     [% SWITCH borrower_field.field %]
165                     [% CASE 'branchcode' %]
166                         <li>
167                             <label class="description" for="branchcode">[% borrower_field.description %]: </label>
168                             <select id="branchcode" name="branchcode">
169                                 <option value="" selected="selected"></option>
170                                 [% FOREACH library IN Branches.all() %]
171                                     <option value="[% library.branchcode %]">[% library.branchname %]</option>
172                                 [% END %]
173                             </select>
174                             <span class="field_hint">[% borrower_field.field %]</span>
175                         </li>
176                     [% CASE 'categorycode' %]
177                         <li>
178                             <label class="description" for="categorycode">[% borrower_field.description %]: </label>
179                             <select id="categorycode" name="categorycode">
180                                 <option value="" selected="selected"></option>
181                                 [% FOREACH category IN categories %]
182                                     <option value="[% category.categorycode %]">[% category.description %]</option>
183                                 [% END %]
184                             </select>
185                             <span class="field_hint">[% borrower_field.field %]</span>
186                         </li>
187                     [% CASE %]
188                         <li>
189                             <label class="description" for="[% borrower_field.field %]">[% borrower_field.description %]: </label>
190                             <input id="[% borrower_field.field %]" name="[% borrower_field.field %]" />
191                             <span class="field_hint">[% borrower_field.field %]</span>
192                         </li>
193                     [% END %]
194                 [% END %]
196                 [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
197                     <li>
198                         <label class="description" for="patron_attributes">Patron attributes: </label>
199                         <input id="patron_attributes" name="patron_attributes" />
200                         <span class="field_hint">patron_attributes</span>
201                     </li>
202                 [% END %]
204             </ol>
205         </fieldset>
207         <fieldset class="rows">
208             <legend>If matching record is already in the borrowers table:</legend>
210             <ol>
211                 <li class="radio">
212                     <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>
213                 </li>
215                 <li class="radio">
216                     <input type="radio" id="overwrite_cardnumberyes" name="overwrite_cardnumber" value="1" /><label for="overwrite_cardnumberyes">Overwrite the existing one with this</label>
217                 </li>
218             </ol>
219         </fieldset>
221         [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
222             <fieldset class="rows">
223                 <legend>Patron attributes</legend>
225                 <ol>
226                     <li class="radio">
227                         <input type="radio" id="ext_preserve_0" name="ext_preserve" value="0" checked="checked" /><label for="ext_preserve_0">Replace all patron attributes</label>
228                     </li>
230                     <li class="radio">
231                         <input type="radio" id="ext_preserve_1" name="ext_preserve" value="1" /><label for="ext_preserve_1">Replace only included patron attributes</label>
232                     </li>
233                 </ol>
234             </fieldset>
235         [% END %]
237         <fieldset class="action">
238             <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
239             <input type="submit" value="Import" />
240         </fieldset>
241     </form>
242 [% END %]
244 </div>
246 <div class="yui-u">
247     <h2>Notes:</h2>
248     <ul>
249         <li>The first line in the file must be a header row defining which columns you are supplying in the import file.</li>
251         <li><b>Download a starter CSV file with all the columns <a href="?sample=1">here</a>.</b>  Values are comma-separated.</li>
253         <li>
254             OR choose which fields you want to supply from the following list:
255             <ul>
256                 <li>
257                     [% FOREACH columnkey IN borrower_fields %]'[% columnkey.field %]', [% END %]
258                 </li>
259             </ul>
260         </li>
262         [% IF ( ExtendedPatronAttributes ) %]
263             <li>
264                 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.
265             </li>
266         [% END %]
268         <li>
269             The fields 'branchcode' and 'categorycode' are <b>required</b> and <b>must match</b> valid entries in your database.
270         </li>
272         <li>
273             '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).
274         </li>
276         <li>
277             Date formats should match your system preference, and <b>must</b> be zero-padded, e.g. '01/02/2008'.  Alternatively,
278 you can supply dates in ISO format (e.g., '2010-10-28').
279         </li>
280     </ul>
281 </div>
282 </div>
283 </div>
284 </div>
286 <div class="yui-b noprint">
287     [% INCLUDE 'tools-menu.inc' %]
288 </div>
289 </div>
291 [% MACRO jsinclude BLOCK %]
292     [% INCLUDE 'calendar.inc' %]
293     [% Asset.js("js/tools-menu.js") %]
294     [% Asset.js("js/members-menu.js") %]
295     <script type="text/javascript">
296         $(document).ready(function() {
297             [%# Make date fields have the datepicker %]
298             $("#dateenrolled, #dateexpiry, #dateofbirth").datepicker();
299         });
300     </script>
301 [% END %]
302 [% INCLUDE 'intranet-bottom.inc' %]