Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6261d6ca

Von Martin Helmling martin.helmling@octosoft.eu vor mehr als 7 Jahren hinzugefügt

  • ID 6261d6ca23a2943f691d45ae6944da1a37eb7867
  • Vorgänger e4736bd2
  • Nachfolger 74e45f0f

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

Unterschiede anzeigen:

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});

Auch abrufbar als: Unified diff