added importing doogal data for wards on postcode
This commit is contained in:
parent
9b7d8530b6
commit
c977cf3279
16 changed files with 4947 additions and 1 deletions
|
@ -43,6 +43,34 @@ sub post_suppliers {
|
|||
return $c->redirect_to('/admin/import_from');
|
||||
}
|
||||
|
||||
sub post_postcodes {
|
||||
my $c = shift;
|
||||
|
||||
unless ($c->param('postcodes_csv')) {
|
||||
$c->flash(error => "No CSV file given");
|
||||
return $c->redirect_to('/admin/import_from');
|
||||
}
|
||||
|
||||
# Check file size
|
||||
if ($c->req->is_limit_exceeded) {
|
||||
$c->flash(error => "CSV file size is too large");
|
||||
return $c->redirect_to('/admin/import_from');
|
||||
}
|
||||
|
||||
my $file = $c->param('postcodes_csv');
|
||||
|
||||
my $filename = path($c->app->config->{upload_path}, time . 'postcodes.csv');
|
||||
|
||||
$file->move_to($filename);
|
||||
|
||||
my $job_id = $c->minion->enqueue('csv_postcode_import' => [ $filename ]);
|
||||
|
||||
my $job_url = $c->url_for("/admin/minion/jobs?id=$job_id")->to_abs;
|
||||
|
||||
$c->flash(success => "CSV import started, see status of minion job at: $job_url");
|
||||
return $c->redirect_to('/admin/import_from');
|
||||
}
|
||||
|
||||
sub post_transactions {
|
||||
my $c = shift;
|
||||
|
||||
|
|
Reference in a new issue