$self->$sub(($char_map{$type}->{$char} || [])->[0] || $char);
}
- if ($self->type eq 'customers_vendors') {
- $self->render('csv_import/form_customers_vendors', title => $::locale->text('CSV import: customers and vendors'));
+ my $title = $self->type eq 'customers_vendors' ? $::locale->text('CSV import: customers and vendors')
+ : $self->type eq 'addresses' ? $::locale->text('CSV import: shipping addresses')
+ : $self->type eq 'contacts' ? $::locale->text('CSV import: contacts')
+ : $self->type eq 'parts' ? $::locale->text('CSV import: parts, services and assemblies')
+ : die;
- } elsif ($self->type eq 'addresses') {
- $self->render('csv_import/form_addresses', title => $::locale->text('CSV import: shipping addresses'));
-
- } elsif ($self->type eq 'contacts') {
- $self->render('csv_import/form_contacts', title => $::locale->text('CSV import: contacts'));
-
- } elsif ($self->type eq 'parts') {
- $self->render('csv_import/form_parts', title => $::locale->text('CSV import: parts, services and assemblies'));
-
- } else {
- die;
- }
+ $self->render('csv_import/form', title => $title);
}
sub test_and_import {
--- /dev/null
+[% USE HTML %][% USE LxERP %][% USE L %]
+<body>
+
+ <div class="listtop">[% FORM.title %]</div>
+
+ [%- INCLUDE 'common/flash.html' %]
+
+ <form method="post" action="controller.pl">
+ [% L.hidden_tag('action', 'CsvImport/dispatch') %]
+ [% L.hidden_tag('profile.type', SELF.profile.type) %]
+
+ <h2>[%- LxERP.t8('Import profiles') %]</h2>
+
+ <table>
+ [%- IF SELF.profile.id %]
+ <tr>
+ <th align="right">[%- LxERP.t8('Current profile') %]:</th>
+ <td>[%- HTML.escape(SELF.profile.name) %]</td>
+ </tr>
+ [%- END %]
+
+ [%- IF SELF.all_profiles.size %]
+ <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') %]
+ </td>
+ <td>
+ [% L.submit_tag('action_new', LxERP.t8('Load profile')) %]
+ [% L.submit_tag('action_destroy', LxERP.t8('Delete profile'), confirm => LxERP.t8('Do you really want to delete this object?')) %]
+ </td>
+ </tr>
+ [%- END %]
+
+ <tr>
+ <th align="right" valign="top">[%- LxERP.t8('Save settings as') %]:</th>
+ <td valign="top">
+ [% L.input_tag('profile.name', '', style => 'width: 300px') %]
+ <br>
+ [% L.checkbox_tag('profile.is_default', label => LxERP.t8('Make default profile')) %]
+ </td>
+ <td valign="top">[% L.submit_tag('action_save', LxERP.t8('Save profile')) %]</td>
+ </tr>
+ </table>
+
+ <hr>
+
+ <h2>[%- LxERP.t8('Settings') %]</h2>
+
+ <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') %]
+ </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>
+ </tr>
+
+ <tr>
+ <th align="right">[%- LxERP.t8('Separator') %]:</th>
+ [% SET custom_sep_char = SELF.sep_char %]
+ [% FOREACH entry = SELF.all_sep_chars %]
+ <td>
+ [% IF SELF.sep_char == entry.first %] [% SET custom_sep_char = '' %] [%- END %]
+ [% L.radio_button_tag('sep_char', value => entry.first, label => entry.last, checked => SELF.sep_char == entry.first) %]
+ </td>
+ [%- END %]
+
+ <td>
+ [% L.radio_button_tag('sep_char', value => 'custom', checked => custom_sep_char != '') %]
+ [% L.input_tag('custom_sep_char', custom_sep_char, size => 3, maxlength => 1) %]
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">[%- LxERP.t8('Quote character') %]:</th>
+ [% SET custom_quote_char = SELF.quote_char %]
+ [% FOREACH entry = SELF.all_quote_chars %]
+ <td>
+ [% IF SELF.quote_char == entry.first %] [% SET custom_quote_char = '' %] [%- END %]
+ [% L.radio_button_tag('quote_char', value => entry.first, label => entry.last, checked => SELF.quote_char == entry.first) %]
+ </td>
+ [%- END %]
+
+ <td>
+ [% L.radio_button_tag('quote_char', value => 'custom', checked => custom_quote_char != '') %]
+ [% L.input_tag('custom_quote_char', custom_quote_char, size => 3, maxlength => 1) %]
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">[%- LxERP.t8('Escape character') %]:</th>
+ [% SET custom_escape_char = SELF.escape_char %]
+ [% FOREACH entry = SELF.all_escape_chars %]
+ <td>
+ [% IF SELF.escape_char == entry.first %] [% SET custom_escape_char = '' %] [%- END %]
+ [% L.radio_button_tag('escape_char', value => entry.first, label => entry.last, checked => SELF.escape_char == entry.first) %]
+ </td>
+ [%- END %]
+
+ <td>
+ [% L.radio_button_tag('escape_char', value => 'custom', checked => custom_escape_char != '') %]
+ [% L.input_tag('custom_escape_char', custom_escape_char, size => 3, maxlength => 1) %]
+ </td>
+ </tr>
+
+ </table>
+
+ [% L.submit_tag('action_test', LxERP.t8('Gogogo')) %]
+
+ </form>
+
+ <script type="text/javascript">
+ <!--
+ $(document).ready(function() {
+ $('#action_save').click(function() {
+ if ($('#profile_name').attr('value') != '')
+ return true;
+ alert('[% LxERP.t8('Please enter a profile name.') %]');
+ return false;
+ })
+ });
+ -->
+ </script>
+</body>
+</html>
+++ /dev/null
-[% USE HTML %][% USE LxERP %][% USE L %]
-<body>
-
- <div class="listtop">[% FORM.title %]</div>
-
- [%- INCLUDE 'common/flash.html' %]
-
- <form method="post" action="controller.pl">
- [% L.hidden_tag('action', 'CsvImport/dispatch') %]
- [% L.hidden_tag('profile.type', SELF.profile.type) %]
-
- <h2>[%- LxERP.t8('Import profiles') %]</h2>
-
- <table>
- [%- IF SELF.profile.id %]
- <tr>
- <th align="right">[%- LxERP.t8('Current profile') %]:</th>
- <td>[%- HTML.escape(SELF.profile.name) %]</td>
- </tr>
- [%- END %]
-
- [%- IF SELF.all_profiles.size %]
- <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') %]
- </td>
- <td>
- [% L.submit_tag('action_new', LxERP.t8('Load profile')) %]
- [% L.submit_tag('action_destroy', LxERP.t8('Delete profile'), confirm => LxERP.t8('Do you really want to delete this object?')) %]
- </td>
- </tr>
- [%- END %]
-
- <tr>
- <th align="right" valign="top">[%- LxERP.t8('Save settings as') %]:</th>
- <td valign="top">
- [% L.input_tag('profile.name', '', style => 'width: 300px') %]
- <br>
- [% L.checkbox_tag('profile.is_default', label => LxERP.t8('Make default profile')) %]
- </td>
- <td valign="top">[% L.submit_tag('action_save', LxERP.t8('Save profile')) %]</td>
- </tr>
- </table>
-
- <hr>
-
- <h2>[%- LxERP.t8('Settings') %]</h2>
-
- <table>
- <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'))) %]</td>
- </tr>
-
- <tr>
- <th align="right">[%- LxERP.t8('Separator') %]:</th>
- [% SET custom_sep_char = SELF.sep_char %]
- [% FOREACH entry = SELF.all_sep_chars %]
- <td>
- [% IF SELF.sep_char == entry.first %] [% SET custom_sep_char = '' %] [%- END %]
- [% L.radio_button_tag('sep_char', value => entry.first, label => entry.last, checked => SELF.sep_char == entry.first) %]
- </td>
- [%- END %]
-
- <td>
- [% L.radio_button_tag('sep_char', value => 'custom', checked => custom_sep_char != '') %]
- [% L.input_tag('custom_sep_char', custom_sep_char, size => 3, maxlength => 1) %]
- </td>
- </tr>
-
- <tr>
- <th align="right">[%- LxERP.t8('Quote character') %]:</th>
- [% SET custom_quote_char = SELF.quote_char %]
- [% FOREACH entry = SELF.all_quote_chars %]
- <td>
- [% IF SELF.quote_char == entry.first %] [% SET custom_quote_char = '' %] [%- END %]
- [% L.radio_button_tag('quote_char', value => entry.first, label => entry.last, checked => SELF.quote_char == entry.first) %]
- </td>
- [%- END %]
-
- <td>
- [% L.radio_button_tag('quote_char', value => 'custom', checked => custom_quote_char != '') %]
- [% L.input_tag('custom_quote_char', custom_quote_char, size => 3, maxlength => 1) %]
- </td>
- </tr>
-
- <tr>
- <th align="right">[%- LxERP.t8('Escape character') %]:</th>
- [% SET custom_escape_char = SELF.escape_char %]
- [% FOREACH entry = SELF.all_escape_chars %]
- <td>
- [% IF SELF.escape_char == entry.first %] [% SET custom_escape_char = '' %] [%- END %]
- [% L.radio_button_tag('escape_char', value => entry.first, label => entry.last, checked => SELF.escape_char == entry.first) %]
- </td>
- [%- END %]
-
- <td>
- [% L.radio_button_tag('escape_char', value => 'custom', checked => custom_escape_char != '') %]
- [% L.input_tag('custom_escape_char', custom_escape_char, size => 3, maxlength => 1) %]
- </td>
- </tr>
-
- </table>
-
- [% L.submit_tag('action_test', LxERP.t8('Gogogo')) %]
-
- </form>
-
- <script type="text/javascript">
- <!--
- $(document).ready(function() {
- $('#action_save').click(function() {
- if ($('#profile_name').attr('value') != '')
- return true;
- alert('[% LxERP.t8('Please enter a profile name.') %]');
- return false;
- })
- });
- -->
- </script>
-</body>
-</html>