use SL::DB::Unit;
use SL::DB::Helper::Paginated ();
use SL::Helper::Flash;
+use SL::Locale::String;
use SL::SessionFile;
use SL::Controller::CsvImport::Contact;
use SL::Controller::CsvImport::CustomerVendor;
if ($data->{progress}{finished} || $data->{errors}) {
$self->render('csv_import/_deferred_report', { no_layout => 1 });
} else {
+ if (!$self->task_server->is_running) {
+ $self->task_server->start;
+ $self->{status_text} = t8('Task Server is not running, starting it now. If this does not change, please check your task server config');
+ } elsif (my $phase = $data->{progress}{phase}) {
+ $self->{status_text} = "$data->{progress}{plan}{$phase} / $data->{progress}{num_phases} " . t8($phase);
+ } else {
+ $self->{status_text} = t8('Import not started yet, please wait...');
+ }
+
$self->render('csv_import/_deferred_results', { no_layout => 1 });
}
}
my $report_id = $params{report_id} || $::form->{id};
$self->{report} = SL::DB::Manager::CsvImportReport->find_by(id => $report_id);
+
+ if (!$self->{report}) {
+ $::form->error(t8('No report with id #1', $report_id));
+ }
my $num_rows = $self->{report}->numrows;
my $num_cols = SL::DB::Manager::CsvImportReportRow->get_all_count(query => [ csv_import_report_id => $report_id, row => 0 ]);
type => $self->type,
file => '',
numrows => scalar @{ $self->data },
- )->save(cascade => 1);
+ );
+
+ $report->save(cascade => 1) or die $report->db->error;
my $dbh = $::form->get_standard_dbh;
$dbh->begin_work;
my $o2 = $o1 + @methods;
for my $row (0 .. $#{ $self->data }) {
- $self->track_progress(progress => $row / @{ $self->data } * 100) if $row % 100 == 0;
+ $self->track_progress(progress => $row / @{ $self->data } * 100) if $row % 1000 == 0;
my $data_row = $self->{data}[$row];
$sth->execute($report->id, $_, $row + 1, $data_row->{info_data}{ $info_methods[$_] }) for 0 .. $#info_methods;
my $i;
my $num_data = scalar @{ $self->controller->data };
foreach my $entry (@{ $self->controller->data }) {
- $self->controller->track_progress(progress => $i/$num_data * 100) if $i % 1000 == 0;
+ $self->controller->track_progress(progress => $i/$num_data * 100) if $i % 100 == 0;
$self->check_buchungsgruppe($entry);
$self->check_type($entry);
}
[%- UNLESS SELF.background_job.data_as_hash.errors %]
$(document).ready(function(){
- $('#progress_description').html('[% SELF.background_job.data_as_hash.progress.plan.${SELF.background_job.data_as_hash.progress.phase} %] / [% SELF.background_job.data_as_hash.progress.num_phases %] [% SELF.background_job.data_as_hash.progress.phase | $T8 | html %]');
+ $('#progress_description').html('[% SELF.status_text | html %]');
$('#progressbar').progressbar({ value: [% SELF.background_job.data_as_hash.progress.progress * 1 %] });
window.setTimeout(reload_results, 500);
})
<h2>[%- LxERP.t8('Settings') %]</h2>
+ <div class="settings_toggle"[% UNLESS SELF.deferred || SELF.import_status %] style="display:none"[% END %]>
+ <a href="#" onClick="javascript:$('.settings_toggle').toggle()">[% LxERP.t8("Show settings") %]</a>
+ </div>
+
+ <div class="settings_toggle"[% IF SELF.deferred || SELF.import_status %] style="display:none"[% END %]>
+ <p><a href="#" onClick="javascript:$('.settings_toggle').toggle()">[% LxERP.t8("Hide settings") %]</a></p>
+
<table>
<tr>
<th align="right">[%- LxERP.t8('Number Format') %]:</th>
</table>
+ </div>
+ <hr>
+
[% L.submit_tag('action_test', LxERP.t8('Test and preview')) %]
[% L.submit_tag('action_import', LxERP.t8('Import'), style='display:none') %]