<body> entfernt.
[kivitendo-erp.git] / templates / webpages / csv_import / form.html
1 [%- USE HTML %]
2 [%- USE LxERP %]
3 [%- USE L %]
4 [%- USE T8 %]
5
6  <div class="listtop">[% FORM.title %]</div>
7
8  [%- INCLUDE 'common/flash.html' %]
9
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) %]
14
15   <h2>[%- LxERP.t8('Import profiles') %]</h2>
16
17   <table>
18    [%- IF SELF.profile.id %]
19     <tr>
20      <th align="right">[%- LxERP.t8('Current profile') %]:</th>
21      <td>[%- HTML.escape(SELF.profile.name) %]</td>
22     </tr>
23    [%- END %]
24
25    [%- IF SELF.all_profiles.size %]
26     <tr>
27      <th align="right">[%- LxERP.t8('Existing profiles') %]:</th>
28      <td>
29       [% L.select_tag('profile.id', SELF.all_profiles, title_key = 'name', default = SELF.profile.id, style = 'width: 300px') %]
30      </td>
31      <td>
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?')) %]
34      </td>
35     </tr>
36    [%- END %]
37
38    <tr>
39     <th align="right" valign="top">[%- LxERP.t8('Save settings as') %]:</th>
40     <td valign="top">
41      [% L.input_tag('profile.name', '', style => 'width: 300px') %]
42      <br>
43      [% L.checkbox_tag('profile.is_default', label => LxERP.t8('Make default profile')) %]
44     </td>
45     <td valign="top">[% L.submit_tag('action_save', LxERP.t8('Save profile')) %]</td>
46    </tr>
47   </table>
48
49   <hr>
50
51   <h2>[%- LxERP.t8('Help on column names') %]</h2>
52
53   <div class="help_toggle">
54    <a href="#" onClick="javascript:$('.help_toggle').toggle()">[% LxERP.t8("Show help text") %]</a>
55   </div>
56
57   <div class="help_toggle" style="display:none">
58    <p><a href="#" onClick="javascript:$('.help_toggle').toggle()">[% LxERP.t8("Hide help text") %]</a></p>
59
60    <table>
61     <tr class="listheading">
62      <th>[%- LxERP.t8('Column name') %]</th>
63      <th>[%- LxERP.t8('Meaning') %]</th>
64     </tr>
65
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>
70      </tr>
71     [%- END %]
72    </table>
73
74 [%- IF SELF.type == 'contacts' %]
75    <p>
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') %]
77    </p>
78
79 [%- ELSIF SELF.type == 'addresses' %]
80    <p>
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') %]
82    </p>
83
84 [%- ELSIF SELF.type == 'parts' %]
85    <p>
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'.") %]
88    </p>
89 [%- END %]
90
91    <p>
92     [%- L.submit_tag('action_download_sample', LxERP.t8('Download sample file')) %]
93    </p>
94
95   </div>
96
97   <hr>
98
99   <h2>[%- LxERP.t8('Settings') %]</h2>
100
101   <table>
102    <tr>
103     <th align="right">[%- LxERP.t8('Number Format') %]:</th>
104     <td colspan="10">
105      [% L.select_tag('settings.numberformat', ['1.000,00', '1000,00', '1,000.00', '1000.00'], default = SELF.profile.get('numberformat'), style = 'width: 300px') %]
106     </td>
107    </tr>
108
109    <tr>
110     <th align="right">[%- LxERP.t8('Charset') %]:</th>
111     <td colspan="10">[% L.select_tag('settings.charset', SELF.all_charsets, default = SELF.profile.get('charset'), style = 'width: 300px') %]</td>
112    </tr>
113
114    <tr>
115     <th align="right">[%- LxERP.t8('Separator') %]:</th>
116     [% SET custom_sep_char = SELF.sep_char %]
117     [% FOREACH entry = SELF.all_sep_chars %]
118      <td>
119       [% IF SELF.sep_char == entry.first %] [% SET custom_sep_char = '' %] [%- END %]
120       [% L.radio_button_tag('sep_char', value => entry.first, label => entry.last, checked => SELF.sep_char == entry.first) %]
121      </td>
122     [%- END %]
123
124     <td>
125      [% L.radio_button_tag('sep_char', value => 'custom', checked => custom_sep_char != '') %]
126      [% L.input_tag('custom_sep_char', custom_sep_char, size => 3, maxlength => 1) %]
127     </td>
128    </tr>
129
130    <tr>
131     <th align="right">[%- LxERP.t8('Quote character') %]:</th>
132     [% SET custom_quote_char = SELF.quote_char %]
133     [% FOREACH entry = SELF.all_quote_chars %]
134      <td>
135       [% IF SELF.quote_char == entry.first %] [% SET custom_quote_char = '' %] [%- END %]
136       [% L.radio_button_tag('quote_char', value => entry.first, label => entry.last, checked => SELF.quote_char == entry.first) %]
137      </td>
138     [%- END %]
139
140     <td>
141      [% L.radio_button_tag('quote_char', value => 'custom', checked => custom_quote_char != '') %]
142      [% L.input_tag('custom_quote_char', custom_quote_char, size => 3, maxlength => 1) %]
143     </td>
144    </tr>
145
146    <tr>
147     <th align="right">[%- LxERP.t8('Escape character') %]:</th>
148     [% SET custom_escape_char = SELF.escape_char %]
149     [% FOREACH entry = SELF.all_escape_chars %]
150      <td>
151       [% IF SELF.escape_char == entry.first %] [% SET custom_escape_char = '' %] [%- END %]
152       [% L.radio_button_tag('escape_char', value => entry.first, label => entry.last, checked => SELF.escape_char == entry.first) %]
153      </td>
154     [%- END %]
155
156     <td>
157      [% L.radio_button_tag('escape_char', value => 'custom', checked => custom_escape_char != '') %]
158      [% L.input_tag('custom_escape_char', custom_escape_char, size => 3, maxlength => 1) %]
159     </td>
160    </tr>
161
162    [% duplicate_fields = SELF.worker.get_duplicate_check_fields() %]
163    [% IF ( duplicate_fields.size ) %]
164      <tr>
165        <th align="right">[%- LxERP.t8('Check for duplicates') %]:</th>
166
167        <td colspan=10>
168          [% FOREACH key = duplicate_fields.keys %]
169            <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 %]\>
170            <label for="settings.duplicates_[% key | html %]">[% duplicate_fields.$key.label | html %]</label>
171          [% END %]
172        </td>
173      </tr>
174
175      <tr>
176        <th align="right"></th>
177
178        <td colspan=10>
179          [% opts = [ [ 'no_check',  LxERP.t8('Do not check for duplicates') ],
180                      [ 'check_csv', LxERP.t8('Discard duplicate entries in CSV file') ],
181                      [ 'check_db',  LxERP.t8('Discard entries with duplicates in database or CSV file') ] ] %]
182          [% L.select_tag('settings.duplicates', opts, default = SELF.profile.get('duplicates'), style = 'width: 300px') %]
183        </td>
184      </tr>
185    [% END %]
186
187 [%- IF SELF.type == 'parts' %]
188  [%- INCLUDE 'csv_import/_form_parts.html' %]
189 [%- ELSIF SELF.type == 'customers_vendors' %]
190  [%- INCLUDE 'csv_import/_form_customers_vendors.html' %]
191 [%- END %]
192
193    <tr>
194     <th align="right">[%- LxERP.t8('Preview Mode') %]:</th>
195     <td colspan="10">
196       [% L.radio_button_tag('settings.full_preview', value=2, checked=SELF.profile.get('full_preview')==2, label=LxERP.t8('Full Preview')) %]
197       [% L.radio_button_tag('settings.full_preview', value=1, checked=SELF.profile.get('full_preview')==1, label=LxERP.t8('Only Warnings and Errors')) %]
198       [% L.radio_button_tag('settings.full_preview', value=0, checked=!SELF.profile.get('full_preview'),   label=LxERP.t8('First 20 Lines')) %]
199     </td>
200    </tr>
201
202    <tr>
203     <th align="right">[%- LxERP.t8('Import file') %]:</th>
204     <td colspan="10">[% L.input_tag('file', '', type => 'file', accept => '*') %]</td>
205    </tr>
206
207    [%- IF SELF.file.exists %]
208     <tr>
209      <th align="right">[%- LxERP.t8('Existing file on server') %]:</th>
210      <td colspan="10">[%- LxERP.t8('Uploaded on #1, size #2 kB', SELF.file.displayable_mtime, LxERP.format_amount(SELF.file.size / 1024, 2)) %]</td>
211     </tr>
212    [%- END %]
213
214   </table>
215
216   [% L.submit_tag('action_test', LxERP.t8('Test and preview')) %]
217   [% IF (SELF.import_status == 'tested') && SELF.num_importable %]
218    [% L.submit_tag('action_import', LxERP.t8('Import')) %]
219   [%- END %]
220
221  </form>
222
223  [%- IF SELF.import_status %]
224   [%- IF SELF.errors %]
225    [%- PROCESS 'csv_import/_errors.html' %]
226   [%- END %]
227
228   [%- PROCESS 'csv_import/_result.html' %]
229   [%- PROCESS 'csv_import/_preview.html' %]
230  [%- END %]
231
232  <script type="text/javascript">
233   <!--
234     $(document).ready(function() {
235       $('#action_save').click(function() {
236         if ($('#profile_name').attr('value') != '')
237           return true;
238         alert('[% LxERP.t8('Please enter a profile name.') %]');
239         return false;
240       })
241     });
242     -->
243  </script>