Revision 6261d6ca
Von Martin Helmling martin.helmling@octosoft.eu vor etwa 8 Jahren hinzugefügt
SL/Controller/CsvImport.pm | ||
---|---|---|
32 | 32 |
use Rose::Object::MakeMethods::Generic |
33 | 33 |
( |
34 | 34 |
scalar => [ qw(type profile file all_profiles all_charsets sep_char all_sep_chars quote_char all_quote_chars escape_char all_escape_chars all_buchungsgruppen all_units |
35 |
csv_import_access |
|
35 | 36 |
import_status errors headers raw_data_headers info_headers data num_importable displayable_columns file all_taxzones) ], |
36 | 37 |
'scalar --get_set_init' => [ qw(worker task_server num_imported mappings) ], |
37 | 38 |
'array' => [ |
... | ... | |
98 | 99 |
my $data = $self->{background_job}->data_as_hash; |
99 | 100 |
|
100 | 101 |
my $profile = SL::DB::Manager::CsvImportProfile->find_by(id => $data->{profile_id}); |
101 |
|
|
102 | 102 |
$self->profile($profile); |
103 | 103 |
|
104 | 104 |
if ($data->{errors} and my $first_error = $data->{errors}->[0]) { |
... | ... | |
267 | 267 |
# |
268 | 268 |
|
269 | 269 |
sub check_auth { |
270 |
$::auth->assert('config'); |
|
270 |
my ($self) = @_; |
|
271 |
if ( $::form->{csv_import_access} ) { |
|
272 |
$self->csv_import_access($::form->{csv_import_access}); |
|
273 |
return $::auth->assert($self->csv_import_access); |
|
274 |
} else { |
|
275 |
return $::auth->assert('config'); |
|
276 |
} |
|
271 | 277 |
} |
272 | 278 |
|
273 | 279 |
sub check_type { |
... | ... | |
414 | 420 |
|
415 | 421 |
my $profile; |
416 | 422 |
if ($::form->{profile}->{id}) { |
417 |
$profile = SL::DB::Manager::CsvImportProfile->find_by(id => $::form->{profile}->{id}, login => $::myconfig{login});
|
|
423 |
$profile = SL::DB::Manager::CsvImportProfile->find_by(id => $::form->{profile}->{id}); |
|
418 | 424 |
} |
419 | 425 |
$profile ||= SL::DB::Manager::CsvImportProfile->find_by(type => $self->{type}, is_default => 1, login => $::myconfig{login}); |
420 | 426 |
$profile ||= SL::DB::CsvImportProfile->new(type => $self->{type}, login => $::myconfig{login}); |
SL/DB/CsvImportProfile.pm | ||
---|---|---|
85 | 85 |
$clone->settings(map { $_->clone_and_reset } $self->settings); |
86 | 86 |
$clone->is_default(0); |
87 | 87 |
$clone->name(''); |
88 |
|
|
89 | 88 |
return $clone; |
90 | 89 |
} |
91 | 90 |
|
templates/webpages/csv_import/_deferred_report.html | ||
---|---|---|
20 | 20 |
|
21 | 21 |
$(document).ready(function(){ |
22 | 22 |
[%- IF SELF.background_job.data_as_hash.report_id %] |
23 |
get_report('#csv_import_report', 'controller.pl', { action: 'CsvImport/report', 'no_layout': 1, 'id': [% SELF.background_job.data_as_hash.report_id %] }); |
|
23 |
get_report('#csv_import_report', 'controller.pl', { action: 'CsvImport/report', 'no_layout': 1, 'id': [% SELF.background_job.data_as_hash.report_id %], 'csv_import_access' : '[% SELF.csv_import_access %]' });
|
|
24 | 24 |
[%- END %] |
25 | 25 |
}); |
26 | 26 |
|
templates/webpages/csv_import/_deferred_results.html | ||
---|---|---|
16 | 16 |
data: { |
17 | 17 |
action: 'CsvImport/result', |
18 | 18 |
'profile.type': '[% SELF.profile.type %]', |
19 |
'csv_import_access' : '[% SELF.csv_import_access %]', |
|
19 | 20 |
job: '[% SELF.background_job.id %]' |
20 | 21 |
}, |
21 | 22 |
success: function(data) { $('#results').html(data) }, |
templates/webpages/csv_import/form.html | ||
---|---|---|
10 | 10 |
[% L.hidden_tag('form_sent', '1') %] |
11 | 11 |
[% L.hidden_tag('action', 'CsvImport/dispatch') %] |
12 | 12 |
[% L.hidden_tag('profile.type', SELF.profile.type) %] |
13 |
[% L.hidden_tag('csv_import_access', SELF.csv_import_access) %] |
|
13 | 14 |
|
15 |
[%- IF SELF.csv_import_access %] |
|
16 |
[% L.hidden_tag('force_profile', 1) %] |
|
17 |
[% L.hidden_tag('profile.id', SELF.profile.id) %] |
|
18 |
[%- ELSE %] |
|
14 | 19 |
<h2>[%- LxERP.t8('Import profiles') %]</h2> |
15 | 20 |
|
16 | 21 |
<table> |
... | ... | |
323 | 328 |
|
324 | 329 |
</div> |
325 | 330 |
<hr> |
331 |
[%- END %] |
|
326 | 332 |
[%- END %] |
327 | 333 |
[% L.submit_tag('action_test', LxERP.t8('Test and preview')) %] |
328 | 334 |
[% L.submit_tag('action_import', LxERP.t8('Import'), style='display:none') %] |
Auch abrufbar als: Unified diff
Spezifisches Recht für CSV-Import
Da immer mehr Bewegungsdaten per CSV-Import eingelesen werden,
ist es sinnvoll, dies ohne 'config' Recht durchführen zu können.
In diesem Falle sind default Import-Profile vorzuhalten, da die Nutzer dann keine Anpassungen machen dürfen.
Die Default Profile haben das flag is_default gesetzt und als login "default" eingetragen.
Zur Übergabe dieses Rechts dient der neue Parameter csv_import_access,
der entsprechend weiterzugeben ist.
Diese Änderung wird erstmalig für den MT940 Bankimport eingesetzt
Voraussetzung für #5193.1