5 [% PROCESS 'i18n.inc' %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% FILTER collapse %]
9 [% IF ( uploadborrowers ) %]
10 [% t("Results") | html %] ›
12 [% t("Import patrons") | html %] ›
13 [% t("Tools") | html %] ›
14 [% t("Koha") | html %]
16 [% INCLUDE 'doc-head-close.inc' %]
18 label.description { width: 20em; }
19 .line_error { width: 100%; }
20 code { background-color: yellow; }
24 <body id="tools_import_borrowers" class="tools">
25 [% WRAPPER 'header.inc' %]
26 [% INCLUDE 'patron-search-header.inc' %]
29 [% WRAPPER 'sub-header.inc' %]
30 [% WRAPPER breadcrumbs %]
31 [% WRAPPER breadcrumb_item %]
32 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
34 [% IF ( uploadborrowers ) %]
35 [% WRAPPER breadcrumb_item %]
36 <a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a>
38 [% WRAPPER breadcrumb_item bc_active= 1 %]
42 [% WRAPPER breadcrumb_item bc_active= 1 %]
43 <span>Import patrons</span>
46 [% END #/ WRAPPER breadcrumbs %]
47 [% END #/ WRAPPER sub-header.inc %]
49 [% INCLUDE 'blocking_errors.inc' %]
50 <div class="main container-fluid">
52 <div class="col-sm-10 col-sm-push-2">
56 <div class="col-sm-6">
57 <h1>Import patrons</h1>
58 [% IF ( uploadborrowers ) %]
59 <h2>Import results</h2>
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 %]
67 [% IF imported and patronlistname %]
68 <li>Patron list with imported patrons: [% patronlistname | html %]</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 %]
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 %]
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 %]
88 [% tpx("Patron import", "{total} records parsed", {total = total}) | html %]
90 <li><a href="/cgi-bin/koha/tools/tools-home.pl">Back to Tools</a></li>
99 [% FOREACH f IN feedback %]
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>
110 [% f.name | html %] : [% f.value | html %]
122 <h2>Error analysis</h2>
124 [% FOREACH e IN errors %]
125 [% IF ( e.badheader ) %]<li>Header row could not be parsed</li>[% END %]
127 [% FOREACH missing_critical IN e.missing_criticals %]
128 <li class="line_error">
129 Line <span class="linenumber">[% missing_critical.line | html %]</span>
131 [% IF ( missing_critical.badparse ) %]
132 <span>could not be parsed!</span>
133 [% ELSIF ( missing_critical.bad_date ) %]
134 <span>has "[% missing_critical.key | html %]" in unrecognized format:</span> "[% missing_critical.value | html %]"
136 <span>Critical field "[% missing_critical.key | html %]"</span>
138 [% IF ( missing_critical.branch_map ) %]
139 <span>has unrecognized value "[% missing_critical.value | html %]"</span>
140 [% ELSIF ( missing_critical.category_map ) %]
141 <span>has unrecognized value "[% missing_critical.value | html %]"</span>
146 (<span>borrowernumber: [% missing_critical.borrowernumber | html %]</span>; <span>surname: [% missing_critical.surname | html %]</span>).
150 <code>[% missing_critical.lineraw | html %]</code>
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 %]
160 [% IF e.duplicate_userid %]
161 <li class="line_error">
162 Userid [% e.userid | html %] is already used by another patron.
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 %]
170 [% IF e.passwd_whitespace %]
171 <li class="line_error">
172 Password contains whitespace for patron with borrowernumber [% e.borrowernumber | html %].
175 [% IF e.passwd_too_weak %]
176 <li class="line_error">
177 Password is too weak for patron with borrowernumber [% e.borrowernumber | html %].
180 [% IF e.passwd_plugin_err %]
181 <li class="line_error">
182 Password plugin error for patron with borrowernumber [% e.borrowernumber | html %].
185 [% IF e.passwd_unknown_err %]
186 <li class="line_error">
187 Password error for patron with borrowernumber [% e.borrowernumber | html %].
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>
195 <span>Patron attribute [% e.attribute.code | html %] must be unique for patron [% e.patron_id | html %].</span>
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>
204 <span>Patron attribute [% e.attribute_type_code | html %] is invalid for patron [% e.patron_id | html %].</span>
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>
213 <span>Patron attribute [% e.attribute.code | html %] is non-repeatable for patron [% e.patron_id | html %].</span>
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>
227 <form method="post" action="[% SCRIPT_NAME | html %]" enctype="multipart/form-data">
228 <fieldset class="rows">
229 <legend>Import into the borrowers table</legend>
233 <label for="uploadborrowers">Select the file to import: </label>
234 <input type="file" id="uploadborrowers" name="uploadborrowers" />
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>
245 <fieldset class="rows">
246 <legend>Field to use for record matching</legend>
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>
260 <fieldset class="rows">
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>
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' %]
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>
278 <span class="field_hint">[% borrower_db_column | html %]</span>
280 [% CASE 'categorycode' %]
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>
289 <span class="field_hint">[% borrower_db_column | html %]</span>
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>
300 [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
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>
310 <fieldset class="rows">
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>
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 %]
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>
328 <fieldset class="brief">
329 <legend>If matching record is already in the borrowers table:</legend>
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>
337 <input type="radio" id="overwrite_cardnumberyes" name="overwrite_cardnumber" value="1" /><label for="overwrite_cardnumberyes">Overwrite the existing one with this</label>
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>
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>
356 [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
357 <fieldset class="brief">
358 <legend>Patron attributes</legend>
362 <input type="radio" id="ext_preserve_0" name="ext_preserve" value="0" /><label for="ext_preserve_0">Replace all patron attributes</label>
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>
372 <fieldset class="rows">
373 <legend>Welcome email</legend>
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>
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" />
392 <div class="col-sm-6 page-section bg-info">
395 <li>The first line in the file must be a header row defining which columns you are supplying in the import file.</li>
399 <a href="?sample=1">Download a Starter CSV file with all the columns.</a>
401 [% tp("CSV file", "Values are comma-separated.") | html %]
405 OR choose which fields you want to supply from the following list:
408 [% FOREACH columnkey IN borrower_fields.keys.sort %]'[% columnkey | html %]', [% END %]
413 [% IF ( Koha.Preference('ExtendedPatronAttributes') ) %]
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>"STARTDATE:January 1, 2010","TRACK:Day"</strong>. The second syntax would be required if the data might have a comma in it, like a date string.
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.
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.
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').
436 </div> <!-- /.col-sm-10.col-sm-push-2 -->
438 <div class="col-sm-2 col-sm-pull-10">
440 [% INCLUDE 'tools-menu.inc' %]
442 </div> <!-- .col-sm-2.col-sm-pull-10 -->
443 </div> <!-- /.row -->
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 %]
451 $(document).ready(function() {
452 [%# Make date fields have the datepicker %]
453 $("#dateenrolled, #dateexpiry, #dateofbirth").flatpickr({
455 altFormat: flatpickr_dateformat_string,
456 altInputClass: 'flatpickr-input',
460 $(".expand_defaults").click(function(e){
462 $(".default_values").toggle();
463 $(".expand_defaults").toggle();
466 $(".expand_preserves").click(function(e){
468 $(".preserve_values").toggle();
469 $(".expand_preserves").toggle();
473 $("#overwrite_cardnumberno").click(function(){
474 $("#overwrite_passwords").prop('checked',false).prop('disabled',true);
475 $("#update_dateexpiry").prop('checked',false).prop('disabled',true);
477 $("#overwrite_cardnumberyes").click(function(){
478 $("#overwrite_passwords").prop('disabled',false);
479 $("#update_dateexpiry").prop('disabled',false);
483 [% INCLUDE 'intranet-bottom.inc' %]