Revision b347874b
Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt
SL/Controller/CsvImport.pm | ||
---|---|---|
163 | 163 |
$::form->error(t8('No report with id #1', $report_id)); |
164 | 164 |
} |
165 | 165 |
|
166 |
my $num_rows = $self->{report}->numrows; |
|
166 |
my $show_first_20 = ($self->{report}->profile->get('full_preview', 2) == 0); |
|
167 |
my $show_info_err = ($self->{report}->profile->get('full_preview', 2) == 1); |
|
168 |
|
|
169 |
my $num_rows = 0; |
|
170 |
if ($show_first_20) { |
|
171 |
$num_rows = min($self->{report}->numrows, 20); |
|
172 |
} elsif ($show_info_err) { |
|
173 |
# count each status row only once |
|
174 |
$num_rows = SL::DB::Manager::CsvImportReportStatus->get_all_count(query => [csv_import_report_id => $report_id], |
|
175 |
select => ['row'], |
|
176 |
distinct => 1,); |
|
177 |
} else { |
|
178 |
# show all |
|
179 |
$num_rows = $self->{report}->numrows; |
|
180 |
} |
|
167 | 181 |
|
168 | 182 |
# manual paginating, yuck |
169 | 183 |
my $page = $::form->{page} || 1; |
... | ... | |
180 | 194 |
my $last_row_header = $self->{report_numheaders} - 1; |
181 | 195 |
my $first_row_data = $pages->{per_page} * ($pages->{page}-1) + $self->{report_numheaders}; |
182 | 196 |
my $last_row_data = min($pages->{per_page} * $pages->{page}, $num_rows) + $self->{report_numheaders} - 1; |
183 |
$self->{display_rows} = [ |
|
184 |
$first_row_header |
|
185 |
.. |
|
186 |
$last_row_header, |
|
187 |
$first_row_data |
|
188 |
.. |
|
189 |
$last_row_data |
|
190 |
]; |
|
197 |
|
|
198 |
|
|
199 |
$self->{display_rows} = []; |
|
200 |
if ($show_info_err) { |
|
201 |
my $limit = $last_row_data - $first_row_data + 1; |
|
202 |
my $offset = $first_row_data - $self->{report_numheaders}; |
|
203 |
my @err_rows = map { $_->row } @{SL::DB::Manager::CsvImportReportStatus->get_all(query => [csv_import_report_id => $report_id], |
|
204 |
distinct => 1, |
|
205 |
select => ['row'], |
|
206 |
limit => $limit, |
|
207 |
offset => $offset, |
|
208 |
sort_by => 'row')}; |
|
209 |
$self->{display_rows} = [ $first_row_header .. $last_row_header, |
|
210 |
@err_rows ]; |
|
211 |
|
|
212 |
} else { |
|
213 |
|
|
214 |
$self->{display_rows} = [ $first_row_header .. $last_row_header, |
|
215 |
$first_row_data .. $last_row_data ]; |
|
216 |
} |
|
191 | 217 |
|
192 | 218 |
my @query = ( |
219 |
row => $self->{display_rows}, |
|
193 | 220 |
csv_import_report_id => $report_id, |
194 |
or => [ |
|
195 |
and => [ |
|
196 |
row => { ge => $first_row_header }, |
|
197 |
row => { le => $last_row_header }, |
|
198 |
], |
|
199 |
and => [ |
|
200 |
row => { ge => $first_row_data }, |
|
201 |
row => { le => $last_row_data }, |
|
202 |
] |
|
203 |
] |
|
204 | 221 |
); |
205 | 222 |
|
206 |
my $rows = SL::DB::Manager::CsvImportReportRow ->get_all(query => \@query); |
|
207 |
my $status = SL::DB::Manager::CsvImportReportStatus->get_all(query => \@query); |
|
223 |
my $rows = SL::DB::Manager::CsvImportReportRow ->get_all(query => \@query, sort_by => 'row');
|
|
224 |
my $status = SL::DB::Manager::CsvImportReportStatus->get_all(query => \@query, sort_by => 'row');
|
|
208 | 225 |
$self->{num_errors} = SL::DB::Manager::CsvImportReportStatus->get_all_count(query => [csv_import_report_id => $report_id, type => 'errors']); |
209 | 226 |
|
210 | 227 |
$self->{report_rows} = $self->{report}->folded_rows(rows => $rows); |
Auch abrufbar als: Unified diff
CsvImport: Filter/Begrenzung für Status-Bericht wieder ermöglichen.