6  <div class="listtop">[% FORM.title %]</div>
 
   8  [%- INCLUDE 'common/flash.html' %]
 
  10  <form method="post" action="controller.pl" enctype="multipart/form-data">
 
  11   [% L.hidden_tag('form_sent', '1') %]
 
  12   [% L.hidden_tag('action', 'CsvImport/dispatch') %]
 
  13   [% L.hidden_tag('profile.type', SELF.profile.type) %]
 
  15   <h2>[%- LxERP.t8('Import profiles') %]</h2>
 
  18    [%- IF SELF.profile.id %]
 
  20      <th align="right">[%- LxERP.t8('Current profile') %]:</th>
 
  21      <td>[%- HTML.escape(SELF.profile.name) %]</td>
 
  25    [%- IF SELF.all_profiles.size %]
 
  27      <th align="right">[%- LxERP.t8('Existing profiles') %]:</th>
 
  29       [% L.select_tag('profile.id', SELF.all_profiles, title_key = 'name', default = SELF.profile.id, style = 'width: 300px') %]
 
  32       [% L.submit_tag('action_new', LxERP.t8('Load profile')) %]
 
  33       [% L.submit_tag('action_destroy', LxERP.t8('Delete profile'), confirm => LxERP.t8('Do you really want to delete this object?')) %]
 
  39     <th align="right" valign="top">[%- LxERP.t8('Save settings as') %]:</th>
 
  41      [% L.input_tag('profile.name', '', style => 'width: 300px') %]
 
  43      [% L.checkbox_tag('profile.is_default', label => LxERP.t8('Make default profile')) %]
 
  45     <td valign="top">[% L.submit_tag('action_save', LxERP.t8('Save profile')) %]</td>
 
  51   <h2>[%- LxERP.t8('Help on column names') %]</h2>
 
  53   <div class="help_toggle">
 
  54    <a href="#" onClick="javascript:$('.help_toggle').toggle()">[% LxERP.t8("Show help text") %]</a>
 
  57   <div class="help_toggle" style="display:none">
 
  58    <p><a href="#" onClick="javascript:$('.help_toggle').toggle()">[% LxERP.t8("Hide help text") %]</a></p>
 
  61     <tr class="listheading">
 
  62      <th>[%- LxERP.t8('Column name') %]</th>
 
  63      <th>[%- LxERP.t8('Meaning') %]</th>
 
  66     [%- FOREACH row = SELF.displayable_columns %]
 
  67      <tr class="listrow[% loop.count % 2 %]">
 
  68       <td>[%- HTML.escape(row.name) %]</td>
 
  69       <td>[%- HTML.escape(row.description) %]</td>
 
  74 [%- IF SELF.type == 'contacts' %]
 
  76     [%- 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') %]
 
  79 [%- ELSIF SELF.type == 'addresses' %]
 
  81     [%- 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') %]
 
  84 [%- ELSIF SELF.type == 'parts' %]
 
  86     [%- LxERP.t8("If the article type is set to 'mixed' then a column called 'type' must be present.") %]
 
  87     [% LxERP.t8("Type can be either 'part' or 'service'.") %]
 
  92     [% 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.') %]
 
  93     [% 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).') %]
 
  94     [% LxERP.t8('The items are imported accoring do their number "X" regardless of the column order inside the file.') %]
 
  95     [% LxERP.t8('The column "make_X" can contain either a vendor\'s database ID, a vendor number or a vendor\'s name.') %]
 
 100     [%- L.submit_tag('action_download_sample', LxERP.t8('Download sample file')) %]
 
 107   <h2>[%- LxERP.t8('Settings') %]</h2>
 
 111     <th align="right">[%- LxERP.t8('Number Format') %]:</th>
 
 113      [% L.select_tag('settings.numberformat', ['1.000,00', '1000,00', '1,000.00', '1000.00'], default = SELF.profile.get('numberformat'), style = 'width: 300px') %]
 
 118     <th align="right">[%- LxERP.t8('Charset') %]:</th>
 
 119     <td colspan="10">[% L.select_tag('settings.charset', SELF.all_charsets, default = SELF.profile.get('charset'), style = 'width: 300px') %]</td>
 
 123     <th align="right">[%- LxERP.t8('Separator') %]:</th>
 
 124     [% SET custom_sep_char = SELF.sep_char %]
 
 125     [% FOREACH entry = SELF.all_sep_chars %]
 
 127       [% IF SELF.sep_char == entry.first %] [% SET custom_sep_char = '' %] [%- END %]
 
 128       [% L.radio_button_tag('sep_char', value => entry.first, label => entry.last, checked => SELF.sep_char == entry.first) %]
 
 133      [% L.radio_button_tag('sep_char', value => 'custom', checked => custom_sep_char != '') %]
 
 134      [% L.input_tag('custom_sep_char', custom_sep_char, size => 3, maxlength => 1) %]
 
 139     <th align="right">[%- LxERP.t8('Quote character') %]:</th>
 
 140     [% SET custom_quote_char = SELF.quote_char %]
 
 141     [% FOREACH entry = SELF.all_quote_chars %]
 
 143       [% IF SELF.quote_char == entry.first %] [% SET custom_quote_char = '' %] [%- END %]
 
 144       [% L.radio_button_tag('quote_char', value => entry.first, label => entry.last, checked => SELF.quote_char == entry.first) %]
 
 149      [% L.radio_button_tag('quote_char', value => 'custom', checked => custom_quote_char != '') %]
 
 150      [% L.input_tag('custom_quote_char', custom_quote_char, size => 3, maxlength => 1) %]
 
 155     <th align="right">[%- LxERP.t8('Escape character') %]:</th>
 
 156     [% SET custom_escape_char = SELF.escape_char %]
 
 157     [% FOREACH entry = SELF.all_escape_chars %]
 
 159       [% IF SELF.escape_char == entry.first %] [% SET custom_escape_char = '' %] [%- END %]
 
 160       [% L.radio_button_tag('escape_char', value => entry.first, label => entry.last, checked => SELF.escape_char == entry.first) %]
 
 165      [% L.radio_button_tag('escape_char', value => 'custom', checked => custom_escape_char != '') %]
 
 166      [% L.input_tag('custom_escape_char', custom_escape_char, size => 3, maxlength => 1) %]
 
 170    [% duplicate_fields = SELF.worker.get_duplicate_check_fields() %]
 
 171    [% IF ( duplicate_fields.size ) %]
 
 173        <th align="right">[%- LxERP.t8('Check for duplicates') %]:</th>
 
 176          [% FOREACH key = duplicate_fields.keys %]
 
 177            <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 %]\>
 
 178            <label for="settings.duplicates_[% key | html %]">[% duplicate_fields.$key.label | html %]</label>
 
 184        <th align="right"></th>
 
 187          [% opts = [ [ 'no_check',  LxERP.t8('Do not check for duplicates') ],
 
 188                      [ 'check_csv', LxERP.t8('Discard duplicate entries in CSV file') ],
 
 189                      [ 'check_db',  LxERP.t8('Discard entries with duplicates in database or CSV file') ] ] %]
 
 190          [% L.select_tag('settings.duplicates', opts, default = SELF.profile.get('duplicates'), style = 'width: 300px') %]
 
 195 [%- IF SELF.type == 'parts' %]
 
 196  [%- INCLUDE 'csv_import/_form_parts.html' %]
 
 197 [%- ELSIF SELF.type == 'customers_vendors' %]
 
 198  [%- INCLUDE 'csv_import/_form_customers_vendors.html' %]
 
 202     <th align="right">[%- LxERP.t8('Preview Mode') %]:</th>
 
 204       [% L.radio_button_tag('settings.full_preview', value=2, checked=SELF.profile.get('full_preview')==2, label=LxERP.t8('Full Preview')) %]
 
 205       [% L.radio_button_tag('settings.full_preview', value=1, checked=SELF.profile.get('full_preview')==1, label=LxERP.t8('Only Warnings and Errors')) %]
 
 206       [% L.radio_button_tag('settings.full_preview', value=0, checked=!SELF.profile.get('full_preview'),   label=LxERP.t8('First 20 Lines')) %]
 
 211     <th align="right">[%- LxERP.t8('Import file') %]:</th>
 
 212     <td colspan="10">[% L.input_tag('file', '', type => 'file', accept => '*') %]</td>
 
 215    [%- IF SELF.file.exists %]
 
 217      <th align="right">[%- LxERP.t8('Existing file on server') %]:</th>
 
 218      <td colspan="10">[%- LxERP.t8('Uploaded on #1, size #2 kB', SELF.file.displayable_mtime, LxERP.format_amount(SELF.file.size / 1024, 2)) %]</td>
 
 224   [% L.submit_tag('action_test', LxERP.t8('Test and preview')) %]
 
 225   [% IF (SELF.import_status == 'tested') && SELF.num_importable %]
 
 226    [% L.submit_tag('action_import', LxERP.t8('Import')) %]
 
 231  [%- IF SELF.import_status %]
 
 232   [%- IF SELF.errors %]
 
 233    [%- PROCESS 'csv_import/_errors.html' %]
 
 236   [%- PROCESS 'csv_import/_result.html' %]
 
 237   [%- PROCESS 'csv_import/_preview.html' %]
 
 240  <script type="text/javascript">
 
 242     $(document).ready(function() {
 
 243       $('#action_save').click(function() {
 
 244         if ($('#profile_name').attr('value') != '')
 
 246         alert('[% LxERP.t8('Please enter a profile name.') %]');