Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Some light refactoring. No changes.
James Cole7c7073224716
diff --git a/app/Console/Commands/CreateImport.php b/app/Console/Commands/CreateImport.phpindex bfb52735e2..07fe3d734d 100644--- a/app/Console/Commands/CreateImport.php+++ b/app/Console/Commands/CreateImport.php@@ -178,7 +178,7 @@ class CreateImport extends Command$cwd = getcwd();$validTypes = config('import.options.file.import_formats');$type = strtolower($this->option('type'));- if (null === $user->id) {+ if (null === $user) {$this->error(sprintf('There is no user with ID %d.', $this->option('user')));return false;diff --git a/app/Console/Commands/VerifiesAccessToken.php b/app/Console/Commands/VerifiesAccessToken.phpindex 864c6f784c..f2bd65a49c 100644--- a/app/Console/Commands/VerifiesAccessToken.php+++ b/app/Console/Commands/VerifiesAccessToken.php@@ -36,7 +36,7 @@ trait VerifiesAccessToken/*** Abstract method to make sure trait knows about method "option".*- * @param null $key+ * @param string|null $key** @return mixed*/@@ -55,7 +55,7 @@ trait VerifiesAccessToken$repository = app(UserRepositoryInterface::class);$user = $repository->find($userId);- if (null === $user->id) {+ if (null === $user) {Log::error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId));return false;diff --git a/app/Helpers/Collector/JournalCollector.php b/app/Helpers/Collector/JournalCollector.phpindex 96a1628efc..3e04a2217d 100644--- a/app/Helpers/Collector/JournalCollector.php+++ b/app/Helpers/Collector/JournalCollector.php@@ -233,7 +233,7 @@ class JournalCollector implements JournalCollectorInterface$countQuery->getQuery()->groups = null;$countQuery->getQuery()->orders = null;$countQuery->groupBy('accounts.user_id');- $this->count = $countQuery->count();+ $this->count = intval($countQuery->count());return $this->count;}@@ -252,7 +252,7 @@ class JournalCollector implements JournalCollectorInterface$cache->addProperty($key);if ($cache->has()) {Log::debug(sprintf('Return cache of query with ID "%s".', $key));- //return $cache->get(); // @codeCoverageIgnore+ return $cache->get(); // @codeCoverageIgnore}/** @var Collection $set */diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.phpindex 7d6a73793e..ea797583f2 100644--- a/app/Http/Controllers/CategoryController.php+++ b/app/Http/Controllers/CategoryController.php@@ -190,7 +190,7 @@ class CategoryController extends Controller$end = new Carbon;}- // prep for "specific date" view.$dates = app('navigation')->blockPeriods($start, $end, $range);+ // prep for "specific date" view.if (strlen($moment) > 0 && 'all' !== $moment) {$start = app('navigation')->startOfPeriod(new Carbon($moment), $range);$end = app('navigation')->endOfPeriod($start, $range);diff --git a/app/Http/Controllers/Import/StatusController.php b/app/Http/Controllers/Import/StatusController.phpindex adb6bae118..79b630194c 100644--- a/app/Http/Controllers/Import/StatusController.php+++ b/app/Http/Controllers/Import/StatusController.php@@ -105,7 +105,7 @@ class StatusController extends Controller}if ($tagId === 0) {- $result['finishedText'] = trans('import.status_finished_no_tag');+ $result['finishedText'] = trans('import.status_finished_no_tag'); // @codeCoverageIgnore}}diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.phpindex 75e3a70a50..7f68c9875d 100644--- a/app/Http/Controllers/PreferencesController.php+++ b/app/Http/Controllers/PreferencesController.php@@ -128,7 +128,7 @@ class PreferencesController extends Controller* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector* @SuppressWarnings(PHPMD.UnusedFormalParameter) // it's unused but the class does some validation.*/- public function postCode(TokenFormRequest $request)+ public function postCode(/** @scrutinizer ignore-unused */ TokenFormRequest $request){Preferences::set('twoFactorAuthEnabled', 1);Preferences::set('twoFactorAuthSecret', Session::get('two-factor-secret'));diff --git a/app/Http/Middleware/AuthenticateTwoFactor.php b/app/Http/Middleware/AuthenticateTwoFactor.phpindex c2ead8de22..628f74c3ab 100644--- a/app/Http/Middleware/AuthenticateTwoFactor.php+++ b/app/Http/Middleware/AuthenticateTwoFactor.php@@ -24,10 +24,8 @@ namespace FireflyIII\Http\Middleware;use Closure;use Illuminate\Http\Request;-use Illuminate\Support\Facades\Auth;use Log;use Preferences;-use Session;/*** Class AuthenticateTwoFactor.@@ -45,26 +43,9 @@ class AuthenticateTwoFactor*/public function handle(Request $request, Closure $next, $guard = null){- // do the usual auth, again:- if (Auth::guard($guard)->guest()) {- if ($request->ajax()) {- return response('Unauthorized.', 401);- }-- return redirect()->guest('login');- }-- if (1 === intval(auth()->user()->blocked)) {- Auth::guard($guard)->logout();- Session::flash('logoutMessage', trans('firefly.block_account_logout'));-- return redirect()->guest('login');- }$is2faEnabled = Preferences::get('twoFactorAuthEnabled', false)->data;$has2faSecret = null !== Preferences::get('twoFactorAuthSecret');-- // grab 2auth information from session.- $is2faAuthed = 'true' === $request->cookie('twoFactorAuthenticated');+ $is2faAuthed = 'true' === $request->cookie('twoFactorAuthenticated');if ($is2faEnabled && $has2faSecret && !$is2faAuthed) {Log::debug('Does not seem to be 2 factor authed, redirect.');diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.phpindex 2391787dd5..e2089b222c 100644--- a/app/Http/Middleware/TrustProxies.php+++ b/app/Http/Middleware/TrustProxies.php@@ -60,8 +60,8 @@ class TrustProxies extends Middlewarepublic function __construct(Repository $config){$trustedProxies = env('TRUSTED_PROXIES', null);- if (null !== $trustedProxies && strlen($trustedProxies) > 0) {- $this->proxies = $trustedProxies;+ if (false !== $trustedProxies && null !== $trustedProxies && strlen($trustedProxies) > 0) {+ $this->proxies = strval($trustedProxies);}parent::__construct($config);diff --git a/app/Import/Configuration/FileConfigurator.php b/app/Import/Configuration/FileConfigurator.phpindex 5806f3c143..1cde0e8015 100644--- a/app/Import/Configuration/FileConfigurator.php+++ b/app/Import/Configuration/FileConfigurator.php@@ -249,6 +249,9 @@ class FileConfigurator implements ConfiguratorInterface}/**+ * Shorthand method to return the extended status.+ *+ * @codeCoverageIgnore* @return array*/private function getExtendedStatus(): array@@ -257,8 +260,9 @@ class FileConfigurator implements ConfiguratorInterface}/**- * Shorthand method.+ * Shorthand method to set the extended status.*+ * @codeCoverageIgnore* @param array $extended*/private function setExtendedStatus(array $extended): voiddiff --git a/app/Import/Configuration/SpectreConfigurator.php b/app/Import/Configuration/SpectreConfigurator.phpindex be4b4a5181..d3ed6d5b87 100644--- a/app/Import/Configuration/SpectreConfigurator.php+++ b/app/Import/Configuration/SpectreConfigurator.php@@ -77,7 +77,6 @@ class SpectreConfigurator implements ConfiguratorInterface$this->repository->setConfiguration($this->job, $config);return true;- break;default:throw new FireflyException(sprintf('Cannot store configuration when job is in state "%s"', $stage));break;@@ -95,7 +94,9 @@ class SpectreConfigurator implements ConfiguratorInterfaceif (is_null($this->job)) {throw new FireflyException('Cannot call configureJob() without a job.');}- $stage = $this->getConfig()['stage'] ?? 'initial';+ $config = $this->getConfig();+ $stage = $config['stage'] ?? 'initial';+Log::debug(sprintf('in getNextData(), for stage "%s".', $stage));switch ($stage) {case 'has-token':@@ -109,9 +110,7 @@ class SpectreConfigurator implements ConfiguratorInterface$this->repository->setStatus($this->job, $status);return $this->repository->getConfiguration($this->job);- break;case 'have-accounts':- // use special class:/** @var HaveAccounts $class */$class = app(HaveAccounts::class);$class->setJob($this->job);@@ -120,7 +119,6 @@ class SpectreConfigurator implements ConfiguratorInterfacereturn $data;default:return [];- break;}}@@ -141,13 +139,10 @@ class SpectreConfigurator implements ConfiguratorInterfaceLog::info('User is being redirected to Spectre.');return 'import.spectre.redirect';- break;case 'have-accounts':return 'import.spectre.accounts';- break;default:return '';- break;}}diff --git a/app/Import/Converter/Amount.php b/app/Import/Converter/Amount.phpindex cd25a8d51f..ccf7f6f76c 100644--- a/app/Import/Converter/Amount.php+++ b/app/Import/Converter/Amount.php@@ -77,7 +77,7 @@ class Amount implements ConverterInterfaceLog::debug(sprintf('Searched from the left for "." in amount "%s", assume this is the decimal sign.', $value));$decimal = '.';}- unset($options, $res);+ unset($res);}// if decimal is dot, replace all comma's and spaces with nothing. then parse as float (round to 4 pos)diff --git a/app/Import/FileProcessor/CsvProcessor.php b/app/Import/FileProcessor/CsvProcessor.phpindex af298e6837..a0de8ca0ff 100644--- a/app/Import/FileProcessor/CsvProcessor.php+++ b/app/Import/FileProcessor/CsvProcessor.php@@ -122,9 +122,9 @@ class CsvProcessor implements FileProcessorInterface}/**- * @codeCoverageIgnore- * Shorthand method+ * Shorthand method to set the extended status.*+ * @codeCoverageIgnore* @param array $array*/public function setExtendedStatus(array $array)@@ -149,7 +149,9 @@ class CsvProcessor implements FileProcessorInterface}/**- * Shorthand method.+ * Shorthand method to add a step.+ *+ * @codeCoverageIgnore*/private function addStep(){@@ -187,9 +189,9 @@ class CsvProcessor implements FileProcessorInterface}/**- * @codeCoverageIgnore- * Shorthand method.+ * Shorthand method to return configuration.*+ * @codeCoverageIgnore* @return array*/private function getConfig(): array@@ -197,18 +199,6 @@ class CsvProcessor implements FileProcessorInterfacereturn $this->repository->getConfiguration($this->job);}- /**- * @codeCoverageIgnore- * Shorthand method.- *- * @return array- */- private function getExtendedStatus(): array- {- return $this->repository->getExtendedStatus($this->job);- }--/*** @return Iterator*diff --git a/app/Import/Storage/ImportStorage.php b/app/Import/Storage/ImportStorage.phpindex 0b8ee7c9c4..8990aab387 100644--- a/app/Import/Storage/ImportStorage.php+++ b/app/Import/Storage/ImportStorage.php@@ -310,7 +310,6 @@ class ImportStorage$amount = app('steam')->positive($parameters['amount']);$names = [$parameters['asset'], $parameters['opposing']];- $transfer = [];sort($names);diff --git a/app/Models/ExportJob.php b/app/Models/ExportJob.phpindex 1c019919e6..629d212b18 100644--- a/app/Models/ExportJob.php+++ b/app/Models/ExportJob.php@@ -30,6 +30,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* Class ExportJob.** @property User $user+ * @property string $key*/class ExportJob extends Model{diff --git a/app/Models/Transaction.php b/app/Models/Transaction.phpindex 35d388ad99..0ac3df916e 100644--- a/app/Models/Transaction.php+++ b/app/Models/Transaction.php@@ -66,6 +66,7 @@ use Watson\Validating\ValidatingTrait;* @property string $transaction_currency_symbol* @property int $transaction_currency_dp* @property string $transaction_currency_code+ * @property string $description*/class Transaction extends Model{diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.phpindex 708fc36217..304b45487f 100644--- a/app/Models/TransactionCurrency.php+++ b/app/Models/TransactionCurrency.php@@ -28,6 +28,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/*** Class TransactionCurrency.+ *+ * @property string $code+ **/class TransactionCurrency extends Model{diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.phpindex 74fc1fd07a..12408be513 100644--- a/app/Models/TransactionJournal.php+++ b/app/Models/TransactionJournal.php@@ -92,8 +92,6 @@ class TransactionJournal extends Modelif (auth()->check()) {$journalId = intval($value);$journal = auth()->user()->transactionJournals()->where('transaction_journals.id', $journalId)- ->with('transactionType')- ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')->first(['transaction_journals.*']);if (!is_null($journal)) {return $journal;diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.phpindex eda9a6272b..2d47f0964e 100644--- a/app/Repositories/LinkType/LinkTypeRepository.php+++ b/app/Repositories/LinkType/LinkTypeRepository.php@@ -202,9 +202,6 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface$dbNote->save();}- //$link->comment = $link['notes'] ?? null;--return $link;}diff --git a/app/Support/Import/Configuration/Spectre/HaveAccounts.php b/app/Support/Import/Configuration/Spectre/HaveAccounts.phpindex 796d05afd9..9a7bedb9c6 100644--- a/app/Support/Import/Configuration/Spectre/HaveAccounts.php+++ b/app/Support/Import/Configuration/Spectre/HaveAccounts.php@@ -51,7 +51,6 @@ class HaveAccounts implements ConfigurationInterface$accountRepository = app(AccountRepositoryInterface::class);/** @var CurrencyRepositoryInterface $currencyRepository */$currencyRepository = app(CurrencyRepositoryInterface::class);- $data = [];$config = $this->job->configuration;$collection = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);$defaultCurrency = app('amount')->getDefaultCurrency();diff --git a/app/Support/Models/TransactionJournalTrait.php b/app/Support/Models/TransactionJournalTrait.phpindex 196f154d45..103bb83c36 100644--- a/app/Support/Models/TransactionJournalTrait.php+++ b/app/Support/Models/TransactionJournalTrait.php@@ -42,6 +42,27 @@ use Illuminate\Support\Collection;*/trait TransactionJournalTrait{+ /**+ * @param Builder $query+ * @param string $table+ *+ * @return bool+ */+ public static function isJoined(Builder $query, string $table): bool+ {+ $joins = $query->getQuery()->joins;+ if (null === $joins) {+ return false;+ }+ foreach ($joins as $join) {+ if ($join->table === $table) {+ return true;+ }+ }++ return false;+ }+/*** @return string*/@@ -211,27 +232,6 @@ trait TransactionJournalTrait*/abstract public function isDeposit(): bool;- /**- * @param Builder $query- * @param string $table- *- * @return bool- */- public function isJoined(Builder $query, string $table): bool- {- $joins = $query->getQuery()->joins;- if (null === $joins) {- return false;- }- foreach ($joins as $join) {- if ($join->table === $table) {- return true;- }- }-- return false;- }-/*** @return bool*/diff --git a/app/Support/Navigation.php b/app/Support/Navigation.phpindex 7ce617c594..29c569d26f 100644--- a/app/Support/Navigation.php+++ b/app/Support/Navigation.php@@ -256,7 +256,7 @@ class Navigation{// define period to increment$increment = 'addDay';- $format = self::preferredCarbonFormat($start, $end);+ $format = $this->preferredCarbonFormat($start, $end);$displayFormat = strval(trans('config.month_and_day'));// increment by month (for year)if ($start->diffInMonths($end) > 1) {diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.phpindex f754ae6645..8427db6780 100644--- a/app/Validation/FireflyValidator.php+++ b/app/Validation/FireflyValidator.php@@ -65,7 +65,7 @@ class FireflyValidator extends Validator** @return bool*/- public function validate2faCode($attribute, $value): bool+ public function validate2faCode(/** @scrutinizer ignore-unused */ $attribute, $value): bool{if (!is_string($value) || null === $value || 6 != strlen($value)) {return false;@@ -85,7 +85,7 @@ class FireflyValidator extends Validator** @return bool*/- public function validateBelongsToUser($attribute, $value, $parameters): bool+ public function validateBelongsToUser(/** @scrutinizer ignore-unused */ $attribute, $value, $parameters): bool{$field = $parameters[1] ?? 'id';@@ -108,7 +108,7 @@ class FireflyValidator extends Validator** @return bool*/- public function validateBic($attribute, $value): bool+ public function validateBic(/** @scrutinizer ignore-unused */ $attribute, $value): bool{$regex = '/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i';$result = preg_match($regex, $value);@@ -130,7 +130,7 @@ class FireflyValidator extends Validator** @return bool*/- public function validateIban($attribute, $value): bool+ public function validateIban(/** @scrutinizer ignore-unused */ $attribute, $value): bool{if (!is_string($value) || null === $value || strlen($value) < 6) {return false;@@ -210,7 +210,7 @@ class FireflyValidator extends Validator** @return bool*/- public function validateMore($attribute, $value, $parameters): bool+ public function validateMore(/** @scrutinizer ignore-unused */ $attribute, $value, $parameters): bool{$compare = $parameters[0] ?? '0';@@ -226,7 +226,7 @@ class FireflyValidator extends Validator** @return bool*/- public function validateMustExist($attribute, $value, $parameters): bool+ public function validateMustExist(/** @scrutinizer ignore-unused */ $attribute, $value, $parameters): bool{$field = $parameters[1] ?? 'id';@@ -335,7 +335,7 @@ class FireflyValidator extends Validator** @return bool*/- public function validateSecurePassword($attribute, $value): bool+ public function validateSecurePassword(/** @scrutinizer ignore-unused */ $attribute, $value): bool{$verify = false;if (isset($this->data['verify_password'])) {@@ -360,7 +360,7 @@ class FireflyValidator extends Validator** @return bool*/- public function validateUniqueAccountForUser($attribute, $value, $parameters): bool+ public function validateUniqueAccountForUser(/** @scrutinizer ignore-unused */ $attribute, $value, $parameters): bool{// because a user does not have to be logged in (tests and what-not).if (!auth()->check()) {@@ -390,7 +390,7 @@ class FireflyValidator extends Validator** @return bool*/- public function validateUniqueAccountNumberForUser($attribute, $value): bool+ public function validateUniqueAccountNumberForUser(/** @scrutinizer ignore-unused */ $attribute, $value): bool{$accountId = $this->data['id'] ?? 0;@@ -428,7 +428,7 @@ class FireflyValidator extends Validator** @return bool*/- public function validateUniqueObjectForUser($attribute, $value, $parameters): bool+ public function validateUniqueObjectForUser(/** @scrutinizer ignore-unused */ $attribute, $value, $parameters): bool{$value = $this->tryDecrypt($value);// exclude?@@ -460,7 +460,7 @@ class FireflyValidator extends Validator** @return bool*/- public function validateUniquePiggyBankForUser($attribute, $value, $parameters): bool+ public function validateUniquePiggyBankForUser(/** @scrutinizer ignore-unused */ $attribute, $value, $parameters): bool{$exclude = $parameters[0] ?? null;$query = DB::table('piggy_banks')->whereNull('piggy_banks.deleted_at')diff --git a/public/js/ff/accounts/reconcile.js b/public/js/ff/accounts/reconcile.jsindex 4f1b46666d..2a2571f338 100644--- a/public/js/ff/accounts/reconcile.js+++ b/public/js/ff/accounts/reconcile.js@@ -36,7 +36,6 @@ $(function () {Respond to changes in balance statements.*/$('input[type="number"]').on('change', function () {- console.log('On change number input.');if (reconcileStarted) {calculateBalanceDifference();difference = balanceDifference - selectedAmount;@@ -50,7 +49,6 @@ $(function () {Respond to changes in the date range.*/$('input[type="date"]').on('change', function () {- console.log('On change date input.');if (reconcileStarted) {// hide original instructions.$('.select_transactions_instruction').hide();@@ -70,19 +68,16 @@ $(function () {});function storeReconcile() {- console.log('In storeReconcile.');// get modal HTML:var ids = [];$.each($('.reconcile_checkbox:checked'), function (i, v) {ids.push($(v).data('id'));});- console.log('Ids is ' + ids);var cleared = [];$.each($('input[class="cleared"]'), function (i, v) {var obj = $(v);cleared.push(obj.data('id'));});- console.log('Cleared is ' + ids);var variables = {startBalance: parseFloat($('input[name="start_balance"]').val()),@@ -105,7 +100,6 @@ function storeReconcile() {* @param e*/function checkReconciledBox(e) {- console.log('In checkReconciledBox.');var el = $(e.target);var amount = parseFloat(el.val());// if checked, add to selected amount@@ -125,13 +119,9 @@ function checkReconciledBox(e) {* and put it in balanceDifference.*/function calculateBalanceDifference() {- console.log('In calculateBalanceDifference.');var startBalance = parseFloat($('input[name="start_balance"]').val());var endBalance = parseFloat($('input[name="end_balance"]').val());balanceDifference = startBalance - endBalance;- //if (balanceDifference < 0) {- // balanceDifference = balanceDifference * -1;- //}}/**@@ -139,7 +129,6 @@ function calculateBalanceDifference() {* This more or less resets the reconciliation.*/function getTransactionsForRange() {- console.log('In getTransactionsForRange.');// clear out the box:$('#transactions_holder').empty().append($('<p>').addClass('text-center').html('<i class="fa fa-fw fa-spin fa-spinner"></i>'));var uri = transactionsUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val());@@ -154,7 +143,6 @@ function getTransactionsForRange() {**/function includeClearedTransactions() {- console.log('In includeClearedTransactions.');$.each($('input[class="cleared"]'), function (i, v) {var obj = $(v);if (obj.data('younger') === false) {@@ -168,7 +156,6 @@ function includeClearedTransactions() {* @param data*/function placeTransactions(data) {- console.log('In placeTransactions.');$('#transactions_holder').empty().html(data.html);selectedAmount = 0;// update start + end balance when user has not touched them.@@ -200,7 +187,6 @@ function placeTransactions(data) {* @returns {boolean}*/function startReconcile() {- console.log('In startReconcile.');reconcileStarted = true;// hide the start button.@@ -222,7 +208,6 @@ function startReconcile() {}function updateDifference() {- console.log('In updateDifference.');var addClass = 'text-info';if (difference > 0) {addClass = 'text-success';diff --git a/public/js/ff/export/index.js b/public/js/ff/export/index.jsindex 6bd496b5c0..c4974d4f79 100644--- a/public/js/ff/export/index.js+++ b/public/js/ff/export/index.js@@ -44,7 +44,6 @@ $(function () {function startExport() {"use strict";- console.log('startExport');hideForm();showLoading();hideError();diff --git a/public/js/ff/import/status.js b/public/js/ff/import/status.jsindex abcc976e03..99deca6f09 100644--- a/public/js/ff/import/status.js+++ b/public/js/ff/import/status.js@@ -35,7 +35,6 @@ var knownErrors = 0;$(function () {"use strict";- console.log('in start');timeOutId = setTimeout(checkJobStatus, startInterval);$('.start-job').click(function () {@@ -44,7 +43,6 @@ $(function () {startJob();});if (job.configuration['auto-start']) {- console.log('Called startJob()!');startJob();}});@@ -53,7 +51,6 @@ $(function () {* Downloads some JSON and responds to its content to see what the status is of the current import.*/function checkJobStatus() {- console.log('in checkJobStatus');$.getJSON(jobStatusUri).done(reportOnJobStatus).fail(reportFailedJob);}@@ -61,7 +58,6 @@ function checkJobStatus() {* This method is called when the JSON query returns an error. If possible, this error is relayed to the user.*/function reportFailedJob(jqxhr, textStatus, error) {- console.log('in reportFailedJob');// hide all possible boxes:$('.statusbox').hide();@@ -81,7 +77,6 @@ function reportFailedJob(jqxhr, textStatus, error) {* @param data*/function reportOnJobStatus(data) {- console.log('in reportOnJobStatus: ' + data.status);switch (data.status) {case "configured":@@ -91,18 +86,13 @@ function reportOnJobStatus(data) {$('.status_configured').show();}if (job.configuration['auto-start']) {- console.log('Job is auto start. Check status again in 500ms.');timeOutId = setTimeout(checkJobStatus, interval);}if (pressedStart) {- console.log('pressedStart = true, will check extra.');// do a time out just in case. Could be that job is running or is even done already.timeOutId = setTimeout(checkJobStatus, 2000);pressedStart = false;}- if (!pressedStart) {- console.log('pressedStart = false, will do nothing.');- }break;case "running":// job is running! Show the running box:@@ -148,7 +138,6 @@ function reportOnJobStatus(data) {break;case "configuring":// redirect back to configure screen.- console.log('Will now redirect to ' + jobConfigureUri);window.location = jobConfigureUri;break;default:@@ -192,9 +181,7 @@ function jobIsStalled(data) {* Only when job is in "configured" state.*/function startJob() {- console.log("In startJob()");if (job.status === "configured") {- console.log("Job started!");// disable the button, add loading thing.$('.start-job').prop('disabled', true).text('...');$.post(jobStartUri, {_token: token}).fail(reportOnSubmitError);@@ -203,7 +190,6 @@ function startJob() {timeOutId = setTimeout(checkJobStatus, startInterval);return;}- console.log("Job not auto started because state is " + job.status);}/**diff --git a/resources/views/accounts/reconcile/edit.twig b/resources/views/accounts/reconcile/edit.twigindex 8c053c04c1..116fa6f29d 100644--- a/resources/views/accounts/reconcile/edit.twig+++ b/resources/views/accounts/reconcile/edit.twig@@ -51,7 +51,7 @@</div><div class="box-body">{# category always #}- {{ ExpandedForm.text('category',data['category']) }}+ {{ ExpandedForm.text('category',data.category) }}{# tags #}{{ ExpandedForm.text('tags') }}diff --git a/tests/Feature/Controllers/Chart/CategoryControllerTest.php b/tests/Feature/Controllers/Chart/CategoryControllerTest.phpindex cfb9f5c73d..6f227873b1 100644--- a/tests/Feature/Controllers/Chart/CategoryControllerTest.php+++ b/tests/Feature/Controllers/Chart/CategoryControllerTest.php@@ -50,13 +50,16 @@ class CategoryControllerTest extends TestCase*/public function testAll(string $range){+$repository = $this->mock(CategoryRepositoryInterface::class);$accountRepos = $this->mock(AccountRepositoryInterface::class);$generator = $this->mock(GeneratorInterface::class);+ $firstUse = new Carbon;+ $firstUse->subDays(3);$repository->shouldReceive('spentInPeriod')->andReturn('0');$repository->shouldReceive('earnedInPeriod')->andReturn('0');- $repository->shouldReceive('firstUseDate')->andReturn(new Carbon('1900-01-01'))->once();+ $repository->shouldReceive('firstUseDate')->andReturn($firstUse)->once();$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection)->once();$generator->shouldReceive('multiSet')->once()->andReturn([]);diff --git a/tests/Unit/Middleware/SandstormTest.php b/tests/Unit/Middleware/SandstormTest.phpindex 08ad7363ce..91dab83d91 100644--- a/tests/Unit/Middleware/SandstormTest.php+++ b/tests/Unit/Middleware/SandstormTest.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace Tests\Unit\Helpers;use FireflyIII\Http\Middleware\Sandstorm;+use FireflyIII\Models\Role;use FireflyIII\Repositories\User\UserRepositoryInterface;use Route;use Symfony\Component\HttpFoundation\Response;@@ -74,7 +75,7 @@ class SandstormTest extends TestCaseputenv('SANDSTORM=1');$repository = $this->mock(UserRepositoryInterface::class);- $repository->shouldReceive('count')->once()->andReturn(1);+ $repository->shouldReceive('count')->twice()->andReturn(1);$response = $this->get('/_test/sandstorm');$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());@@ -123,9 +124,10 @@ class SandstormTest extends TestCaseputenv('SANDSTORM=1');$repository = $this->mock(UserRepositoryInterface::class);- $repository->shouldReceive('count')->once()->andReturn(0);+ $repository->shouldReceive('count')->twice()->andReturn(0);$repository->shouldReceive('store')->once()->andReturn($this->user());- $repository->shouldReceive('attachRole')->once()->andReturn(true);+ $repository->shouldReceive('attachRole')->twice()->andReturn(true);+ $repository->shouldReceive('getRole')->once()->andReturn(new Role);$response = $this->get('/_test/sandstorm', ['X-Sandstorm-User-Id' => 'abcd']);$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());@@ -152,7 +154,7 @@ class SandstormTest extends TestCaseputenv('SANDSTORM=1');$repository = $this->mock(UserRepositoryInterface::class);- $repository->shouldReceive('count')->once()->andReturn(1);+ $repository->shouldReceive('count')->twice()->andReturn(1);$repository->shouldReceive('first')->once()->andReturn($this->user());$response = $this->get('/_test/sandstorm', ['X-Sandstorm-User-Id' => 'abcd']);