Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 850cb6b4

Von Jan Büren vor mehr als 6 Jahren hinzugefügt

  • ID 850cb6b4b723772a97e5bb385a57723cd52432f3
  • Vorgänger 2f2a0f41
  • Nachfolger 67814d7d

DATEV::CSV Parameterübergabe sauber vereinheitlicht. Helper format_amount

Unterschiede anzeigen:

SL/DATEV/CSV.pm
16 16
                              csv_header_name => t8('Transaction Value'),
17 17
                              max_length      => 13,
18 18
                              type            => 'Value',
19
                              valid_check     => sub { return (shift =~ m/^\d{1,10}(\,\d{1,2})?$/) },
19
                              valid_check     => sub { my ($check) = @_; return ($check =~ m/^\d{1,10}(\,\d{1,2})?$/) },
20 20
                            },
21 21
                            {
22 22
                              kivi_datev_name => 'soll_haben_kennzeichen',
23 23
                              csv_header_name => t8('Debit/Credit Label'),
24 24
                              max_length      => 1,
25 25
                              type            => 'Text',
26
                              valid_check     => sub { return (shift =~ m/^(S|H)$/) },
26
                              valid_check     => sub { my ($check) = @_; return ($check =~ m/^(S|H)$/) },
27 27
                            },
28 28
                            {
29 29
                              kivi_datev_name => 'waehrung',
30 30
                              csv_header_name => t8('Transaction Value Currency Code'),
31 31
                              max_length      => 3,
32 32
                              type            => 'Text',
33
                              valid_check     => sub { return (shift =~ m/^[A-Z]{3}$/) },
33
                              valid_check     => sub { my ($check) = @_; return ($check =~ m/^[A-Z]{3}$/) },
34 34
                            },
35 35
                            {
36 36
                              kivi_datev_name => 'wechselkurs',
37 37
                              csv_header_name => t8('Exchange Rate'),
38 38
                              max_length      => 11,
39 39
                              type            => 'Number',
40
                              valid_check     => sub { return (shift =~ m/^[0-9]*\.?[0-9]*$/) },
40
                              valid_check     => sub { my ($check) = @_; return ($check =~ m/^[0-9]*\.?[0-9]*$/) },
41 41
                            },
42 42
                            {
43 43
                              kivi_datev_name => 'not yet implemented',
......
52 52
                              csv_header_name => t8('Account'),
53 53
                              max_length      => 9, # May contain a maximum of 8 or 9 digits -> perldoc
54 54
                              type            => 'Account',
55
                              valid_check     => sub { return (shift =~ m/^[0-9]{4,9}$/) },
55
                              valid_check     => sub { my ($check) = @_; return ($check =~ m/^[0-9]{4,9}$/) },
56 56
                            },
57 57
                            {
58 58
                              kivi_datev_name => 'gegenkonto',
59 59
                              csv_header_name => t8('Contra Account'),
60 60
                              max_length      => 9, # May contain a maximum of 8 or 9 digits -> perldoc
61 61
                              type            => 'Account',
62
                              valid_check     => sub { return (shift =~ m/^[0-9]{4,9}$/) },
62
                              valid_check     => sub { my ($check) = @_; return ($check =~ m/^[0-9]{4,9}$/) },
63 63
                            },
64 64
                            {
65 65
                              kivi_datev_name => 'buchungsschluessel',
66 66
                              csv_header_name => t8('Posting Key'),
67 67
                              max_length      => 2,
68 68
                              type            => 'Text',
69
                              valid_check     => sub { return (shift =~ m/^[0-9]{0,2}$/) },
69
                              valid_check     => sub { my ($check) = @_; return ($check =~ m/^[0-9]{0,2}$/) },
70 70
                            },
71 71
                            {
72 72
                              kivi_datev_name => 'datum',
73 73
                              csv_header_name => t8('Invoice Date'),
74 74
                              max_length      => 4,
75 75
                              type            => 'Date',
76
                              valid_check     => sub { return (shift =~ m/^[0-9]{4}$/) },
76
                              valid_check     => sub { my ($check) = @_; return ($check =~ m/^[0-9]{4}$/) },
77 77
                            },
