Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1abd7845

Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt

  • ID 1abd784542136a7ce095ae97c754aae088acf1bb
  • Vorgänger f5594740
  • Nachfolger 29269e99

CSV-Importmasken um typspezifische Eingabefelder erweitert

Unterschiede anzeigen:

SL/Controller/CsvImport.pm
2 2

  
3 3
use strict;
4 4

  
5
use SL::DB::Buchungsgruppe;
5 6
use SL::DB::CsvImportProfile;
6 7
use SL::Helper::Flash;
7 8

  
......
11 12

  
12 13
use Rose::Object::MakeMethods::Generic
13 14
(
14
 scalar => [ qw(type profile all_profiles all_charsets sep_char all_sep_chars quote_char all_quote_chars escape_char all_escape_chars) ],
15
 scalar => [ qw(type profile all_profiles all_charsets sep_char all_sep_chars quote_char all_quote_chars escape_char all_escape_chars all_buchungsgruppen) ],
15 16
);
16 17

  
17 18
__PACKAGE__->run_before('check_auth');
......
110 111
  my $title = $self->type eq 'customers_vendors' ? $::locale->text('CSV import: customers and vendors')
111 112
            : $self->type eq 'addresses'         ? $::locale->text('CSV import: shipping addresses')
112 113
            : $self->type eq 'contacts'          ? $::locale->text('CSV import: contacts')
113
            : $self->type eq 'parts'             ? $::locale->text('CSV import: parts, services and assemblies')
114
            : $self->type eq 'parts'             ? $::locale->text('CSV import: parts and services')
114 115
            : die;
115 116

  
117
  $self->all_buchungsgruppen(SL::DB::Manager::Buchungsgruppe->get_all_sorted);
118

  
116 119
  $self->render('csv_import/form', title => $title);
117 120
}
118 121

  
SL/DB/CsvImportProfile.pm
38 38
                       escape_char  => '"',
39 39
                       charset      => 'CP850',
40 40
                       numberformat => $::myconfig{numberformat},
41
                       duplicates   => 'no_check',
41 42
                      );
