-[% USE HTML %][% USE LxERP %][% USE L %]
-<body>
+[%- USE HTML %]
+[%- USE LxERP %]
+[%- USE L %]
+[%- USE T8 %]
<div class="listtop">[% FORM.title %]</div>
[%- INCLUDE 'common/flash.html' %]
<form method="post" action="controller.pl" enctype="multipart/form-data">
+ [% L.hidden_tag('form_sent', '1') %]
[% L.hidden_tag('action', 'CsvImport/dispatch') %]
[% L.hidden_tag('profile.type', SELF.profile.type) %]
<tr>
<th align="right">[%- LxERP.t8('Existing profiles') %]:</th>
<td>
- [% L.select_tag('profile.id', L.options_for_select(SELF.all_profiles, title => 'name', default => SELF.profile.id), style => 'width: 300px') %]
+ [% L.select_tag('profile.id', SELF.all_profiles, title_key = 'name', default = SELF.profile.id, style = 'width: 300px') %]
</td>
<td>
[% L.submit_tag('action_new', LxERP.t8('Load profile')) %]
<div class="help_toggle" style="display:none">
<p><a href="#" onClick="javascript:$('.help_toggle').toggle()">[% LxERP.t8("Hide help text") %]</a></p>
- <p><b>Dieser Hilfetext wird demnaechst noch verbessert und wandert vermutlich in ein Popup.</b></p>
+ [%- IF SELF.worker.is_multiplexed %]
+ <table>
+ <tr class="listheading">
+ [%- FOREACH p = SELF.worker.profile %]
+ <th>[%- p.row_ident %]</th>
+ [%- END %]
+ </tr>
+ <tr class="listrow[% loop.count % 2 %]">
+ [%- FOREACH p = SELF.worker.profile %]
+ [% SET ri = p.row_ident %]
+ <td>
+ <table>
+ <tr class="listheading">
+ <th>[%- LxERP.t8('Column name') %]</th>
+ <th>[%- LxERP.t8('Meaning') %]</th>
+ </tr>
+
+ [%- FOREACH row = SELF.displayable_columns.$ri %]
+ <tr class="listrow[% loop.count % 2 %]">
+ <td>[%- HTML.escape(row.name) %]</td>
+ <td>[%- HTML.escape(row.description) %]</td>
+ </tr>
+ [%- END %]
+ </table>
+ </td>
+ [%- END %]
+ </tr>
+ </table>
+ [%- ELSE %]
+ <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>
+ [%- END %]
- <table>
- <tr class="listheading">
- <th>[%- LxERP.t8('Column name') %]</th>
- <th>[%- LxERP.t8('Meaning') %]</th>
- </tr>
+[%- IF SELF.type == 'contacts' %]
+ <p>
+ [%- LxERP.t8("You can update existing contacts by providing the 'cp_id' column with their database IDs. Otherwise: ") %]
+ [%- 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>
+
+ <p>
+ [1]:
+ [% LxERP.t8('The three columns "make_X", "model_X" and "lastcost_X" with the same number "X" are used to import vendor part numbers and vendor prices.') %]
+ [% LxERP.t8('The column triplets can occur multiple times with different numbers "X" each time (e.g. "make_1", "model_1", "lastcost_1", "make_2", "model_2", "lastcost_2", "make_3", "model_3", "lastcost_3" etc).') %]
+ [% LxERP.t8('The items are imported accoring do their number "X" regardless of the column order inside the file.') %]
+ [% LxERP.t8('The column "make_X" can contain either a vendor\'s database ID, a vendor number or a vendor\'s name.') %]
+ </p>
+ <p>
+ [2]:
+ [% LxERP.t8('Onhand only sets the quantity in master data, not in inventory. This is only a legacy info field and will be overwritten as soon as a inventory transfer happens.') %]
+ </p>
+
+[%- ELSIF SELF.type == 'orders' %]
+ <p>
+ [1]:
+ [% LxERP.t8('The column "datatype" must be present and must be the first column. The values must be the row names (see settings) for order and item data respectively.') %]
+ </p>
+ <p>
+ [2]:
+ [%- LxERP.t8('Amount and net amount are calculated by kivitendo. "verify_amount" and "verify_netamount" can be used for sanity checks.') %]<br>
+ [%- LxERP.t8('If amounts differ more than "Maximal amount difference" (see settings), this item is marked as invalid.') %]<br>
+ </p>
+[%- END %]
+
+ <p>
+ [%- L.submit_tag('action_download_sample', LxERP.t8('Download sample file')) %]
+ </p>
- [%- 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>
</div>
<hr>
<h2>[%- LxERP.t8('Settings') %]</h2>
+ <div class="settings_toggle"[% UNLESS SELF.deferred || SELF.import_status %] style="display:none"[% END %]>
+ <a href="#" onClick="javascript:$('.settings_toggle').toggle()">[% LxERP.t8("Show settings") %]</a>
+ </div>
+
+ <div class="settings_toggle"[% IF SELF.deferred || SELF.import_status %] style="display:none"[% END %]>
+ <p><a href="#" onClick="javascript:$('.settings_toggle').toggle()">[% LxERP.t8("Hide settings") %]</a></p>
+
<table>
<tr>
<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') %]
+ [% L.select_tag('settings.numberformat', ['1.000,00', '1000,00', '1,000.00', '1000.00'], default = SELF.profile.get('numberformat'), style = 'width: 300px') %]
</td>
</tr>
<tr>
<th align="right">[%- LxERP.t8('Charset') %]:</th>
- <td colspan="10">[% L.select_tag('settings.charset', L.options_for_select(SELF.all_charsets, default => SELF.profile.get('charset')), style => 'width: 300px') %]</td>
+ <td colspan="10">[% L.select_tag('settings.charset', SELF.all_charsets, default = SELF.profile.get('charset'), style = 'width: 300px') %]</td>
</tr>
<tr>
</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>
+ [% duplicate_fields = SELF.worker.get_duplicate_check_fields() %]
+ [% IF ( duplicate_fields.size ) %]
+ <tr>
+ <th align="right">[%- LxERP.t8('Check for duplicates') %]:</th>
+
+ <td colspan=10>
+ [% FOREACH key = duplicate_fields.keys %]
+ <input type="checkbox" name="settings.duplicates_[% key | html %]" id="settings.duplicates_[% key | html %]" value="1"[% IF ( SELF.profile.get('duplicates_'_ key) || (duplicate_fields.$key.default && !FORM.form_sent ) ) %] checked="checked"[% END %]>
+ <label for="settings.duplicates_[% key | html %]">[% duplicate_fields.$key.label | html %]</label>
+ [% END %]
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right"></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', opts, default = SELF.profile.get('duplicates'), style = 'width: 300px') %]
+ </td>
+ </tr>
+ [% END %]
[%- IF SELF.type == 'parts' %]
[%- INCLUDE 'csv_import/_form_parts.html' %]
[%- ELSIF SELF.type == 'customers_vendors' %]
[%- INCLUDE 'csv_import/_form_customers_vendors.html' %]
+[%- ELSIF SELF.type == 'contacts' %]
+ [%- INCLUDE 'csv_import/_form_contacts.html' %]
+[%- ELSIF SELF.type == 'orders' %]
+ [%- INCLUDE 'csv_import/_form_orders.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>
</table>
+ </div>
+ <hr>
+
[% 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 %]
+ [% L.submit_tag('action_import', LxERP.t8('Import'), style='display:none') %]
</form>
- [%- IF SELF.import_status %]
- [%- IF SELF.errors %]
- [%- PROCESS 'csv_import/_errors.html' %]
- [%- END %]
-
- [%- PROCESS 'csv_import/_result.html' %]
- [%- PROCESS 'csv_import/_preview.html' %]
+ <div id='results'>
+ [%- IF SELF.deferred %]
+ [%- PROCESS 'csv_import/_deferred_results.html' %]
+ [%- ELSIF SELF.import_status %]
+ [%- PROCESS 'csv_import/_results.html' %]
[%- END %]
+ </div>
+
<script type="text/javascript">
<!--
$(document).ready(function() {
$('#action_save').click(function() {
- if ($('#profile_name').attr('value') != '')
+ if ($('#profile_name').val() != '')
return true;
alert('[% LxERP.t8('Please enter a profile name.') %]');
return false;
});
-->
</script>
-</body>
-</html>