use Rose::Object::MakeMethods::Generic
(
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
+ csv_import_access
import_status errors headers raw_data_headers info_headers data num_importable displayable_columns file all_taxzones) ],
'scalar --get_set_init' => [ qw(worker task_server num_imported mappings) ],
'array' => [
my $data = $self->{background_job}->data_as_hash;
my $profile = SL::DB::Manager::CsvImportProfile->find_by(id => $data->{profile_id});
-
$self->profile($profile);
if ($data->{errors} and my $first_error = $data->{errors}->[0]) {
#
sub check_auth {
- $::auth->assert('config');
+ my ($self) = @_;
+ if ( $::form->{csv_import_access} ) {
+ $self->csv_import_access($::form->{csv_import_access});
+ return $::auth->assert($self->csv_import_access);
+ } else {
+ return $::auth->assert('config');
+ }
}
sub check_type {
my $profile;
if ($::form->{profile}->{id}) {
- $profile = SL::DB::Manager::CsvImportProfile->find_by(id => $::form->{profile}->{id}, login => $::myconfig{login});
+ $profile = SL::DB::Manager::CsvImportProfile->find_by(id => $::form->{profile}->{id});
}
$profile ||= SL::DB::Manager::CsvImportProfile->find_by(type => $self->{type}, is_default => 1, login => $::myconfig{login});
$profile ||= SL::DB::CsvImportProfile->new(type => $self->{type}, login => $::myconfig{login});
$clone->settings(map { $_->clone_and_reset } $self->settings);
$clone->is_default(0);
$clone->name('');
-
return $clone;
}
$(document).ready(function(){
[%- IF SELF.background_job.data_as_hash.report_id %]
- get_report('#csv_import_report', 'controller.pl', { action: 'CsvImport/report', 'no_layout': 1, 'id': [% SELF.background_job.data_as_hash.report_id %] });
+ 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 %]' });
[%- END %]
});
data: {
action: 'CsvImport/result',
'profile.type': '[% SELF.profile.type %]',
+ 'csv_import_access' : '[% SELF.csv_import_access %]',
job: '[% SELF.background_job.id %]'
},
success: function(data) { $('#results').html(data) },
[% L.hidden_tag('form_sent', '1') %]
[% L.hidden_tag('action', 'CsvImport/dispatch') %]
[% L.hidden_tag('profile.type', SELF.profile.type) %]
+ [% L.hidden_tag('csv_import_access', SELF.csv_import_access) %]
+ [%- IF SELF.csv_import_access %]
+ [% L.hidden_tag('force_profile', 1) %]
+ [% L.hidden_tag('profile.id', SELF.profile.id) %]
+ [%- ELSE %]
<h2>[%- LxERP.t8('Import profiles') %]</h2>
<table>
</div>
<hr>
+[%- END %]
[%- END %]
[% L.submit_tag('action_test', LxERP.t8('Test and preview')) %]
[% L.submit_tag('action_import', LxERP.t8('Import'), style='display:none') %]