Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7dd4a299

Von Bernd Bleßmann vor fast 11 Jahren hinzugefügt

  • ID 7dd4a29917927325e1f063173acbc6afd6e71a4d
  • Vorgänger 40f891ac
  • Nachfolger aa014f11

Beim Initialisieren von "objects_by" alle Objekte holen ...

... und nicht als etxra Methode.

Unterschiede anzeigen:

SL/Controller/CsvImport/Order.pm
22 22

  
23 23
use Rose::Object::MakeMethods::Generic
24 24
(
25
 'scalar --get_set_init' => [ qw(settings languages_by all_parts parts_by all_contacts contacts_by all_departments departments_by all_projects projects_by all_ct_shiptos ct_shiptos_by all_taxzones taxzones_by) ],
25
 'scalar --get_set_init' => [ qw(settings languages_by parts_by contacts_by departments_by projects_by ct_shiptos_by taxzones_by) ],
26 26
);
27 27

  
28 28

  
......
108 108
  return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $self->all_languages } } ) } qw(id description article_code) };
109 109
}
110 110

  
111
sub init_all_parts {
112
  my ($self) = @_;
113

  
114
  return SL::DB::Manager::Part->get_all;
115
}
116

  
117 111
sub init_parts_by {
118 112
  my ($self) = @_;
119 113

  
120
  return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $self->all_parts } } ) } qw(id partnumber ean description) };
121
}
122

  
123
sub init_all_contacts {
124
  my ($self) = @_;
125

  
126
  return SL::DB::Manager::Contact->get_all;
114
  my $all_parts = SL::DB::Manager::Part->get_all;
115
  return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_parts } } ) } qw(id partnumber ean description) };
127 116
}
128 117

  
129 118
sub init_contacts_by {
130 119
  my ($self) = @_;
131 120

  
132
  my $cby;
121
  my $all_contacts = SL::DB::Manager::Contact->get_all;
133 122

  
123
  my $cby;
134 124
  # by customer/vendor id  _and_  contact person id
135
  $cby->{'cp_cv_id+cp_id'}   = { map { ( $_->cp_cv_id . '+' . $_->cp_id   => $_ ) } @{ $self->all_contacts } };
125
  $cby->{'cp_cv_id+cp_id'}   = { map { ( $_->cp_cv_id . '+' . $_->cp_id   => $_ ) } @{ $all_contacts } };
136 126
  # by customer/vendor id  _and_  contact person name
137
  $cby->{'cp_cv_id+cp_name'} = { map { ( $_->cp_cv_id . '+' . $_->cp_name => $_ ) } @{ $self->all_contacts } };
138

  
127
  $cby->{'cp_cv_id+cp_name'} = { map { ( $_->cp_cv_id . '+' . $_->cp_name => $_ ) } @{ $all_contacts } };
139 128

  
140 129
  return $cby;
141 130
}
142 131

  
143
sub init_all_departments {
144
  my ($self) = @_;
145

  
146
  return SL::DB::Manager::Department->get_all;
147
}
148

  
149 132
sub init_departments_by {
150 133
  my ($self) = @_;
151 134

  
152
  return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $self->all_departments } } ) } qw(id description) };
153
}
154

  
155
sub init_all_projects {
156
  my ($self) = @_;
157

  
158
  return SL::DB::Manager::Project->get_all;
135
  my $all_departments = SL::DB::Manager::Department->get_all;
136
  return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_departments } } ) } qw(id description) };
159 137
}
160 138

  
161 139
sub init_projects_by {
162 140
  my ($self) = @_;
163 141

  
164
  return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $self->all_projects } } ) } qw(id projectnumber description) };
165
}
166

  
167
sub init_all_ct_shiptos {
168
  my ($self) = @_;
169

  
170
  return SL::DB::Manager::Shipto->get_all(query => [module => 'CT']);
142
  my $all_projects = SL::DB::Manager::Project->get_all;
143
  return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_projects } } ) } qw(id projectnumber description) };
171 144
}
172 145

  
173 146
sub init_ct_shiptos_by {
174 147
  my ($self) = @_;
175 148

  
176
  my $sby;
149
  my $all_ct_shiptos = SL::DB::Manager::Shipto->get_all(query => [module => 'CT']);
177 150

  
151
  my $sby;
178 152
  # by trans_id  _and_  shipto_id
179
  $sby->{'trans_id+shipto_id'} = { map { ( $_->trans_id . '+' . $_->shipto_id => $_ ) } @{ $self->all_ct_shiptos } };
153
  $sby->{'trans_id+shipto_id'} = { map { ( $_->trans_id . '+' . $_->shipto_id => $_ ) } @{ $all_ct_shiptos } };
180 154

  
181 155
  return $sby;
182 156
}
183 157

  
184
sub init_all_taxzones {
185
  my ($self) = @_;
186

  
187
  return SL::DB::Manager::TaxZone->get_all;
188
}
189

  
190 158
sub init_taxzones_by {
191 159
  my ($self) = @_;
192 160

  
193
  return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $self->all_taxzones } } ) } qw(id description) };
161
  my $all_taxzones = SL::DB::Manager::TaxZone->get_all;
162
  return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_taxzones } } ) } qw(id description) };
194 163
}
195 164

  
196 165
sub check_objects {

Auch abrufbar als: Unified diff