Various bugfixes and code clean up.

This commit is contained in:
James Cole
2018-07-27 04:46:21 +02:00
parent 2ad8e7f343
commit 0312ba8ad7
60 changed files with 223 additions and 353 deletions

View File

@@ -66,22 +66,18 @@ class ImportProvider implements BinderInterface
$isDemoUser = $repository->hasRole($user, 'demo');
$isDebug = (bool)config('app.debug');
foreach ($providerNames as $providerName) {
//Log::debug(sprintf('Now with provider %s', $providerName));
// only consider enabled providers
$enabled = (bool)config(sprintf('import.enabled.%s', $providerName));
$allowedForDemo = (bool)config(sprintf('import.allowed_for_demo.%s', $providerName));
$allowedForUser = (bool)config(sprintf('import.allowed_for_user.%s', $providerName));
if (false === $enabled) {
//Log::debug('Provider is not enabled. NEXT!');
continue;
}
if (true === $isDemoUser && false === $allowedForDemo) {
//Log::debug('User is demo and this provider is not allowed for demo user. NEXT!');
continue;
}
if (false === $isDemoUser && false === $allowedForUser && false === $isDebug) {
//Log::debug('User is not demo and this provider is not allowed for such users. NEXT!');
continue; // @codeCoverageIgnore
}

View File

@@ -28,8 +28,11 @@ use Illuminate\Support\Facades\Facade;
/**
* @codeCoverageIgnore
* Class FireflyConfig.
* @method ?Configuration get($name, $default = null)
* @method null|Configuration get($name, $default = null)
* @method Configuration set(string $name, $value)
* @method delete(string $name)
* @method Configuration|null getFresh(string $name, $default = null)
* @method Configuration put(string $name, $value)
*/
class FireflyConfig extends Facade
{

View File

@@ -34,7 +34,7 @@ use Illuminate\Support\Facades\Facade;
* @method Collection beginsWith(User $user, string $search)
* @method bool delete(string $name)
* @method Collection findByName(string $name)
* @method Preference get(string $name, $value)
* @method Preference get(string $name, $value = null)
* @method array getArrayForUser(User $user, array $list)
* @method Preference|null getForUser(User $user, string $name, $default = null)
* @method string lastActivity()

View File

@@ -55,7 +55,7 @@ class FireflyConfig
*
* @return \FireflyIII\Models\Configuration|null
*/
public function get(string $name, $default = null): ?Configuration
public function get(string $name, $default = null): ?Configuration
{
$fullName = 'ff-config-' . $name;
if (Cache::has($fullName)) {

View File

@@ -63,7 +63,6 @@ class ConfigureRolesHandler implements FileConfigurationInterface
{
/** @var array $roles */
$roles = $config['column-roles'];
$count = $config['column-count'];
$assigned = 0;
// check if data actually contains amount column (foreign amount does not count)