6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha › Tools › Import patrons [% IF ( uploadborrowers ) %]› Results[% END %]</title>
8 [% INCLUDE 'doc-head-close.inc' %]
10 .yui-u fieldset.rows .widelabel { width: 12em; }
11 label.description { width: 20em; }
12 .line_error { width: 100%; }
13 code { background-color: yellow; }
17 <body id="tools_import_borrowers" class="tools">
18 [% INCLUDE 'header.inc' %]
19 [% INCLUDE 'patron-search.inc' %]
21 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › <a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a>[% IF ( uploadborrowers ) %] › Results[% END %]</div>
23 [% INCLUDE 'blocking_errors.inc' %]
24 <div class="main container-fluid">
26 <div class="col-sm-10 col-sm-push-2">
30 <div class="col-sm-6">
31 <h1>Import patrons</h1>
32 [% IF ( uploadborrowers ) %]
33 <h5>Import results :</h5>
35 <li>[% imported | html %] imported records [% IF ( lastimported ) %](last was [% lastimported | html %])[% END %]</li>
36 [% IF imported and patronlistname %]
37 <li>Patronlist with imported patrons: [% patronlistname | html %]</li>
39 <li>[% overwritten | html %] overwritten [% IF ( lastoverwritten ) %](last was [% lastoverwritten | html %])[% END %]</li>
40 <li>[% alreadyindb | html %] not imported because already in borrowers table and overwrite disabled [% IF ( lastalreadyindb ) %](last was [% lastalreadyindb | html %])[% END %]</li>
41 <li>[% invalid | html %] not imported because they are not in the expected format [% IF ( lastinvalid ) %](last was [% lastinvalid | html %])[% END %]</li>
42 <li>[% total | html %] records parsed</li>
43 <li><a href="/cgi-bin/koha/tools/tools-home.pl">Back to Tools</a></li>
52 [% FOREACH f IN feedback %]
54 [% IF ( f.filename ) %]
55 Parsing upload file <span class="filename">[% f.filename | html %]</span>
56 [% ELSIF ( f.backend ) %]
57 Upload parsed using [% f.backend | html %]
58 [% ELSIF ( f.headerrow ) %]
59 These fields found: [% f.value | html %]
60 [% ELSIF ( f.already_in_db ) %]
61 Patron already in database: [% f.value | html %]
63 [% f.name | html %] : [% f.value | html %]
75 <h5>Error analysis:</h5>
77 [% FOREACH e IN errors %]
78 [% IF ( e.badheader ) %]<li>Header row could not be parsed</li>[% END %]
80 [% FOREACH missing_critical IN e.missing_criticals %]
81 <li class="line_error">
82 Line <span class="linenumber">[% missing_critical.line | html %]</span>
84 [% IF ( missing_critical.badparse ) %]
86 [% ELSIF ( missing_critical.bad_date ) %]
87 has "[% missing_critical.key | html %]" in unrecognized format: "[% missing_critical.value | html %]"
89 Critical field "[% missing_critical.key | html %]"
91 [% IF ( missing_critical.branch_map ) %]
92 has unrecognized value "[% missing_critical.value | html %]"
93 [% ELSIF ( missing_critical.category_map ) %]
94 has unrecognized value "[% missing_critical.value | html %]"
99 (borrowernumber: [% missing_critical.borrowernumber | html %]; surname: [% missing_critical.surname | html %]).
103 <code>[% missing_critical.lineraw | html %]</code>
107 [% IF e.invalid_cardnumber %]
108 <li class="line_error">
109 Cardnumber [% e.cardnumber | html %] is not a valid cardnumber
110 [% IF e.borrowernumber %] (for patron with borrowernumber [% e.borrowernumber | html %])[% END %]
113 [% IF e.duplicate_userid %]
114 <li class="line_error">
115 Userid [% e.userid | html %] is already used by another patron.
124 <li>Select a file to import into the borrowers table</li>
125 <li>If a cardnumber exists in the table, you can choose whether to ignore the new one or overwrite the old one.</li>
128 <form method="post" action="[% SCRIPT_NAME | html %]" enctype="multipart/form-data">
129 <fieldset class="rows">
130 <legend>Import into the borrowers table</legend>
134 <label for="uploadborrowers">Select the file to import: </label>
135 <input type="file" id="uploadborrowers" name="uploadborrowers" />
139 <label for "createpatronlist">Create patron list: </label>
140 <input name="createpatronlist" id="createpatronlist" value="1" type="checkbox">
141 <span class="hint">List name will be file name with timestamp</span>
146 <fieldset class="rows">
147 <legend>Field to use for record matching</legend>
150 <select name="matchpoint" id="matchpoint">
151 <option value="cardnumber">Cardnumber</option>
152 <option value="userid">Username</option>
153 [% FOREACH matchpoint IN matchpoints %]
154 <option value="[% matchpoint.code | html %]">[% matchpoint.description | html %]</option>
161 <fieldset class="rows">
162 <legend>Default values</legend>
165 [% FOREACH borrower_field IN borrower_fields %]
167 [% SWITCH borrower_field.field %]
168 [% CASE 'branchcode' %]
170 <label class="description" for="branchcode">[% borrower_field.description | html %]: </label>
171 <select id="branchcode" name="branchcode">
172 <option value="" selected="selected"></option>
173 [% FOREACH library IN Branches.all() %]
174 <option value="[% library.branchcode | html %]">[% library.branchname | html %]</option>
177 <span class="field_hint">[% borrower_field.field | html %]</span>
179 [% CASE 'categorycode' %]
181 <label class="description" for="categorycode">[% borrower_field.description | html %]: </label>
182 <select id="categorycode" name="categorycode">
183 <option value="" selected="selected"></option>
184 [% FOREACH category IN categories %]
185 <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
188 <span class="field_hint">[% borrower_field.field | html %]</span>
192 <label class="description" for="[% borrower_field.field | html %]">[% borrower_field.description | html %]: </label>
193 <input id="[% borrower_field.field | html %]" name="[% borrower_field.field | html %]" type="text" />
194 <span class="field_hint">[% borrower_field.field | html %]</span>
199 [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
201 <label class="description" for="patron_attributes">Patron attributes: </label>
202 <input id="patron_attributes" name="patron_attributes" type="text" />
203 <span class="field_hint">patron_attributes</span>
210 <fieldset class="rows">
211 <legend>If matching record is already in the borrowers table:</legend>
215 <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>
219 <input type="radio" id="overwrite_cardnumberyes" name="overwrite_cardnumber" value="1" /><label for="overwrite_cardnumberyes">Overwrite the existing one with this</label>
224 [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
225 <fieldset class="rows">
226 <legend>Patron attributes</legend>
230 <input type="radio" id="ext_preserve_0" name="ext_preserve" value="0" /><label for="ext_preserve_0">Replace all patron attributes</label>
234 <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>
240 <fieldset class="action">
241 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
242 <input type="submit" value="Import" />
249 <div class="col-sm-6">
252 <li>The first line in the file must be a header row defining which columns you are supplying in the import file.</li>
254 <li><b>Download a starter CSV file with all the columns <a href="?sample=1">here</a>.</b> Values are comma-separated.</li>
257 OR choose which fields you want to supply from the following list:
260 [% FOREACH columnkey IN borrower_fields %]'[% columnkey.field | html %]', [% END %]
265 [% IF ( Koha.Preference('ExtendedPatronAttributes') ) %]
267 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>"STARTDATE:January 1, 2010","TRACK:Day"</b>. The second syntax would be required if the data might have a comma in it, like a date string.
272 <strong>Required fields:</strong> The fields 'surname', 'branchcode', and 'categorycode' are <em>required</em> and 'branchcode' and 'categorycode' <b>must match</b> valid entries in your database.
276 '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).
280 Date formats should match your system preference, and <b>must</b> be zero-padded, e.g. '01/02/2008'. Alternatively,
281 you can supply dates in ISO format (e.g., '2010-10-28').
288 </div> <!-- /.col-sm-10.col-sm-push-2 -->
290 <div class="col-sm-2 col-sm-pull-10">
292 [% INCLUDE 'tools-menu.inc' %]
294 </div> <!-- .col-sm-2.col-sm-pull-10 -->
295 </div> <!-- /.row -->
297 [% MACRO jsinclude BLOCK %]
298 [% INCLUDE 'calendar.inc' %]
299 [% Asset.js("js/tools-menu.js") | $raw %]
300 [% INCLUDE 'str/members-menu.inc' %]
301 [% Asset.js("js/members-menu.js") | $raw %]
303 $(document).ready(function() {
304 [%# Make date fields have the datepicker %]
305 $("#dateenrolled, #dateexpiry, #dateofbirth").datepicker();
309 [% INCLUDE 'intranet-bottom.inc' %]