6 [% INCLUDE 'doc-head-open.inc' %]
8 [% IF ( uploadborrowers ) %]
9 Results › [% END %]
10 Import patrons › Tools › Koha
12 [% INCLUDE 'doc-head-close.inc' %]
14 .yui-u fieldset.rows .widelabel { width: 12em; }
15 label.description { width: 20em; }
16 .line_error { width: 100%; }
17 code { background-color: yellow; }
21 <body id="tools_import_borrowers" class="tools">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'patron-search.inc' %]
25 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
28 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
31 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
33 [% IF ( uploadborrowers ) %]
35 <a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a>
38 <a href="#" aria-current="page">
44 <a href="#" aria-current="page">
52 [% INCLUDE 'blocking_errors.inc' %]
53 <div class="main container-fluid">
55 <div class="col-sm-10 col-sm-push-2">
59 <div class="col-sm-6">
60 <h1>Import patrons</h1>
61 [% IF ( uploadborrowers ) %]
62 <h5>Import results :</h5>
64 <li>[% imported | html %] imported records [% IF ( lastimported ) %](last was [% lastimported | html %])[% END %]</li>
65 [% IF imported and patronlistname %]
66 <li>Patronlist with imported patrons: [% patronlistname | html %]</li>
68 <li>[% overwritten | html %] overwritten [% IF ( lastoverwritten ) %](last was [% lastoverwritten | html %])[% END %]</li>
69 <li>[% alreadyindb | html %] not imported because already in borrowers table and overwrite disabled [% IF ( lastalreadyindb ) %](last was [% lastalreadyindb | html %])[% END %]</li>
70 <li>[% invalid | html %] not imported because they are not in the expected format [% IF ( lastinvalid ) %](last was [% lastinvalid | html %])[% END %]</li>
71 <li>[% total | html %] records parsed</li>
72 <li><a href="/cgi-bin/koha/tools/tools-home.pl">Back to Tools</a></li>
81 [% FOREACH f IN feedback %]
83 [% IF ( f.filename ) %]
84 Parsing upload file <span class="filename">[% f.filename | html %]</span>
85 [% ELSIF ( f.backend ) %]
86 Upload parsed using [% f.backend | html %]
87 [% ELSIF ( f.headerrow ) %]
88 These fields found: [% f.value | html %]
89 [% ELSIF ( f.already_in_db ) %]
90 Patron already in database: [% f.value | html %]
92 [% f.name | html %] : [% f.value | html %]
104 <h5>Error analysis:</h5>
106 [% FOREACH e IN errors %]
107 [% IF ( e.badheader ) %]<li>Header row could not be parsed</li>[% END %]
109 [% FOREACH missing_critical IN e.missing_criticals %]
110 <li class="line_error">
111 Line <span class="linenumber">[% missing_critical.line | html %]</span>
113 [% IF ( missing_critical.badparse ) %]
115 [% ELSIF ( missing_critical.bad_date ) %]
116 has "[% missing_critical.key | html %]" in unrecognized format: "[% missing_critical.value | html %]"
118 Critical field "[% missing_critical.key | html %]"
120 [% IF ( missing_critical.branch_map ) %]
121 has unrecognized value "[% missing_critical.value | html %]"
122 [% ELSIF ( missing_critical.category_map ) %]
123 has unrecognized value "[% missing_critical.value | html %]"
128 (borrowernumber: [% missing_critical.borrowernumber | html %]; surname: [% missing_critical.surname | html %]).
132 <code>[% missing_critical.lineraw | html %]</code>
136 [% IF e.invalid_cardnumber %]
137 <li class="line_error">
138 Cardnumber [% e.cardnumber | html %] is not a valid cardnumber
139 [% IF e.borrowernumber %] (for patron with borrowernumber [% e.borrowernumber | html %])[% END %]
142 [% IF e.duplicate_userid %]
143 <li class="line_error">
144 Userid [% e.userid | html %] is already used by another patron.
147 [% IF e.passwd_too_short %]
148 <li class="line_error">
149 Password is too short for patron with borrowernumber [% e.borrowernumber | html %]. Minimum length is [% e.min_length | html %], length is [% e.length | html %]
152 [% IF e.passwd_whitespace %]
153 <li class="line_error">
154 Password contains whitespace for patron with borrowernumber [% e.borrowernumber | html %].
157 [% IF e.passwd_too_weak %]
158 <li class="line_error">
159 Password is too weak for patron with borrowernumber [% e.borrowernumber | html %].
162 [% IF e.passwd_plugin_err %]
163 <li class="line_error">
164 Password plugin error for patron with borrowernumber [% e.borrowernumber | html %].
167 [% IF e.passwd_unknown_err %]
168 <li class="line_error">
169 Password error for patron with borrowernumber [% e.borrowernumber | html %].
172 [% IF e.patron_attribute_unique_id_constraint %]
173 <li class="line_error">
174 [% IF e.borrowernumber %]
175 Patron attribute [% e.attribute.code | html %] must be unique for patron with borrowernumber [% e.borrowernumber | html %].
177 Patron attribute [% e.attribute.code | html %] must be unique for patron [% e.patron_id | html %].
181 [% IF e.patron_attribute_invalid_type %]
182 <li class="line_error">
183 [% IF e.borrowernumber %]
184 Patron attribute [% e.attribute_type_code | html %] is invalid for patron with borrowernumber [% e.borrowernumber | html %].
186 Patron attribute [% e.attribute_type_code | html %] is invalid for patron [% e.patron_id | html %].
190 [% IF e.patron_attribute_non_repeatable %]
191 <li class="line_error">
192 [% IF e.borrowernumber %]
193 Patron attribute [% e.attribute.code | html %] is non-repeatable for patron with borrowernumber [% e.borrowernumber | html %].
195 Patron attribute [% e.attribute.code | html %] is non-repeatable for patron [% e.patron_id | html %].
205 <li>Select a file to import into the borrowers table</li>
206 <li>If a cardnumber exists in the table, you can choose whether to ignore the new one or overwrite the old one.</li>
209 <form method="post" action="[% SCRIPT_NAME | html %]" enctype="multipart/form-data">
210 <fieldset class="rows">
211 <legend>Import into the borrowers table</legend>
215 <label for="uploadborrowers">Select the file to import: </label>
216 <input type="file" id="uploadborrowers" name="uploadborrowers" />
220 <label for "createpatronlist">Create patron list: </label>
221 <input name="createpatronlist" id="createpatronlist" value="1" type="checkbox">
222 <span class="hint">List name will be file name with timestamp</span>
227 <fieldset class="rows">
228 <legend>Field to use for record matching</legend>
231 <select name="matchpoint" id="matchpoint">
232 <option value="cardnumber">Cardnumber</option>
233 <option value="userid">Username</option>
234 [% FOREACH matchpoint IN matchpoints %]
235 <option value="[% matchpoint.code | html %]">[% matchpoint.description | html %]</option>
242 <fieldset class="rows">
244 <a href="#" class="expand_defaults"><i class="fa fa-plus-square"></i> Enter default values</a>
245 <a href="#" class="expand_defaults" style="display:none;"><i class="fa fa-minus-square"></i> Hide default value fields</a>
248 <ol class="default_values" style="display:none;">
249 [% FOREACH borrower_field IN borrower_fields %]
251 [% SWITCH borrower_field.field %]
252 [% CASE 'branchcode' %]
254 <label class="description" for="branchcode">[% borrower_field.description | html %]: </label>
255 <select id="branchcode" name="branchcode">
256 <option value="" selected="selected"></option>
257 [% FOREACH library IN Branches.all() %]
258 <option value="[% library.branchcode | html %]">[% library.branchname | html %]</option>
261 <span class="field_hint">[% borrower_field.field | html %]</span>
263 [% CASE 'categorycode' %]
265 <label class="description" for="categorycode">[% borrower_field.description | html %]: </label>
266 <select id="categorycode" name="categorycode">
267 <option value="" selected="selected"></option>
268 [% FOREACH category IN categories %]
269 <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
272 <span class="field_hint">[% borrower_field.field | html %]</span>
276 <label class="description" for="[% borrower_field.field | html %]">[% borrower_field.description | html %]: </label>
277 <input id="[% borrower_field.field | html %]" name="[% borrower_field.field | html %]" type="text" />
278 <span class="field_hint">[% borrower_field.field | html %]</span>
283 [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
285 <label class="description" for="patron_attributes">Patron attributes: </label>
286 <input id="patron_attributes" name="patron_attributes" type="text" />
287 <span class="field_hint">patron_attributes</span>
293 <fieldset class="rows">
295 <a href="#" class="expand_preserves"><i class="fa fa-plus-square"></i> Preserve existing values</a>
296 <a href="#" class="expand_preserves" style="display:none;"><i class="fa fa-minus-square"></i> Hide preserve value fields</a>
299 <ol class="preserve_values" style="display:none;">
300 <div class="hint">Selected fields will be preserved from original patron record when overwriting existing patron.</div>
301 [% FOREACH borrower_field IN borrower_fields %]
303 <label class="description" for="preserve_existing_[% borrower_field.field | html %]">[% borrower_field.description | html %]: </label>
304 <input name="preserve_existing" id="preserve_existing_[% borrower_field.field | html %]" value="[% borrower_field.field | html %]" type="checkbox">
305 <span class="field_hint">[% borrower_field.field | html %]</span>
311 <fieldset class="rows">
312 <legend>If matching record is already in the borrowers table:</legend>
316 <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>
320 <input type="radio" id="overwrite_cardnumberyes" name="overwrite_cardnumber" value="1" /><label for="overwrite_cardnumberyes">Overwrite the existing one with this</label>
323 <input class="overwrite_passwords" type="checkbox" id="overwrite_passwords" name="overwrite_passwords" disabled/>
324 <label class="overwrite_passwords" for="overwrite_passwords">Replace patron passwords with those in the file (blank passwords will be ignored)</label>
331 [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
332 <fieldset class="rows">
333 <legend>Patron attributes</legend>
337 <input type="radio" id="ext_preserve_0" name="ext_preserve" value="0" /><label for="ext_preserve_0">Replace all patron attributes</label>
341 <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>
347 <fieldset class="action">
348 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
349 <input type="submit" value="Import" />
356 <div class="col-sm-6">
359 <li>The first line in the file must be a header row defining which columns you are supplying in the import file.</li>
361 <li><strong>Download a <a href="?sample=1">Starter CSV file</a> with all the columns.</strong> Values are comma-separated.</li>
364 OR choose which fields you want to supply from the following list:
367 [% FOREACH columnkey IN borrower_fields %]'[% columnkey.field | html %]', [% END %]
372 [% IF ( Koha.Preference('ExtendedPatronAttributes') ) %]
374 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.
379 <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.
383 '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.
387 Date formats should match your system preference, and <strong>must</strong> be zero-padded, e.g. '01/02/2008'. Alternatively,
388 you can supply dates in ISO format (e.g., '2010-10-28').
395 </div> <!-- /.col-sm-10.col-sm-push-2 -->
397 <div class="col-sm-2 col-sm-pull-10">
399 [% INCLUDE 'tools-menu.inc' %]
401 </div> <!-- .col-sm-2.col-sm-pull-10 -->
402 </div> <!-- /.row -->
404 [% MACRO jsinclude BLOCK %]
405 [% INCLUDE 'calendar.inc' %]
406 [% Asset.js("js/tools-menu.js") | $raw %]
407 [% INCLUDE 'str/members-menu.inc' %]
408 [% Asset.js("js/members-menu.js") | $raw %]
410 $(document).ready(function() {
411 [%# Make date fields have the datepicker %]
412 $("#dateenrolled, #dateexpiry, #dateofbirth").datepicker();
414 $(".expand_defaults").click(function(e){
416 $(".default_values").toggle();
417 $(".expand_defaults").toggle();
420 $(".expand_preserves").click(function(e){
422 $(".preserve_values").toggle();
423 $(".expand_preserves").toggle();
427 $("#overwrite_cardnumberno").click(function(){
428 $("#overwrite_passwords").prop('checked',false).prop('disabled',true);
430 $("#overwrite_cardnumberyes").click(function(){
431 $("#overwrite_passwords").prop('disabled',false);
435 [% INCLUDE 'intranet-bottom.inc' %]