Hilfetext-Warnung entfernt
[kivitendo-erp.git] / templates / webpages / csv_import / form.html
1 [% USE HTML %][% USE LxERP %][% USE L %]
2 <body>
3
4  <div class="listtop">[% FORM.title %]</div>
5
6  [%- INCLUDE 'common/flash.html' %]
7
8  <form method="post" action="controller.pl" enctype="multipart/form-data">
9   [% L.hidden_tag('action', 'CsvImport/dispatch') %]
10   [% L.hidden_tag('profile.type', SELF.profile.type) %]
11
12   <h2>[%- LxERP.t8('Import profiles') %]</h2>
13
14   <table>
15    [%- IF SELF.profile.id %]
16     <tr>
17      <th align="right">[%- LxERP.t8('Current profile') %]:</th>
18      <td>[%- HTML.escape(SELF.profile.name) %]</td>
19     </tr>
20    [%- END %]
21
22    [%- IF SELF.all_profiles.size %]
23     <tr>
24      <th align="right">[%- LxERP.t8('Existing profiles') %]:</th>
25      <td>
26       [% L.select_tag('profile.id', L.options_for_select(SELF.all_profiles, title => 'name', default => SELF.profile.id), style => 'width: 300px') %]
27      </td>
28      <td>
29       [% L.submit_tag('action_new', LxERP.t8('Load profile')) %]
30       [% L.submit_tag('action_destroy', LxERP.t8('Delete profile'), confirm => LxERP.t8('Do you really want to delete this object?')) %]
31      </td>
32     </tr>
33    [%- END %]
34
35    <tr>
36     <th align="right" valign="top">[%- LxERP.t8('Save settings as') %]:</th>
37     <td valign="top">
38      [% L.input_tag('profile.name', '', style => 'width: 300px') %]
39      <br>
40      [% L.checkbox_tag('profile.is_default', label => LxERP.t8('Make default profile')) %]
41     </td>
42     <td valign="top">[% L.submit_tag('action_save', LxERP.t8('Save profile')) %]</td>
43    </tr>
44   </table>
45
46   <hr>
47
48   <h2>[%- LxERP.t8('Help on column names') %]</h2>
49
50   <div class="help_toggle">
51    <a href="#" onClick="javascript:$('.help_toggle').toggle()">[% LxERP.t8("Show help text") %]</a>
52   </div>
53
54   <div class="help_toggle" style="display:none">
55    <p><a href="#" onClick="javascript:$('.help_toggle').toggle()">[% LxERP.t8("Hide help text") %]</a></p>
56
57    <table>
58     <tr class="listheading">
59      <th>[%- LxERP.t8('Column name') %]</th>
60      <th>[%- LxERP.t8('Meaning') %]</th>
61     </tr>
62
63     [%- FOREACH row = SELF.displayable_columns %]
64      <tr class="listrow[% loop.count % 2 %]">
65       <td>[%- HTML.escape(row.name) %]</td>
66       <td>[%- HTML.escape(row.description) %]</td>
67      </tr>
68     [%- END %]
69    </table>
70
71 [%- IF SELF.type == 'contacts' %]
72    <p>
73     [%- 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') %]
74    </p>
75 [%- ELSIF SELF.type == 'addresses' %]
76    <p>
77     [%- 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') %]
78    </p>
79 [%- END %]
80   </div>
81
82   <hr>
83
84   <h2>[%- LxERP.t8('Settings') %]</h2>
85
86   <table>
87    <tr>
88     <th align="right">[%- LxERP.t8('Number Format') %]:</th>
89     <td colspan="10">
90      [% SET options = L.options_for_select([ '1.000,00', '1000,00', '1,000.00', '1000.00' ], default => SELF.profile.get('numberformat')) %]
91      [% L.select_tag('settings.numberformat', options, style => 'width: 300px') %]
92     </td>
93    </tr>
94
95    <tr>
96     <th align="right">[%- LxERP.t8('Charset') %]:</th>
97     <td colspan="10">[% L.select_tag('settings.charset', L.options_for_select(SELF.all_charsets, default => SELF.profile.get('charset')), style => 'width: 300px') %]</td>
98    </tr>
99
100    <tr>
101     <th align="right">[%- LxERP.t8('Separator') %]:</th>
102     [% SET custom_sep_char = SELF.sep_char %]
103     [% FOREACH entry = SELF.all_sep_chars %]
104      <td>
105       [% IF SELF.sep_char == entry.first %] [% SET custom_sep_char = '' %] [%- END %]
106       [% L.radio_button_tag('sep_char', value => entry.first, label => entry.last, checked => SELF.sep_char == entry.first) %]
107      </td>
108     [%- END %]
109
110     <td>
111      [% L.radio_button_tag('sep_char', value => 'custom', checked => custom_sep_char != '') %]
112      [% L.input_tag('custom_sep_char', custom_sep_char, size => 3, maxlength => 1) %]
113     </td>
114    </tr>
115
116    <tr>
117     <th align="right">[%- LxERP.t8('Quote character') %]:</th>
118     [% SET custom_quote_char = SELF.quote_char %]
119     [% FOREACH entry = SELF.all_quote_chars %]
120      <td>
121       [% IF SELF.quote_char == entry.first %] [% SET custom_quote_char = '' %] [%- END %]
122       [% L.radio_button_tag('quote_char', value => entry.first, label => entry.last, checked => SELF.quote_char == entry.first) %]
123      </td>
124     [%- END %]
125
126     <td>
127      [% L.radio_button_tag('quote_char', value => 'custom', checked => custom_quote_char != '') %]
128      [% L.input_tag('custom_quote_char', custom_quote_char, size => 3, maxlength => 1) %]
129     </td>
130    </tr>
131
132    <tr>
133     <th align="right">[%- LxERP.t8('Escape character') %]:</th>
134     [% SET custom_escape_char = SELF.escape_char %]
135     [% FOREACH entry = SELF.all_escape_chars %]
136      <td>
137       [% IF SELF.escape_char == entry.first %] [% SET custom_escape_char = '' %] [%- END %]
138       [% L.radio_button_tag('escape_char', value => entry.first, label => entry.last, checked => SELF.escape_char == entry.first) %]
139      </td>
140     [%- END %]
141
142     <td>
143      [% L.radio_button_tag('escape_char', value => 'custom', checked => custom_escape_char != '') %]
144      [% L.input_tag('custom_escape_char', custom_escape_char, size => 3, maxlength => 1) %]
145     </td>
146    </tr>
147
148    <tr>
149     <th align="right">[%- LxERP.t8('Check for duplicates') %]:</th>
150     <td colspan="10">
151      [% opts = [ [ 'no_check',  LxERP.t8('Do not check for duplicates') ],
152                  [ 'check_csv', LxERP.t8('Discard duplicate entries in CSV file') ],
153                  [ 'check_db',  LxERP.t8('Discard entries with duplicates in database or CSV file') ] ] %]
154      [% L.select_tag('settings.duplicates', L.options_for_select(opts, default => SELF.profile.get('duplicates')), style => 'width: 300px') %]
155     </td>
156    </tr>
157
158 [%- IF SELF.type == 'parts' %]
159  [%- INCLUDE 'csv_import/_form_parts.html' %]
160 [%- ELSIF SELF.type == 'customers_vendors' %]
161  [%- INCLUDE 'csv_import/_form_customers_vendors.html' %]
162 [%- END %]
163
164    <tr>
165     <th align="right">[%- LxERP.t8('Import file') %]:</th>
166     <td colspan="10">[% L.input_tag('file', '', type => 'file', accept => '*') %]</td>
167    </tr>
168
169    [%- IF SELF.file.exists %]
170     <tr>
171      <th align="right">[%- LxERP.t8('Existing file on server') %]:</th>
172      <td colspan="10">[%- LxERP.t8('Uploaded on #1, size #2 kB', SELF.file.displayable_mtime, LxERP.format_amount(SELF.file.size / 1024, 2)) %]</td>
173     </tr>
174    [%- END %]
175
176   </table>
177
178   [% L.submit_tag('action_test', LxERP.t8('Test and preview')) %]
179   [% IF (SELF.import_status == 'tested') && SELF.num_importable %]
180    [% L.submit_tag('action_import', LxERP.t8('Import')) %]
181   [%- END %]
182
183  </form>
184
185  [%- IF SELF.import_status %]
186   [%- IF SELF.errors %]
187    [%- PROCESS 'csv_import/_errors.html' %]
188   [%- END %]
189
190   [%- PROCESS 'csv_import/_result.html' %]
191   [%- PROCESS 'csv_import/_preview.html' %]
192  [%- END %]
193
194  <script type="text/javascript">
195   <!--
196     $(document).ready(function() {
197       $('#action_save').click(function() {
198         if ($('#profile_name').attr('value') != '')
199           return true;
200         alert('[% LxERP.t8('Please enter a profile name.') %]');
201         return false;
202       })
203     });
204     -->
205  </script>
206 </body>
207 </html>