Bug 34098: Improve translation of some strings in the patron import template
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / import_borrowers.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% PROCESS 'i18n.inc' %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% FILTER collapse %]
9     [% IF ( uploadborrowers ) %]
10         [% t("Results") | html %] &rsaquo;
11     [% END %]
12     [% t("Import patrons") | html %] &rsaquo;
13     [% t("Tools") | html %] &rsaquo;
14     [% t("Koha") | html %]
15 [% END %]</title>
16 [% INCLUDE 'doc-head-close.inc' %]
17 <style>
18     label.description { width: 20em; }
19     .line_error { width: 100%; }
20     code { background-color: yellow; }
21 </style>
22 </head>
23
24 <body id="tools_import_borrowers" class="tools">
25 [% WRAPPER 'header.inc' %]
26     [% INCLUDE 'patron-search-header.inc' %]
27 [% END %]
28
29 [% WRAPPER 'sub-header.inc' %]
30     [% WRAPPER breadcrumbs %]
31         [% WRAPPER breadcrumb_item %]
32             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
33         [% END %]
34         [% IF ( uploadborrowers ) %]
35             [% WRAPPER breadcrumb_item %]
36                 <a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a>
37             [% END %]
38             [% WRAPPER breadcrumb_item bc_active= 1 %]
39                 <span>Results</span>
40             [% END %]
41         [% ELSE %]
42             [% WRAPPER breadcrumb_item bc_active= 1 %]
43                 <span>Import patrons</span>
44             [% END %]
45         [% END %]
46     [% END #/ WRAPPER breadcrumbs %]
47 [% END #/ WRAPPER sub-header.inc %]
48
49 [% INCLUDE 'blocking_errors.inc' %]
50 <div class="main container-fluid">
51     <div class="row">
52         <div class="col-sm-10 col-sm-push-2">
53             <main>
54
55     <div class="row">
56      <div class="col-sm-6">
57 <h1>Import patrons</h1>
58 [% IF ( uploadborrowers ) %]
59     <h2>Import results</h2>
60     <ul>
61         <li>
62             [% tpx("Patron import", "{count_of_imported_records} imported records", {count_of_imported_records = imported}) | html %]
63             [% IF ( lastimported ) %]
64                 [% tpx("Patron import", "(last was {last_imported_record})", {last_imported_record = lastimported}) | html %]
65             [% END %]
66         </li>
67         [% IF imported and patronlistname %]
68             <li>Patron list with imported patrons: [% patronlistname | html %]</li>
69         [% END %]
70         <li>
71             [% tpx("Patron import", "{count_of_overwritten_records} overwritten records", {count_of_overwritten_records = overwritten}) | html %]
72             [% IF ( lastoverwritten ) %]
73                 [% tpx("Patron import", "(last was {last_overwritten_record})", {last_overwritten_record = lastoverwritten}) | html %]
74             [% END %]
75         </li>
76         <li>
77             [% tpx("Patron import", "{count_of_existing_records} not imported because they are already in borrowers table and overwrite is disabled ", {count_of_existing_records = alreadyindb}) | html %]
78             [% IF ( lastalreadyindb ) %]
79                 [% tpx("Patron import", "(last was {last_existing_record})", {last_existing_record = lastalreadyindb}) | html %]
80             [% END %]
81         </li>
82         <li>
83             [% tpx("Patron import", "{count_of_invalid_records} not imported because they are not in the expected format", {count_of_invalid_records = invalid}) | html %]
84             [% IF ( lastinvalid ) %]
85                 [% tpx("Patron import", "(last was {last_invalid_record})", {last_invalid_record = lastinvalid}) | html %]
86             [% END %]
87         <li>
88             [% tpx("Patron import", "{total} records parsed", {total = total}) | html %]
89         </li>
90         <li><a href="/cgi-bin/koha/tools/tools-home.pl">Back to Tools</a></li>
91     </ul>
92
93     [% IF ( feedback ) %]
94         <br /><br />
95
96         <div>
97             <h2>Feedback</h2>
98                 <ul class="feedback">
99                     [% FOREACH f IN feedback %]
100                         <li>
101                             [% IF ( f.filename ) %]
102                                 <span>Parsing upload file</span> <span class="filename">[% f.filename | html %]</span>
103                             [% ELSIF ( f.backend ) %]
104                                 <span>Upload parsed using [% f.backend | html %]</span>
105                             [% ELSIF ( f.headerrow ) %]
106                                 <span>These fields found: [% f.value | html %]</span>
107                             [% ELSIF ( f.already_in_db ) %]
108                                 <span>Patron already in database: [% f.value | html %]</span>
109                             [% ELSE %]
110                                 [% f.name | html %] : [% f.value | html %]
111                             [% END %]
112                         </li>
113                     [% END %]
114                 </ul>
115         </div>
116     [% END %]
117
118     [% IF ( errors ) %]
119         <br /><br />
120
121         <div>
122             <h2>Error analysis</h2>
123             <ul>
124                 [% FOREACH e IN errors %]
125                     [% IF ( e.badheader ) %]<li>Header row could not be parsed</li>[% END %]
126
127                     [% FOREACH missing_critical IN e.missing_criticals %]
128                         <li class="line_error">
129                             Line <span class="linenumber">[% missing_critical.line | html %]</span>
130
131                             [% IF ( missing_critical.badparse ) %]
132                                 <span>could not be parsed!</span>
133                             [% ELSIF ( missing_critical.bad_date ) %]
134                                 <span>has &quot;[% missing_critical.key | html %]&quot; in unrecognized format:</span> &quot;[% missing_critical.value | html %]&quot;
135                             [% ELSE %]
136                                 <span>Critical field &quot;[% missing_critical.key | html %]&quot;</span>
137
138                                 [% IF ( missing_critical.branch_map ) %]
139                                     <span>has unrecognized value &quot;[% missing_critical.value | html %]&quot;</span>
140                                 [% ELSIF ( missing_critical.category_map ) %]
141                                     <span>has unrecognized value &quot;[% missing_critical.value | html %]&quot;</span>
142                                 [% ELSE %]
143                                     <span>missing</span>
144                                 [% END %]
145
146                                 (<span>borrowernumber: [% missing_critical.borrowernumber | html %]</span>; <span>surname: [% missing_critical.surname | html %]</span>).
147                             [% END %]
148
149                             <br/>
150                             <code>[% missing_critical.lineraw | html %]</code>
151                         </li>
152                     [% END %]
153
154                     [% IF e.invalid_cardnumber %]
155                         <li class="line_error">
156                             Card number [% e.cardnumber | html %] is not a valid card number
157                             [% IF e.borrowernumber %] (for patron with borrowernumber [% e.borrowernumber | html %])[% END %]
158                         </li>
159                     [% END %]
160                     [% IF e.duplicate_userid %]
161                         <li class="line_error">
162                             Userid [% e.userid | html %] is already used by another patron.
163                         </li>
164                     [% END %]
165                     [% IF e.passwd_too_short %]
166                         <li class="line_error">
167                             Password is too short for patron with borrowernumber [% e.borrowernumber | html %]. Minimum length is [% e.min_length | html %], length is [% e.length | html %]
168                         </li>
169                     [% END %]
170                     [% IF e.passwd_whitespace %]
171                         <li class="line_error">
172                             Password contains whitespace for patron with borrowernumber [% e.borrowernumber | html %].
173                         </li>
174                     [% END %]
175                     [% IF e.passwd_too_weak %]
176                         <li class="line_error">
177                             Password is too weak for patron with borrowernumber [% e.borrowernumber | html %].
178                         </li>
179                     [% END %]
180                     [% IF e.passwd_plugin_err %]
181                         <li class="line_error">
182                             Password plugin error for patron with borrowernumber [% e.borrowernumber | html %].
183                         </li>
184                     [% END %]
185                     [% IF e.passwd_unknown_err %]
186                         <li class="line_error">
187                             Password error for patron with borrowernumber [% e.borrowernumber | html %].
188                         </li>
189                     [% END %]
190                     [% IF e.patron_attribute_unique_id_constraint %]
191                         <li class="line_error">
192                             [% IF e.borrowernumber %]
193                                 <span>Patron attribute [% e.attribute.code | html %] must be unique for patron with borrowernumber [% e.borrowernumber | html %].</span>
194                             [% ELSE %]
195                                 <span>Patron attribute [% e.attribute.code | html %] must be unique for patron [% e.patron_id | html %].</span>
196                             [% END %]
197                         </li>
198                     [% END %]
199                     [% IF e.patron_attribute_invalid_type %]
200                         <li class="line_error">
201                             [% IF e.borrowernumber %]
202                                 <span>Patron attribute [% e.attribute_type_code | html %] is invalid for patron with borrowernumber [% e.borrowernumber | html %].</span>
203                             [% ELSE %]
204                                 <span>Patron attribute [% e.attribute_type_code | html %] is invalid for patron [% e.patron_id | html %].</span>
205                             [% END %]
206                         </li>
207                     [% END %]
208                     [% IF e.patron_attribute_non_repeatable %]
209                         <li class="line_error">
210                             [% IF e.borrowernumber %]
211                                 <span>Patron attribute [% e.attribute.code | html %] is non-repeatable for patron with borrowernumber [% e.borrowernumber | html %].</span>
212                             [% ELSE %]
213                                 <span>Patron attribute [% e.attribute.code | html %] is non-repeatable for patron [% e.patron_id | html %].</span>
214                             [% END %]
215                         </li>
216                     [% END %]
217                 [% END %]
218             </ul>
219         </div>
220     [% END %]
221 [% ELSE %]
222     <ul>
223         <li>Select a file to import into the borrowers table</li>
224         <li>If a card number exists in the table, you can choose whether to ignore the new one or overwrite the old one.</li>
225     </ul>
226
227     <form method="post" action="[% SCRIPT_NAME | html %]" enctype="multipart/form-data">
228         <fieldset class="rows">
229             <legend>Import into the borrowers table</legend>
230
231             <ol>
232                 <li>
233                     <label for="uploadborrowers">Select the file to import: </label>
234                     <input type="file" id="uploadborrowers" name="uploadborrowers" />
235                 </li>
236
237                 <li>
238                     <label for "createpatronlist">Create patron list: </label>
239                     <input name="createpatronlist" id="createpatronlist" value="1" type="checkbox">
240                     <span class="hint">List name will be file name with timestamp</span>
241                 </li>
242             </ol>
243         </fieldset>
244
245         <fieldset class="rows">
246             <legend>Field to use for record matching</legend>
247             <ol>
248                 <li class="radio">
249                     <select name="matchpoint" id="matchpoint">
250                         <option value="cardnumber">Card number</option>
251                         <option value="userid">Username</option>
252                         [% FOREACH matchpoint IN matchpoints %]
253                             <option value="[% matchpoint.code | html %]">[% matchpoint.description | html %]</option>
254                         [% END %]
255                     </select>
256                 </li>
257             </ol>
258         </fieldset>
259
260         <fieldset class="rows">
261             <legend>
262                 <a href="#" class="expand_defaults"><i class="fa fa-plus-square"></i> Enter default values</a>
263                 <a href="#" class="expand_defaults" style="display:none;"><i class="fa fa-minus-square"></i> Hide default value fields</a>
264             </legend>
265
266             <ol class="default_values" style="display:none;">
267                 [% FOREACH borrower_db_column IN borrower_fields.keys.sort %]
268                     [% SWITCH borrower_db_column %]
269                     [% CASE 'branchcode' %]
270                         <li>
271                             <label class="description" for="branchcode">[% borrower_fields.$borrower_db_column | html %]: </label>
272                             <select id="branchcode" name="branchcode">
273                                 <option value="" selected="selected"></option>
274                                 [% FOREACH library IN Branches.all() %]
275                                     <option value="[% library.branchcode | html %]">[% library.branchname | html %]</option>
276                                 [% END %]
277                             </select>
278                             <span class="field_hint">[% borrower_db_column | html %]</span>
279                         </li>
280                     [% CASE 'categorycode' %]
281                         <li>
282                             <label class="description" for="categorycode">[% borrower_fields.$borrower_db_column | html %]: </label>
283                             <select id="categorycode" name="categorycode">
284                                 <option value="" selected="selected"></option>
285                                 [% FOREACH category IN categories %]
286                                     <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
287                                 [% END %]
288                             </select>
289                             <span class="field_hint">[% borrower_db_column | html %]</span>
290                         </li>
291                     [% CASE %]
292                         <li>
293                             <label class="description" for="[% borrower_db_column| html %]">[% borrower_fields.$borrower_db_column | html %]: </label>
294                             <input id="[% borrower_db_column | html %]" name="[% borrower_db_column | html %]" type="text" />
295                             <span class="field_hint">[% borrower_db_column | html %]</span>
296                         </li>
297                     [% END %]
298                 [% END %]
299
300                 [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
301                     <li>
302                         <label class="description" for="patron_attributes">Patron attributes: </label>
303                         <input id="patron_attributes" name="patron_attributes" type="text" />
304                         <span class="field_hint">patron_attributes</span>
305                     </li>
306                 [% END %]
307
308             </ol>
309         </fieldset>
310         <fieldset class="rows">
311             <legend>
312                 <a href="#" class="expand_preserves"><i class="fa fa-plus-square"></i> Preserve existing values</a>
313                 <a href="#" class="expand_preserves" style="display:none;"><i class="fa fa-minus-square"></i> Hide preserve value fields</a>
314             </legend>
315
316             <ol class="preserve_values" style="display:none;">
317                 <div class="hint">Selected fields will be preserved from original patron record when overwriting existing patron.</div>
318                 [% FOREACH borrower_db_column IN borrower_fields.keys.sort %]
319                         <li>
320                             <label class="description" for="preserve_existing_[% borrower_db_column | html %]">[% borrower_fields.$borrower_db_column | html %]: </label>
321                             <input name="preserve_existing" id="preserve_existing_[%  borrower_db_column | html %]" value="[%  borrower_db_column | html %]" type="checkbox">
322                             <span class="field_hint">[% borrower_db_column | html %]</span>
323                         </li>
324                 [% END %]
325             </ol>
326         </fieldset>
327
328         <fieldset class="brief">
329             <legend>If matching record is already in the borrowers table:</legend>
330
331             <ol>
332                 <li class="radio">
333                     <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>
334                 </li>
335
336                 <li class="radio">
337                     <input type="radio" id="overwrite_cardnumberyes" name="overwrite_cardnumber" value="1" /><label for="overwrite_cardnumberyes">Overwrite the existing one with this</label>
338                     <ol>
339                         <li>
340                             <label class="update_dateexpiry" for="update_dateexpiry">Renew existing patrons</label>
341                             <select class="update_dateexpiry" type="select" id="update_dateexpiry" name="update_dateexpiry" disabled/>
342                                 <option value="">using the dateexpiry value in the file, if present</option>
343                                 <option value="dateexpiry">from the current membership expiry date</option>
344                                 <option value="now">from the current date</option>
345                             </select>
346                         </li>
347                         <li>
348                             <input class="overwrite_passwords" type="checkbox" id="overwrite_passwords" name="overwrite_passwords" disabled/>
349                             <label class="overwrite_passwords" for="overwrite_passwords">Replace patron passwords with those in the file (blank passwords will be ignored)</label>
350                         </li>
351                     </ol>
352                 </li>
353             </ol>
354         </fieldset>
355
356         [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
357             <fieldset class="brief">
358                 <legend>Patron attributes</legend>
359
360                 <ol>
361                     <li class="radio">
362                         <input type="radio" id="ext_preserve_0" name="ext_preserve" value="0" /><label for="ext_preserve_0">Replace all patron attributes</label>
363                     </li>
364
365                     <li class="radio">
366                         <input type="radio" id="ext_preserve_1" name="ext_preserve" value="1" checked="checked" /><label for="ext_preserve_1">Replace only included patron attributes</label>
367                     </li>
368                 </ol>
369             </fieldset>
370         [% END %]
371
372         <fieldset class="rows">
373             <legend>Welcome email</legend>
374             <ol>
375                 <li>
376                     <input class="welcome_new" type="checkbox" id="welcome_new" name="welcome_new"/>
377                     <label class="welcome_new" for="welcome_new">Send email to new patrons</label>
378                     <span class="hint"> WELCOME notice is used</span>
379                 </li>
380             </ol>
381         </fieldset>
382
383         <fieldset class="action">
384             <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
385             <input type="submit" class="btn btn-primary" value="Import" />
386         </fieldset>
387     </form>
388 [% END %]
389
390 </div>
391
392 <div class="col-sm-6 page-section bg-info">
393     <h2>Notes:</h2>
394     <ul>
395         <li>The first line in the file must be a header row defining which columns you are supplying in the import file.</li>
396
397         <li>
398             <strong>
399                 <a href="?sample=1">Download a Starter CSV file with all the columns.</a>
400             </strong>
401             [% tp("CSV file", "Values are comma-separated.") | html %]
402         </li>
403
404         <li>
405             OR choose which fields you want to supply from the following list:
406             <ul>
407                 <li>
408                     [% FOREACH columnkey IN borrower_fields.keys.sort %]'[% columnkey | html %]', [% END %]
409                 </li>
410             </ul>
411         </li>
412
413         [% IF ( Koha.Preference('ExtendedPatronAttributes') ) %]
414             <li>
415                 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: <strong>INSTID:12345,LANG:fr</strong> or <strong>STARTDATE:January 1 2010,TRACK:Day</strong>. 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: <strong>&quot;STARTDATE:January 1, 2010&quot;,&quot;TRACK:Day&quot;</strong>.  The second syntax would be required if the data might have a comma in it, like a date string.
416             </li>
417         [% END %]
418
419         <li>
420             <strong>Required fields:</strong> The fields 'surname', 'branchcode', and 'categorycode' are <em>required</em> and 'branchcode' and 'categorycode' <strong>must match</strong> valid entries in your database.
421         </li>
422
423         <li>
424             '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). Passwords will not be updated on overwrite unless replace passwords option is checked.
425         </li>
426
427         <li>
428             Date formats should match your system preference, and <strong>must</strong> be zero-padded, e.g. '01/02/2008'.  Alternatively,
429 you can supply dates in ISO format (e.g., '2010-10-28').
430         </li>
431     </ul>
432 </div>
433 </div>
434
435             </main>
436         </div> <!-- /.col-sm-10.col-sm-push-2 -->
437
438         <div class="col-sm-2 col-sm-pull-10">
439             <aside>
440                 [% INCLUDE 'tools-menu.inc' %]
441             </aside>
442         </div> <!-- .col-sm-2.col-sm-pull-10 -->
443      </div> <!-- /.row -->
444
445 [% MACRO jsinclude BLOCK %]
446     [% INCLUDE 'calendar.inc' %]
447     [% Asset.js("js/tools-menu.js") | $raw %]
448     [% INCLUDE 'str/members-menu.inc' %]
449     [% Asset.js("js/members-menu.js") | $raw %]
450     <script>
451         $(document).ready(function() {
452             [%# Make date fields have the datepicker %]
453             $("#dateenrolled, #dateexpiry, #dateofbirth").flatpickr({
454                 altInput: true,
455                 altFormat: flatpickr_dateformat_string,
456                 altInputClass: 'flatpickr-input',
457                 dateFormat: "Y-m-d",
458             });
459
460             $(".expand_defaults").click(function(e){
461                 e.preventDefault();
462                 $(".default_values").toggle();
463                 $(".expand_defaults").toggle();
464             });
465
466             $(".expand_preserves").click(function(e){
467                 e.preventDefault();
468                 $(".preserve_values").toggle();
469                 $(".expand_preserves").toggle();
470             });
471         });
472
473         $("#overwrite_cardnumberno").click(function(){
474             $("#overwrite_passwords").prop('checked',false).prop('disabled',true);
475             $("#update_dateexpiry").prop('checked',false).prop('disabled',true);
476         });
477         $("#overwrite_cardnumberyes").click(function(){
478             $("#overwrite_passwords").prop('disabled',false);
479             $("#update_dateexpiry").prop('disabled',false);
480         });
481     </script>
482 [% END %]
483 [% INCLUDE 'intranet-bottom.inc' %]