Bug 27846: (follow-up) Add id back to breadcrumbs container
[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 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Tools &rsaquo; Import patrons [% IF ( uploadborrowers ) %]&rsaquo; Results[% END %]</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 <style>
10     .yui-u fieldset.rows .widelabel { width: 12em; }
11     label.description { width: 20em; }
12     .line_error { width: 100%; }
13     code { background-color: yellow; }
14 </style>
15 </head>
16
17 <body id="tools_import_borrowers" class="tools">
18 [% INCLUDE 'header.inc' %]
19 [% INCLUDE 'patron-search.inc' %]
20
21 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
22     <ol>
23         <li>
24             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
25         </li>
26         <li>
27             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
28         </li>
29         [% IF ( uploadborrowers ) %]
30             <li>
31                 <a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a>
32             </li>
33             <li>
34                 <a href="#" aria-current="page">
35                     Results
36                 </a>
37             </li>
38         [% ELSE %]
39             <li>
40                 <a href="#" aria-current="page">
41                     Import patrons
42                 </a>
43             </li>
44         [% END %]
45     </ol>
46 </nav>
47
48 [% INCLUDE 'blocking_errors.inc' %]
49 <div class="main container-fluid">
50     <div class="row">
51         <div class="col-sm-10 col-sm-push-2">
52             <main>
53
54     <div class="row">
55      <div class="col-sm-6">
56 <h1>Import patrons</h1>
57 [% IF ( uploadborrowers ) %]
58     <h5>Import results :</h5>
59     <ul>
60         <li>[% imported | html %] imported records [% IF ( lastimported ) %](last was [% lastimported | html %])[% END %]</li>
61         [% IF imported and patronlistname %]
62             <li>Patronlist with imported patrons: [% patronlistname | html %]</li>
63         [% END %]
64         <li>[% overwritten | html %] overwritten [% IF ( lastoverwritten ) %](last was [% lastoverwritten | html %])[% END %]</li>
65         <li>[% alreadyindb | html %] not imported because already in borrowers table and overwrite disabled [% IF ( lastalreadyindb ) %](last was [% lastalreadyindb | html %])[% END %]</li>
66         <li>[% invalid | html %] not imported because they are not in the expected format [% IF ( lastinvalid ) %](last was [% lastinvalid | html %])[% END %]</li>
67         <li>[% total | html %] records parsed</li>
68         <li><a href="/cgi-bin/koha/tools/tools-home.pl">Back to Tools</a></li>
69     </ul>
70
71     [% IF ( feedback ) %]
72         <br /><br />
73
74         <div>
75             <h5>Feedback:</h5>
76                 <ul class="feedback">
77                     [% FOREACH f IN feedback %]
78                         <li>
79                             [% IF ( f.filename ) %]
80                                 Parsing upload file <span class="filename">[% f.filename | html %]</span>
81                             [% ELSIF ( f.backend ) %]
82                                 Upload parsed using [% f.backend | html %]
83                             [% ELSIF ( f.headerrow ) %]
84                                 These fields found: [% f.value | html %]
85                             [% ELSIF ( f.already_in_db ) %]
86                                 Patron already in database: [% f.value | html %]
87                             [% ELSE %]
88                                 [% f.name | html %] : [% f.value | html %]
89                             [% END %]
90                         </li>
91                     [% END %]
92                 </ul>
93         </div>
94     [% END %]
95
96     [% IF ( errors ) %]
97         <br /><br />
98
99         <div>
100             <h5>Error analysis:</h5>
101             <ul>
102                 [% FOREACH e IN errors %]
103                     [% IF ( e.badheader ) %]<li>Header row could not be parsed</li>[% END %]
104
105                     [% FOREACH missing_critical IN e.missing_criticals %]
106                         <li class="line_error">
107                             Line <span class="linenumber">[% missing_critical.line | html %]</span>
108
109                             [% IF ( missing_critical.badparse ) %]
110                                 could not be parsed!
111                             [% ELSIF ( missing_critical.bad_date ) %]
112                                 has &quot;[% missing_critical.key | html %]&quot; in unrecognized format: &quot;[% missing_critical.value | html %]&quot;
113                             [% ELSE %]
114                                 Critical field &quot;[% missing_critical.key | html %]&quot;
115
116                                 [% IF ( missing_critical.branch_map ) %]
117                                     has unrecognized value &quot;[% missing_critical.value | html %]&quot;
118                                 [% ELSIF ( missing_critical.category_map ) %]
119                                     has unrecognized value &quot;[% missing_critical.value | html %]&quot;
120                                 [% ELSE %]
121                                     missing
122                                 [% END %]
123
124                                 (borrowernumber: [% missing_critical.borrowernumber | html %]; surname: [% missing_critical.surname | html %]).
125                             [% END %]
126
127                             <br/>
128                             <code>[% missing_critical.lineraw | html %]</code>
129                         </li>
130                     [% END %]
131
132                     [% IF e.invalid_cardnumber %]
133                         <li class="line_error">
134                             Cardnumber [% e.cardnumber | html %] is not a valid cardnumber
135                             [% IF e.borrowernumber %] (for patron with borrowernumber [% e.borrowernumber | html %])[% END %]
136                         </li>
137                     [% END %]
138                     [% IF e.duplicate_userid %]
139                         <li class="line_error">
140                             Userid [% e.userid | html %] is already used by another patron.
141                         </li>
142                     [% END %]
143                     [% IF e.passwd_too_short %]
144                         <li class="line_error">
145                             Password is too short for patron with borrowernumber [% e.borrowernumber | html %]. Minimum length is [% e.min_length | html %], length is [% e.length | html %]
146                         </li>
147                     [% END %]
148                     [% IF e.passwd_whitespace %]
149                         <li class="line_error">
150                             Password contains whitespace for patron with borrowernumber [% e.borrowernumber | html %].
151                         </li>
152                     [% END %]
153                     [% IF e.passwd_too_weak %]
154                         <li class="line_error">
155                             Password is too weak for patron with borrowernumber [% e.borrowernumber | html %].
156                         </li>
157                     [% END %]
158                     [% IF e.passwd_plugin_err %]
159                         <li class="line_error">
160                             Password plugin error for patron with borrowernumber [% e.borrowernumber | html %].
161                         </li>
162                     [% END %]
163                     [% IF e.passwd_unknown_err %]
164                         <li class="line_error">
165                             Password error for patron with borrowernumber [% e.borrowernumber | html %].
166                         </li>
167                     [% END %]
168                 [% END %]
169             </ul>
170         </div>
171     [% END %]
172 [% ELSE %]
173     <ul>
174         <li>Select a file to import into the borrowers table</li>
175         <li>If a cardnumber exists in the table, you can choose whether to ignore the new one or overwrite the old one.</li>
176     </ul>
177
178     <form method="post" action="[% SCRIPT_NAME | html %]" enctype="multipart/form-data">
179         <fieldset class="rows">
180             <legend>Import into the borrowers table</legend>
181
182             <ol>
183                 <li>
184                     <label for="uploadborrowers">Select the file to import: </label>
185                     <input type="file" id="uploadborrowers" name="uploadborrowers" />
186                 </li>
187
188                 <li>
189                     <label for "createpatronlist">Create patron list: </label>
190                     <input name="createpatronlist" id="createpatronlist" value="1" type="checkbox">
191                     <span class="hint">List name will be file name with timestamp</span>
192                 </li>
193             </ol>
194         </fieldset>
195
196         <fieldset class="rows">
197             <legend>Field to use for record matching</legend>
198             <ol>
199                 <li class="radio">
200                     <select name="matchpoint" id="matchpoint">
201                         <option value="cardnumber">Cardnumber</option>
202                         <option value="userid">Username</option>
203                         [% FOREACH matchpoint IN matchpoints %]
204                             <option value="[% matchpoint.code | html %]">[% matchpoint.description | html %]</option>
205                         [% END %]
206                     </select>
207                 </li>
208             </ol>
209         </fieldset>
210
211         <fieldset class="rows">
212             <legend>
213                 <a href="#" class="expand_defaults"><i class="fa fa-plus-square"></i> Enter default values</a>
214                 <a href="#" class="expand_defaults" style="display:none;"><i class="fa fa-minus-square"></i> Hide default value fields</a>
215             </legend>
216
217             <ol class="default_values" style="display:none;">
218                 [% FOREACH borrower_field IN borrower_fields %]
219
220                     [% SWITCH borrower_field.field %]
221                     [% CASE 'branchcode' %]
222                         <li>
223                             <label class="description" for="branchcode">[% borrower_field.description | html %]: </label>
224                             <select id="branchcode" name="branchcode">
225                                 <option value="" selected="selected"></option>
226                                 [% FOREACH library IN Branches.all() %]
227                                     <option value="[% library.branchcode | html %]">[% library.branchname | html %]</option>
228                                 [% END %]
229                             </select>
230                             <span class="field_hint">[% borrower_field.field | html %]</span>
231                         </li>
232                     [% CASE 'categorycode' %]
233                         <li>
234                             <label class="description" for="categorycode">[% borrower_field.description | html %]: </label>
235                             <select id="categorycode" name="categorycode">
236                                 <option value="" selected="selected"></option>
237                                 [% FOREACH category IN categories %]
238                                     <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
239                                 [% END %]
240                             </select>
241                             <span class="field_hint">[% borrower_field.field | html %]</span>
242                         </li>
243                     [% CASE %]
244                         <li>
245                             <label class="description" for="[% borrower_field.field | html %]">[% borrower_field.description | html %]: </label>
246                             <input id="[% borrower_field.field | html %]" name="[% borrower_field.field | html %]" type="text" />
247                             <span class="field_hint">[% borrower_field.field | html %]</span>
248                         </li>
249                     [% END %]
250                 [% END %]
251
252                 [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
253                     <li>
254                         <label class="description" for="patron_attributes">Patron attributes: </label>
255                         <input id="patron_attributes" name="patron_attributes" type="text" />
256                         <span class="field_hint">patron_attributes</span>
257                     </li>
258                 [% END %]
259
260             </ol>
261         </fieldset>
262
263         <fieldset class="rows">
264             <legend>If matching record is already in the borrowers table:</legend>
265
266             <ol>
267                 <li class="radio">
268                     <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>
269                 </li>
270
271                 <li class="radio">
272                     <input type="radio" id="overwrite_cardnumberyes" name="overwrite_cardnumber" value="1" /><label for="overwrite_cardnumberyes">Overwrite the existing one with this</label>
273                     <ul>
274                         <li>
275                             <input class="overwrite_passwords" type="checkbox" id="overwrite_passwords" name="overwrite_passwords" disabled/>
276                             <label class="overwrite_passwords" for="overwrite_passwords">Replace patron passwords with those in the file (blank passwords will be ignored)</label>
277                         </li
278                     </ul>
279                 </li>
280             </ol>
281         </fieldset>
282
283         [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
284             <fieldset class="rows">
285                 <legend>Patron attributes</legend>
286
287                 <ol>
288                     <li class="radio">
289                         <input type="radio" id="ext_preserve_0" name="ext_preserve" value="0" /><label for="ext_preserve_0">Replace all patron attributes</label>
290                     </li>
291
292                     <li class="radio">
293                         <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>
294                     </li>
295                 </ol>
296             </fieldset>
297         [% END %]
298
299         <fieldset class="action">
300             <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
301             <input type="submit" value="Import" />
302         </fieldset>
303     </form>
304 [% END %]
305
306 </div>
307
308 <div class="col-sm-6">
309     <h2>Notes:</h2>
310     <ul>
311         <li>The first line in the file must be a header row defining which columns you are supplying in the import file.</li>
312
313         <li><strong>Download a <a href="?sample=1">Starter CSV file</a> with all the columns.</strong>  Values are comma-separated.</li>
314
315         <li>
316             OR choose which fields you want to supply from the following list:
317             <ul>
318                 <li>
319                     [% FOREACH columnkey IN borrower_fields %]'[% columnkey.field | html %]', [% END %]
320                 </li>
321             </ul>
322         </li>
323
324         [% IF ( Koha.Preference('ExtendedPatronAttributes') ) %]
325             <li>
326                 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.
327             </li>
328         [% END %]
329
330         <li>
331             <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.
332         </li>
333
334         <li>
335             '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.
336         </li>
337
338         <li>
339             Date formats should match your system preference, and <strong>must</strong> be zero-padded, e.g. '01/02/2008'.  Alternatively,
340 you can supply dates in ISO format (e.g., '2010-10-28').
341         </li>
342     </ul>
343 </div>
344 </div>
345
346             </main>
347         </div> <!-- /.col-sm-10.col-sm-push-2 -->
348
349         <div class="col-sm-2 col-sm-pull-10">
350             <aside>
351                 [% INCLUDE 'tools-menu.inc' %]
352             </aside>
353         </div> <!-- .col-sm-2.col-sm-pull-10 -->
354      </div> <!-- /.row -->
355
356 [% MACRO jsinclude BLOCK %]
357     [% INCLUDE 'calendar.inc' %]
358     [% Asset.js("js/tools-menu.js") | $raw %]
359     [% INCLUDE 'str/members-menu.inc' %]
360     [% Asset.js("js/members-menu.js") | $raw %]
361     <script>
362         $(document).ready(function() {
363             [%# Make date fields have the datepicker %]
364             $("#dateenrolled, #dateexpiry, #dateofbirth").datepicker();
365
366             $(".expand_defaults").click(function(e){
367                 e.preventDefault();
368                 $(".default_values").toggle();
369                 $(".expand_defaults").toggle();
370             });
371         });
372
373         $("#overwrite_cardnumberno").click(function(){
374             $("#overwrite_passwords").prop('checked',false).prop('disabled',true);
375         });
376         $("#overwrite_cardnumberyes").click(function(){
377             $("#overwrite_passwords").prop('disabled',false);
378         });
379     </script>
380 [% END %]
381 [% INCLUDE 'intranet-bottom.inc' %]