Revision 1ed2e6b7
Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt
SL/Controller/CsvImport.pm | ||
---|---|---|
154 | 154 |
sub action_report { |
155 | 155 |
my ($self, %params) = @_; |
156 | 156 |
|
157 |
my $report_id = $params{report_id} || $::form->{id}; |
|
158 |
|
|
159 |
$self->{report} = SL::DB::Manager::CsvImportReport->find_by(id => $report_id); |
|
157 |
my $report_id = $params{report_id} || $::form->{id}; |
|
158 |
$self->{report} = SL::DB::Manager::CsvImportReport->find_by(id => $report_id); |
|
160 | 159 |
|
161 | 160 |
if (!$self->{report}) { |
162 | 161 |
$::form->error(t8('No report with id #1', $report_id)); |
163 | 162 |
} |
164 |
my $num_rows = $self->{report}->numrows; |
|
165 |
my $num_cols = SL::DB::Manager::CsvImportReportRow->get_all_count(query => [ csv_import_report_id => $report_id, row => 0 ]); |
|
163 |
|
|
164 |
my $num_rows = $self->{report}->numrows; |
|
165 |
my $num_cols = SL::DB::Manager::CsvImportReportRow->get_all_count(query => [ csv_import_report_id => $report_id, row => 0 ]); |
|
166 | 166 |
|
167 | 167 |
# manual paginating, yuck |
168 |
my $page = $::form->{page} || 1; |
|
169 |
my $pages = {}; |
|
170 |
$pages->{per_page} = $::form->{per_page} || 20; |
|
171 |
$pages->{max} = SL::DB::Helper::Paginated::ceil($num_rows, $pages->{per_page}) || 1; |
|
172 |
$pages->{page} = $page < 1 ? 1 |
|
173 |
: $page > $pages->{max} ? $pages->{max} |
|
174 |
: $page;
|
|
175 |
$pages->{common} = [ grep { $_->{visible} } @{ SL::DB::Helper::Paginated::make_common_pages($pages->{page}, $pages->{max}) } ]; |
|
168 |
my $page = $::form->{page} || 1;
|
|
169 |
my $pages = {};
|
|
170 |
$pages->{per_page} = $::form->{per_page} || 20;
|
|
171 |
$pages->{max} = SL::DB::Helper::Paginated::ceil($num_rows, $pages->{per_page}) || 1;
|
|
172 |
$pages->{page} = $page < 1 ? 1
|
|
173 |
: $page > $pages->{max} ? $pages->{max}
|
|
174 |
: $ page;
|
|
175 |
$pages->{common} = [ grep { $_->{visible} } @{ SL::DB::Helper::Paginated::make_common_pages($pages->{page}, $pages->{max}) } ];
|
|
176 | 176 |
|
177 | 177 |
$self->{report_numheaders} = $self->{report}->numheaders; |
178 |
my $first_row_header = 0; |
|
179 |
my $last_row_header = $self->{report_numheaders} - 1; |
|
180 |
my $first_row_data = $pages->{per_page} * ($pages->{page}-1) + $self->{report_numheaders}; |
|
181 |
my $last_row_data = min($pages->{per_page} * $pages->{page}, $num_rows) + $self->{report_numheaders} - 1; |
|
182 |
$self->{display_rows} = [ |
|
178 |
my $first_row_header = 0;
|
|
179 |
my $last_row_header = $self->{report_numheaders} - 1;
|
|
180 |
my $first_row_data = $pages->{per_page} * ($pages->{page}-1) + $self->{report_numheaders};
|
|
181 |
my $last_row_data = min($pages->{per_page} * $pages->{page}, $num_rows) + $self->{report_numheaders} - 1;
|
|
182 |
$self->{display_rows} = [
|
|
183 | 183 |
$first_row_header |
184 | 184 |
.. |
185 | 185 |
$last_row_header, |
... | ... | |
202 | 202 |
] |
203 | 203 |
); |
204 | 204 |
|
205 |
my $rows = SL::DB::Manager::CsvImportReportRow->get_all(query => \@query);
|
|
206 |
my $status = SL::DB::Manager::CsvImportReportStatus->get_all(query => \@query); |
|
205 |
my $rows = SL::DB::Manager::CsvImportReportRow ->get_all(query => \@query);
|
|
206 |
my $status = SL::DB::Manager::CsvImportReportStatus->get_all(query => \@query);
|
|
207 | 207 |
|
208 | 208 |
$self->{report_rows} = $self->{report}->folded_rows(rows => $rows); |
209 | 209 |
$self->{report_status} = $self->{report}->folded_status(status => $status); |
210 |
$self->{pages} = $pages; |
|
211 |
$self->{base_url} = $self->url_for(action => 'report', id => $report_id, no_layout => $params{no_layout} || $::form->{no_layout} ); |
|
210 |
$self->{pages} = $pages;
|
|
211 |
$self->{base_url} = $self->url_for(action => 'report', id => $report_id, no_layout => $params{no_layout} || $::form->{no_layout} );
|
|
212 | 212 |
|
213 | 213 |
$self->render('csv_import/report', { layout => !($params{no_layout} || $::form->{no_layout}) }); |
214 | 214 |
} |
Auch abrufbar als: Unified diff
CsvImport: Kosmetik (Anordnung)