879c0404c3acd39ada17f09388eb80db8ad7a7bc
[kivitendo-erp.git] / SL / DB / CsvImportReport.pm
1 # This file has been auto-generated only because it didn't exist.
2 # Feel free to modify it at will; it will not be overwritten automatically.
3
4 package SL::DB::CsvImportReport;
5
6 use strict;
7
8 use SL::DB::MetaSetup::CsvImportReport;
9
10 __PACKAGE__->meta->add_relationships(
11   rows => {
12     type         => 'one to many',
13     class        => 'SL::DB::CsvImportReportRow',
14     column_map   => { id => 'csv_import_report_id' },
15   },
16 );
17
18 __PACKAGE__->meta->make_manager_class;
19 __PACKAGE__->meta->initialize;
20
21 sub folded_rows {
22   my ($self) = @_;
23
24   $self->_fold_rows unless $self->{folded_rows};
25
26   return $self->{folded_rows};
27 }
28
29 sub _fold_rows {
30   my ($self) = @_;
31
32   $self->{folded_rows} = [];
33
34   for my $row_obj (@{ $self->rows }) {
35     $::lxdebug->dump(0,  "adding", $row_obj->row . ' ' . $row_obj->col . ' ' . $row_obj->value);
36     $self->{folded_rows}->[ $row_obj->row ] ||= [];
37     $self->{folded_rows}->[ $row_obj->row ][ $row_obj->col ] = $row_obj->value;
38     $::lxdebug->dump(0,  "now", $self->{folded_rows});
39   }
40 }
41
42 1;