Bug 14790 - Add OPAC view link to items editor
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / import_borrowers.tt
index 756e086..d9f25db 100644 (file)
@@ -1,17 +1,29 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Tools &rsaquo; Import Patrons [% IF ( uploadborrowers ) %]&rsaquo; Results[% END %]</title>
+<title>Koha &rsaquo; Tools &rsaquo; Import patrons [% IF ( uploadborrowers ) %]&rsaquo; Results[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <style type="text/css">
-    .yui-u fieldset.rows label.widelabel { width: 12em; }
+    .yui-u fieldset.rows .widelabel { width: 12em; }
+    label.description { width: 20em; }
     .line_error { width: 100%; }
     code { background-color: yellow; }
 </style>
+<script type="text/javascript">
+//<![CDATA[
+    $(document).ready(function() {
+        [%# Make date fields have the datepicker %]
+        $("#dateenrolled").addClass('datepicker');
+        $("#dateexpiry").addClass('datepicker');
+        $("#dateofbirth").addClass('datepicker');
+    });
+</script>
 </head>
-<body>
+<body id="tools_import_borrowers" class="tools">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
+[% INCLUDE 'calendar.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/tools/import_borrowers.pl">Import Patrons</a>[% IF ( uploadborrowers ) %] &rsaquo; Results[% END %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a>[% IF ( uploadborrowers ) %] &rsaquo; Results[% END %]</div>
 
 <div id="doc3" class="yui-t2">
  <div id="bd">
@@ -19,7 +31,7 @@
    <div class="yui-b">
     <div class="yui-g">
      <div class="yui-u first">
-<h1>Import Patrons</h1>
+<h1>Import patrons</h1>
 [% IF ( uploadborrowers ) %]
 <h5>Import results :</h5>
 <ul>
             <br /><code>[% missing_critical.lineraw %]</code>
         </li>
         [% END %]
+        [% IF ERROR.invalid_cardnumber %]
+            <li class="line_error">
+                Cardnumber [% ERROR.cardnumber %] is not a valid cardnumber
+                [% IF ERROR.borrowernumber %] (for patron with borrowernumber [% ERROR.borrowernumber %])[% END %]
+            </li>
+        [% END %]
+        [% IF ERROR.duplicate_userid %]
+            <li class="line_error">
+                Userid [% ERROR.userid %] is already used by another patron.
+            </li>
+        [% END %]
     [% END %]
     </ul>
     </div>
   [% END %]
 [% ELSE %]
 <ul>
-       <li>Select a file to import into the borrowers table</li>
-       <li>If a cardnumber exists in the table, you can choose whether to ignore the new one or overwrite the old one.</li>
+    <li>Select a file to import into the borrowers table.</li>
+    <li>If a cardnumber exists in the table, you can choose whether to ignore the new one or overwrite the old one.</li>
 </ul>
 <form method="post" action="[% SCRIPT_NAME %]" enctype="multipart/form-data">
 <fieldset class="rows">
             <li class="radio">
                 <select name="matchpoint" id="matchpoint">
                     <option value="cardnumber">Cardnumber</option>
+                    <option value="userid">Username</option>
                     [% FOREACH matchpoint IN matchpoints %]
                         <option value="[% matchpoint.code %]">[% matchpoint.description %]</option>
                     [% END %]
 <fieldset class="rows">
 <legend>Default values</legend>
 <ol>
-    [% FOREACH columnkey IN columnkeys %]
-       <li>
-               <label class="widelabel" for="[% columnkey.key %]">[% columnkey.key %]</label>
-               <input id="[% columnkey.key %]" name="[% columnkey.key %]" />
-       </li>
-    [% END %]
+[% FOREACH borrower_field IN borrower_fields %]
+  [% SWITCH borrower_field.field %]
+  [% CASE 'branchcode' %]
+    <li>
+        <label class="description" for="branchcode">[% borrower_field.description %]: </label>
+        <select id="branchcode" name="branchcode">
+            <option value="" selected="selected"></option>
+        [% FOREACH branch IN branches %]
+            <option value="[% branch.branchcode %]">
+                [% branch.branchname %]</option>
+        [% END %]
+        </select><span class="field_hint">[% borrower_field.field %]</span>
+    </li>
+  [% CASE 'categorycode' %]
+    <li>
+        <label class="description" for="categorycode">[% borrower_field.description %]: </label>
+        <select id="categorycode" name="categorycode">
+            <option value="" selected="selected"></option>
+        [% FOREACH category IN categories %]
+            <option value="[% category.categorycode %]">
+                [% category.description %]</option>
+        [% END %]
+        </select><span class="field_hint">[% borrower_field.field %]</span>
+    </li>
+  [% CASE %]
+    <li>
+        <label class="description" for="[% borrower_field.field %]">[% borrower_field.description %]: </label>
+        <input id="[% borrower_field.field %]" name="[% borrower_field.field %]" /><span class="field_hint">[% borrower_field.field %]</span>
+    </li>
+  [% END %]
+[% END %]
+[% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
+    <li>
+        <label class="description" for="patron_attributes">Patron attributes: </label>
+        <input id="patron_attributes" name="patron_attributes" />
+        <span class="field_hint">patron_attributes</span>
+    </li>
+[% END %]
 </ol></fieldset>
        <fieldset class="rows">
        <legend>If matching record is already in the borrowers table:</legend>
         </li>
     </ol>
     </fieldset>
-    [% IF ( ExtendedPatronAttributes ) %]
+    [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
        <fieldset class="rows">
-       <legend>Patron Attributes</legend>
+    <legend>Patron attributes</legend>
     <ol><li class="radio">
-        <input type="radio" id="ext_preserve_0" name="ext_preserve" value="0" checked="checked" /><label for="ext_preserve_0">Replace all Patron Attributes</label>
+        <input type="radio" id="ext_preserve_0" name="ext_preserve" value="0" checked="checked" /><label for="ext_preserve_0">Replace all patron attributes</label>
         </li>
         <li class="radio">
-        <input type="radio" id="ext_preserve_1" name="ext_preserve" value="1" /><label for="ext_preserve_1">Replace only included Patron Attributes</label>
+        <input type="radio" id="ext_preserve_1" name="ext_preserve" value="1" /><label for="ext_preserve_1">Replace only included patron attributes</label>
         </li>
     </ol>
     </fieldset>
 <div class="yui-u">
 <h2>Notes:</h2>
 <ul>
-<li>The first line in the file must be a header row defining which columns you are supplying in the import file.</li>
-<li><b>Download a starter CSV file with all the columns <a href="?sample=1">here</a>.</b>  Values are comma-separated.</li>
-<li>OR choose which fields you want to supply from the following list:<ul><li>
-    [% FOREACH columnkey IN columnkeys %]'[% columnkey.key %]', [% END %]
-</li></ul></li>
-[% IF ( ExtendedPatronAttributes ) %]
-<li>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>&quot;STARTDATE:January 1, 2010&quot;,&quot;TRACK:Day&quot;</b>.  The second syntax would be required if the data might have a comma in it, like a date string.
+<li><b>Header: </b>The first line in the file must be a header row defining which columns you are supplying in the import file.</li>
+<li><b>Separator: </b>Values are comma-separated.</li>
+<li><b>Starter CSV: </b> Koha provides a starter CSV with all the columns.
+    <ul><li><a href="?sample=1">Download starter CSV</a></li></ul>
+</li>
+<li><b>Field list: </b>Alternatively, you can create your own CSV and choose which fields you want to supply from the following list:
+    <ul><li>
+       [% FOREACH columnkey IN borrower_fields %]'[% columnkey.field %]', [% END %]
+    </li></ul>
 </li>
+[% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
+<li><b>Extended patron attributes: </b>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.
+    <ul><li>Example 1: INSTID:12345,LANG:fr</li><li>Example 2: STARTDATE:January 1 2010,TRACK:Day</li></ul>
+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:
+    <ul><li>Example 3: &quot;STARTDATE:January 1, 2010&quot;,&quot;TRACK:Day&quot;</li></ul>
+The second syntax would be required if the data might have a comma in it, like a date string.</li>
 [% END %]
-<li>The fields 'branchcode' and 'categorycode' are <b>required</b> and <b>must match</b> valid entries in your database.</li>
-<li>'password' should be stored in plaintext, and will be converted to a MD5 hash (if your passwords are already encrypted, talk to your system administrator about options).</li>
-<li>Date formats should match your system preference, and <b>must</b> be zero-padded, e.g. '01/02/2008'.  Alternatively,
-you can supply dates in ISO format (e.g., '2010-10-28').
+<li><b>Required fields: </b>The fields 'branchcode' and 'categorycode' are required and must match valid entries in your database.</li>
+<li><b>Password: </b>Values for the field '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).</li>
+<li><b>Date formats: </b> Date values should match your system preference, and must be zero-padded.
+    <ul><li>Example: '01/02/2008'</li></ul>
+Alternatively, you can supply dates in ISO format.
+    <ul><li>Example: '2010-10-28'</li></ul>
 </li>
 </ul>