Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Small fixes for import routine.
James Coled1b2e63950e5
diff --git a/app/Http/Controllers/Import/JobStatusController.php b/app/Http/Controllers/Import/JobStatusController.phpindex 0fbe1884c9..d512e82196 100644--- a/app/Http/Controllers/Import/JobStatusController.php+++ b/app/Http/Controllers/Import/JobStatusController.php@@ -105,11 +105,14 @@ class JobStatusController extends Controller$json['report_txt'] = trans('import.result_no_transactions');}if ($count === 1 && null !== $importJob->tag_id) {- $json['report_txt'] = trans('import.result_one_transaction', ['route' => route('tags.show', [$importJob->tag_id]), 'tag' => $importJob->tag->tag]);+ $json['report_txt'] = trans(+ 'import.result_one_transaction', ['route' => route('tags.show', [$importJob->tag_id, 'all']), 'tag' => $importJob->tag->tag]+ );}if ($count > 1 && null !== $importJob->tag_id) {$json['report_txt'] = trans(- 'import.result_many_transactions', ['count' => $count, 'route' => route('tags.show', [$importJob->tag_id]), 'tag' => $importJob->tag->tag]+ 'import.result_many_transactions',+ ['count' => $count, 'route' => route('tags.show', [$importJob->tag_id, 'all']), 'tag' => $importJob->tag->tag]);}diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.phpindex 294d364014..96dbe6d289 100644--- a/app/Http/Controllers/TagController.php+++ b/app/Http/Controllers/TagController.php@@ -36,14 +36,6 @@ use View;/*** Class TagController.- *- * Remember: a balancingAct takes at most one expense and one transfer.- * an advancePayment takes at most one expense, infinite deposits and NO transfers.- *- * transaction can only have one advancePayment OR balancingAct.- * Other attempts to put in such a tag are blocked.- * also show an error when editing a tag and it becomes either- * of these two types. Or rather, block editing of the tag.*/class TagController extends Controller{@@ -79,7 +71,6 @@ class TagController extends Controller{$subTitle = trans('firefly.new_tag');$subTitleIcon = 'fa-tag';- $apiKey = env('GOOGLE_MAPS_API_KEY', '');// put previous url in session if not redirect from store (not "create another").if (true !== session('tags.create.fromStore')) {@@ -87,7 +78,7 @@ class TagController extends Controller}session()->forget('tags.create.fromStore');- return view('tags.create', compact('subTitle', 'subTitleIcon', 'apiKey'));+ return view('tags.create', compact('subTitle', 'subTitleIcon'));}/**@@ -134,7 +125,6 @@ class TagController extends Controller{$subTitle = trans('firefly.edit_tag', ['tag' => $tag->tag]);$subTitleIcon = 'fa-tag';- $apiKey = env('GOOGLE_MAPS_API_KEY', '');// put previous url in session if not redirect from store (not "return_to_edit").if (true !== session('tags.edit.fromUpdate')) {@@ -142,7 +132,7 @@ class TagController extends Controller}session()->forget('tags.edit.fromUpdate');- return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'apiKey'));+ return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon'));}/**@@ -201,7 +191,6 @@ class TagController extends Controller$start = null;$end = null;$periods = new Collection;- $apiKey = env('GOOGLE_MAPS_API_KEY', '');$path = route('tags.show', [$tag->id]);// prep for "all" view.@@ -310,7 +299,8 @@ class TagController extends Controller// get first and last tag date from tag:$range = Preferences::get('viewRange', '1M')->data;$start = app('navigation')->startOfPeriod($this->repository->firstUseDate($tag), $range);- $end = app('navigation')->startOfPeriod($this->repository->lastUseDate($tag), $range);+ $end = app('navigation')->endOfPeriod($this->repository->lastUseDate($tag), $range);+// properties for entries with their amounts.$cache = new CacheProperties;$cache->addProperty($start);diff --git a/app/Import/Storage/ImportArrayStorage.php b/app/Import/Storage/ImportArrayStorage.phpindex 3cb5ccfebd..6db0712dd7 100644--- a/app/Import/Storage/ImportArrayStorage.php+++ b/app/Import/Storage/ImportArrayStorage.php@@ -144,15 +144,19 @@ class ImportArrayStorage*/private function countTransfers(): void{+ Log::debug('Now in count transfers.');/** @var array $array */$array = $this->importJob->transactions;$count = 0;- foreach ($array as $transaction) {+ foreach ($array as $index => $transaction) {if (strtolower(TransactionType::TRANSFER) === $transaction['type']) {$count++;+ Log::debug(sprintf('Row #%d is a transfer, increase count to %d', ($index + 1), $count));}}+ Log::debug('Count is zero.');if ($count > 0) {+ Log::debug(sprintf('Count is %d', $count));$this->checkForTransfers = true;// get users transfers. Needed for comparison.@@ -199,6 +203,7 @@ class ImportArrayStorage*/private function getTransfers(): void{+ app('preferences')->mark();/** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);$collector->setUser($this->importJob->user);@@ -408,7 +413,8 @@ class ImportArrayStorage$requiredHits = count($transaction['transactions']) * 4;$totalHits = 0;Log::debug(sprintf('Required hits for transfer comparison is %d', $requiredHits));-+ Log::debug(sprintf('Array has %d transactions.', \count($transaction['transactions'])));+ Log::debug(sprintf('System has %d existing transfers', \count($this->transfers)));// loop over each split:foreach ($transaction['transactions'] as $current) {diff --git a/app/Models/Rule.php b/app/Models/Rule.phpindex ed2d1161bb..ac3cc0e992 100644--- a/app/Models/Rule.php+++ b/app/Models/Rule.php@@ -32,6 +32,8 @@ use FireflyIII\Models\RuleAction;/*** Class Rule.+ * @property bool $stop_processing+ * @property int $id*/class Rule extends Model{diff --git a/app/Models/Tag.php b/app/Models/Tag.phpindex 4a5f176e73..cb7861d845 100644--- a/app/Models/Tag.php+++ b/app/Models/Tag.php@@ -33,6 +33,8 @@ use FireflyIII\Models\TransactionJournal;/*** Class Tag.* @property Collection $transactionJournals+ * @property string $tag+ * @property int $id*/class Tag extends Model{