CSV-Import: Auswahl der Felder für die Duplikat-Prüfung
[kivitendo-erp.git] / SL / Controller / CsvImport / Project.pm
1 package SL::Controller::CsvImport::Project;
2
3 use strict;
4
5 use SL::Helper::Csv;
6 use SL::DB::CustomVariable;
7 use SL::DB::CustomVariableConfig;
8
9 use parent qw(SL::Controller::CsvImport::Base);
10
11 use Rose::Object::MakeMethods::Generic
12 (
13  scalar => [ qw(table) ],
14 );
15
16 sub init_class {
17   my ($self) = @_;
18   $self->class('SL::DB::Project');
19 }
20
21 sub init_all_cvar_configs {
22   my ($self) = @_;
23
24   return SL::DB::Manager::CustomVariableConfig->get_all(where => [ module => 'Projects' ]);
25 }
26
27 sub check_objects {
28   my ($self) = @_;
29
30   foreach my $entry (@{ $self->controller->data }) {
31     $self->handle_cvars($entry);
32   }
33
34   $self->add_cvar_raw_data_columns;
35 }
36
37 sub get_duplicate_check_fields {
38   return {
39     projectnumber => {
40       label     => $::locale->text('Project Number'),
41       default   => 1,
42       std_check => 1
43     },
44   };
45 }
46
47 sub setup_displayable_columns {
48   my ($self) = @_;
49
50   $self->SUPER::setup_displayable_columns;
51   $self->add_cvar_columns_to_displayable_columns;
52
53   $self->add_displayable_columns({ name => 'projectnumber', description => $::locale->text('number') },
54                                  { name => 'description',   description => $::locale->text('Description') },
55                                  { name => 'active',        description => $::locale->text('Active') },
56                                 );
57 }
58
59 1;