mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Include warning for #722
This commit is contained in:
@@ -23,6 +23,7 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Http\Response as LaravelResponse;
|
use Illuminate\Http\Response as LaravelResponse;
|
||||||
use Log;
|
use Log;
|
||||||
use Response;
|
use Response;
|
||||||
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -231,6 +232,13 @@ class ImportController extends Controller
|
|||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
$configurator->configureJob($data);
|
$configurator->configureJob($data);
|
||||||
|
|
||||||
|
// get possible warning from configurator:
|
||||||
|
$warning = $configurator->getWarningMessage();
|
||||||
|
|
||||||
|
if(strlen($warning) > 0) {
|
||||||
|
Session::flash('warning', $warning);
|
||||||
|
}
|
||||||
|
|
||||||
// return to configure
|
// return to configure
|
||||||
return redirect(route('import.configure', [$job->key]));
|
return redirect(route('import.configure', [$job->key]));
|
||||||
}
|
}
|
||||||
|
@@ -48,6 +48,13 @@ interface ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function getNextView(): string;
|
public function getNextView(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return possible warning to user.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getWarningMessage(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true when the initial configuration for this job is complete.
|
* Returns true when the initial configuration for this job is complete.
|
||||||
*
|
*
|
||||||
|
@@ -26,8 +26,12 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class CsvConfigurator implements ConfiguratorInterface
|
class CsvConfigurator implements ConfiguratorInterface
|
||||||
{
|
{
|
||||||
|
/** @var ImportJob */
|
||||||
private $job;
|
private $job;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
private $warning = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ConfiguratorInterface constructor.
|
* ConfiguratorInterface constructor.
|
||||||
*/
|
*/
|
||||||
@@ -50,8 +54,10 @@ class CsvConfigurator implements ConfiguratorInterface
|
|||||||
/** @var ConfigurationInterface $object */
|
/** @var ConfigurationInterface $object */
|
||||||
$object = new $class($this->job);
|
$object = new $class($this->job);
|
||||||
$object->setJob($job);
|
$object->setJob($job);
|
||||||
|
$result = $object->storeConfiguration($data);
|
||||||
|
$this->warning = $object->getWarningMessage();
|
||||||
|
|
||||||
return $object->storeConfiguration($data);
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,6 +97,16 @@ class CsvConfigurator implements ConfiguratorInterface
|
|||||||
throw new FireflyException('No view for state');
|
throw new FireflyException('No view for state');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return possible warning to user.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getWarningMessage(): string
|
||||||
|
{
|
||||||
|
return $this->warning;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@@ -43,4 +43,11 @@ interface ConfigurationInterface
|
|||||||
*/
|
*/
|
||||||
public function storeConfiguration(array $data): bool;
|
public function storeConfiguration(array $data): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return possible warning to user.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getWarningMessage(): string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -135,4 +135,14 @@ class Initial implements ConfigurationInterface
|
|||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return possible warning to user.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getWarningMessage(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -268,4 +268,14 @@ class Map implements ConfigurationInterface
|
|||||||
|
|
||||||
return $column;
|
return $column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return possible warning to user.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getWarningMessage(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,9 @@ class Roles implements ConfigurationInterface
|
|||||||
/** @var ImportJob */
|
/** @var ImportJob */
|
||||||
private $job;
|
private $job;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
private $warning = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data necessary to show the configuration screen.
|
* Get the data necessary to show the configuration screen.
|
||||||
*
|
*
|
||||||
@@ -68,6 +71,16 @@ class Roles implements ConfigurationInterface
|
|||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return possible warning to user.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getWarningMessage(): string
|
||||||
|
{
|
||||||
|
return $this->warning;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ImportJob $job
|
* @param ImportJob $job
|
||||||
*
|
*
|
||||||
@@ -246,6 +259,10 @@ class Roles implements ConfigurationInterface
|
|||||||
$config['column-roles-complete'] = true;
|
$config['column-roles-complete'] = true;
|
||||||
$this->job->configuration = $config;
|
$this->job->configuration = $config;
|
||||||
$this->job->save();
|
$this->job->save();
|
||||||
|
$this->warning = '';
|
||||||
|
}
|
||||||
|
if ($assigned === 0 || !$hasAmount) {
|
||||||
|
$this->warning = trans('csv.roles_warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -17,6 +17,7 @@ return [
|
|||||||
'initial_title' => 'Import setup (1/3) - Basic CSV import setup',
|
'initial_title' => 'Import setup (1/3) - Basic CSV import setup',
|
||||||
'initial_text' => 'To be able to import your file correctly, please validate the options below.',
|
'initial_text' => 'To be able to import your file correctly, please validate the options below.',
|
||||||
'initial_box' => 'Basic CSV import setup',
|
'initial_box' => 'Basic CSV import setup',
|
||||||
|
'initial_box_title' => 'Basic CSV import setup options',
|
||||||
'initial_header_help' => 'Check this box if the first row of your CSV file are the column titles.',
|
'initial_header_help' => 'Check this box if the first row of your CSV file are the column titles.',
|
||||||
'initial_date_help' => 'Date time format in your CSV. Follow the format like <a href="https://secure.php.net/manual/en/datetime.createfromformat.php#refsect1-datetime.createfromformat-parameters">this page</a> indicates. The default value will parse dates that look like this: :dateExample.',
|
'initial_date_help' => 'Date time format in your CSV. Follow the format like <a href="https://secure.php.net/manual/en/datetime.createfromformat.php#refsect1-datetime.createfromformat-parameters">this page</a> indicates. The default value will parse dates that look like this: :dateExample.',
|
||||||
'initial_delimiter_help' => 'Choose the field delimiter that is used in your input file. If not sure, comma is the safest option.',
|
'initial_delimiter_help' => 'Choose the field delimiter that is used in your input file. If not sure, comma is the safest option.',
|
||||||
@@ -34,6 +35,7 @@ return [
|
|||||||
'roles_column' => 'Column',
|
'roles_column' => 'Column',
|
||||||
'roles_no_example_data' => 'No example data available',
|
'roles_no_example_data' => 'No example data available',
|
||||||
'roles_submit' => 'Continue with step 3/3',
|
'roles_submit' => 'Continue with step 3/3',
|
||||||
|
'roles_warning' => 'At the very least, mark one column as the amount-column. It is advisable to also select a column for the description, date and the opposing account.',
|
||||||
|
|
||||||
// map data
|
// map data
|
||||||
'map_title' => 'Import setup (3/3) - Connect import data to Firefly III data',
|
'map_title' => 'Import setup (3/3) - Connect import data to Firefly III data',
|
||||||
|
Reference in New Issue
Block a user