42 43

  
43 44
  if ($self->type eq 'parts') {
44
    my $bugru = SL::DB::Manager::Buchungsgruppe->find_by(name => { like => 'Standard%19%' });
45
    my $bugru = SL::DB::Manager::Buchungsgruppe->find_by(description => { like => 'Standard%19%' });
45 46

  
46 47
    $self->_set_defaults(sellprice_places          => 2,
47 48
                         sellprice_adjustment      => 0,
48 49
                         sellprice_adjustment_type => 'percent',
49
                         article_number_policy     => 'update_price',
50
                         price_group_sep_char      => '!',
51
                         shoparticle_if_missing    => 0,
50
                         article_number_policy     => 'update_prices',
51
                         part_group_sep_char       => '!',
52
                         shoparticle_if_missing    => '0',
52 53
                         parts_type                => 'part',
53
                         default_buchungsgruppe    => ($bugru ? $bugru->name : undef),
54
                         default_buchungsgruppe    => ($bugru ? $bugru->description : undef),
55
                         apply_buchungsgruppe      => 'all',
54 56
                        );
55 57
  } else {
56 58
    $self->_set_defaults(table => 'customer');
templates/webpages/csv_import/_form_customers_vendors.html
1
<tr>
2
 <th align="right">[%- LxERP.t8('Target table') %]:</th>
3
 <td colspan="10">
4
  [% opts = [ [ 'customer', LxERP.t8('Customers') ], [ 'vendor', LxERP.t8('Vendors') ] ] %]
5
  [% L.select_tag('settings.table', L.options_for_select(opts, default => SELF.profile.get('table')), style => 'width: 300px') %]
6
 </td>
7
</tr>
templates/webpages/csv_import/_form_parts.html
1
<tr>
2
 <th align="right">[%- LxERP.t8('Parts with existing part numbers') %]:</th>
3
 <td colspan="10">
4
  [% opts = [ [ 'update_prices', LxERP.t8('Update prices of existing entries') ], [ 'insert_new', LxERP.t8('Insert with new part number') ] ] %]
5
  [% L.select_tag('settings.article_number_policy', L.options_for_select(opts, default => SELF.profile.get('article_number_policy')), style => 'width: 300px') %]
6
 </td>
7
</tr>
8

  
9
<tr>
10
 <th align="right">[%- LxERP.t8('Sellprice significant places') %]:</th>
11
 <td colspan="10">
12
  [% L.select_tag('settings.sellprice_places', L.options_for_select([ 0, 1, 2, 3, 4, 5 ], default => SELF.profile.get('sellprice_places')), style => 'width: 300px') %]
13
 </td>
14
</tr>
15

  
16
<tr>
17
 <th align="right">[%- LxERP.t8('Sellprice adjustment') %]:</th>
18
 <td colspan="10">
19
  [% L.input_tag('settings.sellprice_adjustment', LxERP.format_amount(SELF.profile.get('sellprice_adjustment')), size => "5") %]
20
  [% opts = [ [ 'percent', LxERP.t8('percental') ], [ 'absolute', LxERP.t8('absolute') ] ] %]
21
  [% L.select_tag('settings.sellprice_adjustment_type', L.options_for_select(opts, default => SELF.profile.get('sellprice_adjustment_type'))) %]
22
 </td>
23
</tr>
24

  
25
<tr>
26
 <th align="right">[%- LxERP.t8('Separator for part groups') %]:</th>
27
 <td colspan="10">
28
  [% L.input_tag('settings.part_group_sep_char', SELF.profile.get('part_group_sep_char'), size => 5) %]
29
 </td>
30
</tr>
31

  
32
<tr>
33
 <th align="right">[%- LxERP.t8('Mark as shop article if column missing') %]:</th>
34
 <td colspan="10">
35
  [% opts = [ [ '1', LxERP.t8('yes') ], [ '0', LxERP.t8('no') ] ] %]
36
  [% L.select_tag('settings.shoparticle_if_missing', L.options_for_select(opts, default => SELF.profile.get('shoparticle_if_missing')), style => 'width: 300px') %]
37
 </td>
38
</tr>
39

  
40
<tr>
41
 <th align="right">[%- LxERP.t8('Type') %]:</th>
42
 <td colspan="10">
43
  [% opts = [ [ 'part', LxERP.t8('Parts') ], [ 'service', LxERP.t8('Services') ], [ 'mixed', LxERP.t8('Mixed (requires column "type")') ] ] %]
44
  [% L.select_tag('settings.parts_type', L.options_for_select(opts, default => SELF.profile.get('parts_type')), style => 'width: 300px') %]
45
 </td>
46
</tr>
47

  
48
<tr>
49
 <th align="right" valign="top">[%- LxERP.t8('Default buchungsgruppe') %]:</th>
50
 <td colspan="10" valign="top">
51
  [% opts = L.options_for_select(SELF.all_buchungsgruppen, tilte => 'description', value => 'description', default => SELF.profile.get('default_buchungsgruppe')) %]
52
  [% L.select_tag('settings.default_buchungsgruppe', opts, style => 'width: 300px') %]
53
  <br>
54
  [% opts = [ [ 'never', LxERP.t8('Do not set default buchungsgruppe') ], [ 'all', LxERP.t8('Apply to all parts') ], [ 'missing', LxERP.t8('Apply to parts without buchungsgruppe') ] ] %]
55
  [% L.select_tag('settings.apply_buchungsgruppe', L.options_for_select(opts, default => SELF.profile.get('apply_buchungsgruppe')), style => 'width: 300px') %]
56
 </td>
57
</tr>
templates/webpages/csv_import/form.html
109 109
    </td>
110 110
   </tr>
111 111

  
112
   <tr>
113
    <th align="right">[%- LxERP.t8('Check for duplicates') %]:</th>
114
    <td colspan="10">
115
     [% opts = [ [ 'no_check', LxERP.t8('Do not check for duplicates') ],
116
                 [ 'check_csv', LxERP.t8('Discard duplicate entries in CSV file') ],
117
                 [ 'check_db',  LxERP.t8('Discard entries with duplicates in database and CSV file') ] ] %]
118
     [% L.select_tag('settings.duplicates', L.options_for_select(opts, default => SELF.profile.get('duplicates')), style => 'width: 300px') %]
119
    </td>
120
   </tr>
121

  
122
[%- IF SELF.type == 'parts' %]
123
 [%- INCLUDE 'csv_import/_form_parts.html' %]
124
[%- ELSIF SELF.type == 'customers_vendors' %]
125
 [%- INCLUDE 'csv_import/_form_customers_vendors.html' %]
126
[%- END %]
127

  
112 128
  </table>
113 129

  
114 130
  [% L.submit_tag('action_test', LxERP.t8('Gogogo')) %]

Auch abrufbar als: Unified diff