mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Merge branch 'release/4.6.2'
This commit is contained in:
@@ -36,4 +36,4 @@ class CurrencyCode implements BinderInterface
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,6 +565,19 @@ class ExpandedForm
|
||||
unset($options['currency']);
|
||||
unset($options['placeholder']);
|
||||
|
||||
// perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount)
|
||||
$preFilled = session('preFilled');
|
||||
$key = 'amount_currency_id_' . $name;
|
||||
$sentCurrencyId = isset($preFilled[$key]) ? intval($preFilled[$key]) : $defaultCurrency->id;
|
||||
|
||||
// find this currency in set of currencies:
|
||||
foreach ($currencies as $currency) {
|
||||
if ($currency->id === $sentCurrencyId) {
|
||||
$defaultCurrency = $currency;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// make sure value is formatted nicely:
|
||||
if (!is_null($value) && $value !== '') {
|
||||
$value = round($value, $defaultCurrency->decimal_places);
|
||||
|
||||
@@ -43,4 +43,4 @@ interface ConfigurationInterface
|
||||
*/
|
||||
public function storeConfiguration(array $data): bool;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ use Log;
|
||||
class Initial implements ConfigurationInterface
|
||||
{
|
||||
private $job;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -106,6 +107,21 @@ class Initial implements ConfigurationInterface
|
||||
Log::error('Could not find anything for csv_import_account.', ['id' => $importId]);
|
||||
}
|
||||
|
||||
$config = $this->storeSpecifics($data, $config);
|
||||
$this->job->configuration = $config;
|
||||
$this->job->save();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param array $config
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function storeSpecifics(array $data, array $config): array
|
||||
{
|
||||
// loop specifics.
|
||||
if (isset($data['specifics']) && is_array($data['specifics'])) {
|
||||
foreach ($data['specifics'] as $name => $enabled) {
|
||||
@@ -116,9 +132,7 @@ class Initial implements ConfigurationInterface
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->job->configuration = $config;
|
||||
$this->job->save();
|
||||
|
||||
return true;
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,4 +266,4 @@ class Map implements ConfigurationInterface
|
||||
|
||||
return $column;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,18 @@ class Roles implements ConfigurationInterface
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ImportJob $job
|
||||
*
|
||||
* @return ConfigurationInterface
|
||||
*/
|
||||
public function setJob(ImportJob $job): ConfigurationInterface
|
||||
{
|
||||
$this->job = $job;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the result.
|
||||
*
|
||||
@@ -217,16 +229,20 @@ class Roles implements ConfigurationInterface
|
||||
*/
|
||||
private function setRolesComplete(): bool
|
||||
{
|
||||
$config = $this->job->configuration;
|
||||
$count = $config['column-count'];
|
||||
$assigned = 0;
|
||||
$config = $this->job->configuration;
|
||||
$count = $config['column-count'];
|
||||
$assigned = 0;
|
||||
$hasAmount = false;
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$role = $config['column-roles'][$i] ?? '_ignore';
|
||||
if ($role !== '_ignore') {
|
||||
$assigned++;
|
||||
}
|
||||
if ($role === 'amount') {
|
||||
$hasAmount = true;
|
||||
}
|
||||
}
|
||||
if ($assigned > 0) {
|
||||
if ($assigned > 0 && $hasAmount) {
|
||||
$config['column-roles-complete'] = true;
|
||||
$this->job->configuration = $config;
|
||||
$this->job->save();
|
||||
@@ -248,16 +264,4 @@ class Roles implements ConfigurationInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ImportJob $job
|
||||
*
|
||||
* @return ConfigurationInterface
|
||||
*/
|
||||
public function setJob(ImportJob $job): ConfigurationInterface
|
||||
{
|
||||
$this->job = $job;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,4 +208,4 @@ class Modifier
|
||||
|
||||
return self::stringCompare($journalCategory, $search) || self::stringCompare($transactionCategory, $search);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class Search implements SearchInterface
|
||||
public function __construct()
|
||||
{
|
||||
$this->modifiers = new Collection;
|
||||
$this->validModifiers = (array) config('firefly.search_modifiers');
|
||||
$this->validModifiers = (array)config('firefly.search_modifiers');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support;
|
||||
|
||||
use \Amount as GlobalAmount;
|
||||
use Amount as GlobalAmount;
|
||||
use Carbon\Carbon;
|
||||
use Crypt;
|
||||
use DB;
|
||||
|
||||
@@ -265,4 +265,4 @@ class AmountFormat extends Twig_Extension
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user