Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
[kivitendo-erp.git] / templates / webpages / csv_import / form.html
index 0725a3f..e835ed5 100644 (file)
@@ -5,7 +5,7 @@
 
  [%- INCLUDE 'common/flash.html' %]
 
- <form method="post" action="controller.pl">
+ <form method="post" action="controller.pl" enctype="multipart/form-data">
   [% L.hidden_tag('action', 'CsvImport/dispatch') %]
   [% L.hidden_tag('profile.type', SELF.profile.type) %]
 
 
   <hr>
 
+  <h2>[%- LxERP.t8('Help on column names') %]</h2>
+
+  <div class="help_toggle">
+   <a href="#" onClick="javascript:$('.help_toggle').toggle()">[% LxERP.t8("Show help text") %]</a>
+  </div>
+
+  <div class="help_toggle" style="display:none">
+   <p><a href="#" onClick="javascript:$('.help_toggle').toggle()">[% LxERP.t8("Hide help text") %]</a></p>
+
+   <table>
+    <tr class="listheading">
+     <th>[%- LxERP.t8('Column name') %]</th>
+     <th>[%- LxERP.t8('Meaning') %]</th>
+    </tr>
+
+    [%- FOREACH row = SELF.displayable_columns %]
+     <tr class="listrow[% loop.count % 2 %]">
+      <td>[%- HTML.escape(row.name) %]</td>
+      <td>[%- HTML.escape(row.description) %]</td>
+     </tr>
+    [%- END %]
+   </table>
+
+[%- IF SELF.type == 'contacts' %]
+   <p>
+    [%- LxERP.t8('At least one of the columns #1, customer, customernumber, vendor, vendornumber (depending on the target table) is required for matching the entry to an existing customer or vendor.', 'cp_cv_id') %]
+   </p>
+
+[%- ELSIF SELF.type == 'addresses' %]
+   <p>
+    [%- LxERP.t8('At least one of the columns #1, customer, customernumber, vendor, vendornumber (depending on the target table) is required for matching the entry to an existing customer or vendor.', 'trans_id') %]
+   </p>
+
+[%- ELSIF SELF.type == 'parts' %]
+   <p>
+    [%- LxERP.t8("If the article type is set to 'mixed' then a column called 'type' must be present.") %]
+    [% LxERP.t8("Type can be either 'part' or 'service'.") %]
+   </p>
+[%- END %]
+
+   <p>
+    [%- L.submit_tag('action_download_sample', LxERP.t8('Download sample file')) %]
+   </p>
+
+  </div>
+
+  <hr>
+
   <h2>[%- LxERP.t8('Settings') %]</h2>
 
   <table>
    <tr>
-    <th align="right">[%- LxERP.t8('Number format') %]:</th>
+    <th align="right">[%- LxERP.t8('Number Format') %]:</th>
     <td colspan="10">
      [% SET options = L.options_for_select([ '1.000,00', '1000,00', '1,000.00', '1000.00' ], default => SELF.profile.get('numberformat')) %]
      [% L.select_tag('settings.numberformat', options, style => 'width: 300px') %]
     </td>
    </tr>
 
+   <tr>
+    <th align="right">[%- LxERP.t8('Check for duplicates') %]:</th>
+    <td colspan="10">
+     [% opts = [ [ 'no_check',  LxERP.t8('Do not check for duplicates') ],
+                 [ 'check_csv', LxERP.t8('Discard duplicate entries in CSV file') ],
+                 [ 'check_db',  LxERP.t8('Discard entries with duplicates in database or CSV file') ] ] %]
+     [% L.select_tag('settings.duplicates', L.options_for_select(opts, default => SELF.profile.get('duplicates')), style => 'width: 300px') %]
+    </td>
+   </tr>
+
+[%- IF SELF.type == 'parts' %]
+ [%- INCLUDE 'csv_import/_form_parts.html' %]
+[%- ELSIF SELF.type == 'customers_vendors' %]
+ [%- INCLUDE 'csv_import/_form_customers_vendors.html' %]
+[%- END %]
+
+   <tr>
+    <th align="right">[%- LxERP.t8('Preview Mode') %]:</th>
+    <td colspan="10">
+      [% L.radio_button_tag('settings.full_preview', value=2, checked=SELF.profile.get('full_preview')==2, label=LxERP.t8('Full Preview')) %]
+      [% L.radio_button_tag('settings.full_preview', value=1, checked=SELF.profile.get('full_preview')==1, label=LxERP.t8('Only Warnings and Errors')) %]
+      [% L.radio_button_tag('settings.full_preview', value=0, checked=!SELF.profile.get('full_preview'),   label=LxERP.t8('First 20 Lines')) %]
+    </td>
+   </tr>
+
+   <tr>
+    <th align="right">[%- LxERP.t8('Import file') %]:</th>
+    <td colspan="10">[% L.input_tag('file', '', type => 'file', accept => '*') %]</td>
+   </tr>
+
+   [%- IF SELF.file.exists %]
+    <tr>
+     <th align="right">[%- LxERP.t8('Existing file on server') %]:</th>
+     <td colspan="10">[%- LxERP.t8('Uploaded on #1, size #2 kB', SELF.file.displayable_mtime, LxERP.format_amount(SELF.file.size / 1024, 2)) %]</td>
+    </tr>
+   [%- END %]
+
   </table>
 
-  [% L.submit_tag('action_test', LxERP.t8('Gogogo')) %]
+  [% L.submit_tag('action_test', LxERP.t8('Test and preview')) %]
+  [% IF (SELF.import_status == 'tested') && SELF.num_importable %]
+   [% L.submit_tag('action_import', LxERP.t8('Import')) %]
+  [%- END %]
 
  </form>
 
+ [%- IF SELF.import_status %]
+  [%- IF SELF.errors %]
+   [%- PROCESS 'csv_import/_errors.html' %]
+  [%- END %]
+
+  [%- PROCESS 'csv_import/_result.html' %]
+  [%- PROCESS 'csv_import/_preview.html' %]
+ [%- END %]
+
  <script type="text/javascript">
   <!--
     $(document).ready(function() {