Skip to content

Firefly III: a personal finances manager

Make CSV import a feature that can be turned on / off.

James Cole910510430357
diff --git a/app/Http/Controllers/CsvController.php b/app/Http/Controllers/CsvController.php
index 03cfd5e63f..c56c7f1046 100644
--- a/app/Http/Controllers/CsvController.php
+++ b/app/Http/Controllers/CsvController.php
@@ -43,6 +43,10 @@ class CsvController extends Controller
View::share('title', trans('firefly.csv'));
View::share('mainTitleIcon', 'fa-file-text-o');
+ if (Config::get('firefly.csv_import_enabled') === false) {
+ throw new FireflyException('CSV Import is not enabled.');
+ }
+
$this->wizard = App::make('FireflyIII\Helpers\Csv\WizardInterface');
$this->data = App::make('FireflyIII\Helpers\Csv\Data');
@@ -170,7 +174,7 @@ class CsvController extends Controller
$uploadPossible = is_writable(storage_path('upload'));
$path = storage_path('upload');
- return view('csv.index', compact('subTitle', 'uploadPossible', 'path','unsupported'));
+ return view('csv.index', compact('subTitle', 'uploadPossible', 'path', 'unsupported'));
}
/**
diff --git a/config/firefly.php b/config/firefly.php
index e56f64e13e..81f741bd77 100644
--- a/config/firefly.php
+++ b/config/firefly.php
@@ -5,6 +5,7 @@ return [
'version' => '3.4.6',
'index_periods' => ['1D', '1W', '1M', '3M', '6M', '1Y', 'custom'],
'budget_periods' => ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly'],
+ 'csv_import_enabled' => false,
'piggy_bank_periods' => [
'week' => 'Week',
'month' => 'Month',
diff --git a/resources/twig/partials/menu-sidebar.twig b/resources/twig/partials/menu-sidebar.twig
index 76bc4f4cfb..c3bfafa52c 100644
--- a/resources/twig/partials/menu-sidebar.twig
+++ b/resources/twig/partials/menu-sidebar.twig
@@ -123,9 +123,11 @@
<li class="{{ activeRoutePartial('currency') }}">
<a class="{{ activeRoutePartial('currency') }}" href="{{ route('currency.index') }}"><i class="fa fa-usd fa-fw"></i> {{ 'currencies'|_ }}</a>
</li>
+ {% if Config.get('firefly.csv_import_enabled') %}
<li class="{{ activeRoutePartial('csv') }}">
<a href="{{ route('csv.index') }}"><i class="fa fa-file-text-o fa-fw"></i> {{ 'csv_import'|_ }}</a>
</li>
+ {% endif %}
</ul>