78 78
                            {
79 79
                              kivi_datev_name => 'belegfeld1',
80 80
                              csv_header_name => t8('Invoice Field 1'),
81 81
                              max_length      => 12,
82 82
                              type            => 'Text',
83
                              valid_check     => sub { my $text = shift; check_encoding($text); },
83
                              valid_check     => sub { my ($text) = @_; check_encoding($text); },
84 84
                            },
85 85
                            {
86 86
                              kivi_datev_name => 'not yet implemented',
87 87
                              csv_header_name => t8('Invoice Field 2'),
88 88
                             max_length      => 12,
89 89
                              type            => 'Text',
90
                              valid_check     => sub { return (shift =~ m/[ -~]{1,12}/) },
90
                              valid_check     => sub { my ($check) = @_; return ($check =~ m/[ -~]{1,12}/) },
91 91
                            },
92 92
                            {
93 93
                              kivi_datev_name => 'not yet implemented',
......
99 99
                              csv_header_name => t8('Posting Text'),
100 100
                              max_length      => 60,
101 101
                              type            => 'Text',
102
                              valid_check     => sub { my $text = shift; return 1 unless $text; check_encoding($text);  },
102
                              valid_check     => sub { my ($text) = @_; return 1 unless $text; check_encoding($text);  },
103 103
                            },  # pos 14
104 104
                            {
105 105
                              kivi_datev_name => 'not yet implemented',
......
176 176
                              csv_header_name => t8('Cost Center'),
177 177
                              max_length      => 8,
178 178
                              type            => 'Text',
179
                              valid_check     => sub { my $text = shift; return 1 unless $text; check_encoding($text);  },
179
                              valid_check     => sub { my ($text) = @_; return 1 unless $text; check_encoding($text);  },
180 180
                            }, # pos 37
181 181
                            {
182 182
                              kivi_datev_name => 'kost2',
183 183
                              csv_header_name => t8('Cost Center'),
184 184
                              max_length      => 8,
185 185
                              type            => 'Text',
186
                              valid_check     => sub { my $text = shift; return 1 unless $text; check_encoding($text);  },
186
                              valid_check     => sub { my ($text) = @_; return 1 unless $text; check_encoding($text);  },
187 187
                            }, # pos 38
188 188
                            {
189 189
                              kivi_datev_name => 'not yet implemented',
190 190
                              csv_header_name => t8('KOST Quantity'),
191 191
                              max_length      => 9,
192 192
                              type            => 'Number',
193
                              valid_check     => sub { return (shift =~ m/^[0-9]{0,9}$/) },
193
                              valid_check     => sub { my ($check) = @_; return ($check =~ m/^[0-9]{0,9}$/) },
194 194
                            }, # pos 39
195 195
                            {
196 196
                              kivi_datev_name => 'ustid',
......
198 198
                              max_length      => 15,
199 199
                              type            => 'Text',
200 200
                              valid_check     => sub {
201
                                                       my $ustid = shift;
201
                                                       my ($ustid) = @_;
202 202
                                                       return 1 unless defined($ustid);
203 203
                                                       return ($ustid =~ m/^CH|^[A-Z]{2}\w{5,13}$/);
204 204
                                                     },
......
266 266

  
267 267
  return @header;
268 268
}
269

  
270
sub _format_amount {
271
  $::form->format_amount({ numberformat => '1000,00' }, @_);
272
}
273

  
269 274
1;
270 275

  
271 276
__END__
......
368 373

  
369 374
Returns the data structure C<@datev_data> as an array
370 375

  
376
=item _format_amount
377

  
378
Lightweight wrapper for form->format_amount.
379
Expects a number in kivitendo database format and returns the same number
380
in DATEV format.
381

  
371 382
=back

Auch abrufbar als: Unified diff