Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fixes #401
James Cole32b5a84a0c12
diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.phpindex f32e8df053..54e886abab 100644--- a/app/Http/Controllers/Transaction/MassController.php+++ b/app/Http/Controllers/Transaction/MassController.php@@ -196,35 +196,33 @@ class MassController extends Controller$journal = $repository->find(intval($journalId));if ($journal) {// get optional fields:- $what = strtolower(TransactionJournal::transactionTypeStr($journal));-+ $what = strtolower(TransactionJournal::transactionTypeStr($journal));$sourceAccountId = $request->get('source_account_id')[$journal->id] ?? 0;$sourceAccountName = $request->get('source_account_name')[$journal->id] ?? '';$destAccountId = $request->get('destination_account_id')[$journal->id] ?? 0;$destAccountName = $request->get('destination_account_name')[$journal->id] ?? '';-- $budgetId = $journal->budgets->first() ? $journal->budgets->first()->id : 0;- $category = $request->get('category')[$journal->id];- $tags = $journal->tags->pluck('tag')->toArray();+ $budgetId = $journal->budgets->first() ? $journal->budgets->first()->id : 0;+ $category = $request->get('category')[$journal->id];+ $tags = $journal->tags->pluck('tag')->toArray();// build data array$data = [- 'id' => $journal->id,- 'what' => $what,- 'description' => $request->get('description')[$journal->id],- 'source_account_id' => intval($sourceAccountId),- 'source_account_name' => $sourceAccountName,- 'destination_account_id' => intval($destAccountId),- 'destination_account_name' => $destAccountName,- 'amount' => round($request->get('amount')[$journal->id], 4),- 'amount_currency_id_amount' => intval($request->get('amount_currency_id_amount_' . $journal->id)),- 'date' => new Carbon($request->get('date')[$journal->id]),- 'interest_date' => $journal->interest_date,- 'book_date' => $journal->book_date,- 'process_date' => $journal->process_date,- 'budget_id' => $budgetId,- 'category' => $category,- 'tags' => $tags,+ 'id' => $journal->id,+ 'what' => $what,+ 'description' => $request->get('description')[$journal->id],+ 'source_account_id' => intval($sourceAccountId),+ 'source_account_name' => $sourceAccountName,+ 'destination_account_id' => intval($destAccountId),+ 'destination_account_name' => $destAccountName,+ 'amount' => round($request->get('amount')[$journal->id], 4),+ 'currency_id' => intval($request->get('amount_currency_id_amount_' . $journal->id)),+ 'date' => new Carbon($request->get('date')[$journal->id]),+ 'interest_date' => $journal->interest_date,+ 'book_date' => $journal->book_date,+ 'process_date' => $journal->process_date,+ 'budget_id' => $budgetId,+ 'category' => $category,+ 'tags' => $tags,];// call repository update function.diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.phpindex 6b3e476b50..0e8c73942d 100644--- a/app/Repositories/Journal/JournalRepository.php+++ b/app/Repositories/Journal/JournalRepository.php@@ -397,6 +397,7 @@ class JournalRepository implements JournalRepositoryInterfaceif (strlen(trim($name)) > 0) {$tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]);if (!is_null($tag)) {+ Log::debug(sprintf('Will try to connect tag #%d to journal #%d.', $tag->id, $journal->id));$tagRepository->connect($journal, $tag);}}@@ -733,6 +734,7 @@ class JournalRepository implements JournalRepositoryInterface// connect each tag to journal (if not yet connected):/** @var Tag $tag */foreach ($tags as $tag) {+ Log::debug(sprintf('Will try to connect tag #%d to journal #%d.', $tag->id, $journal->id));$tagRepository->connect($journal, $tag);}diff --git a/resources/views/transactions/mass-delete.twig b/resources/views/transactions/mass-delete.twigindex 0cc411b8d0..6eec80dec5 100644--- a/resources/views/transactions/mass-delete.twig+++ b/resources/views/transactions/mass-delete.twig@@ -49,18 +49,10 @@{{ journal.date.formatLocalized(monthAndDayFormat) }}</td><td>- {% if journal.source_account_type == 'Cash account' %}- <span class="text-success">(cash)</span>- {% else %}- <a href="{{ route('accounts.show',journal.source_account_id) }}">{{ journal.source_account_name }}</a>- {% endif %}+ {{ sourceAccount(journal)|raw }}</td><td>- {% if journal.destination_account_type == 'Cash account' %}- <span class="text-success">(cash)</span>- {% else %}- <a href="{{ route('accounts.show',journal.destination_account_id) }}">{{ journal.destination_account_name }}</a>- {% endif %}+ {{ destinationAccount(journal)|raw }}</td></tr>{% endfor %}diff --git a/resources/views/transactions/mass-edit.twig b/resources/views/transactions/mass-edit.twigindex b42592d13a..6489998547 100644--- a/resources/views/transactions/mass-edit.twig+++ b/resources/views/transactions/mass-edit.twig@@ -90,7 +90,7 @@</div><div class="box-footer">{% if journals.count > 0 %}- <input type="submit" name="submit" value="{{ trans('form.update_all_journals') }}" class="btn btn-danger pull-right"/>+ <input type="submit" name="submit" value="{{ trans('form.update_all_journals') }}" class="btn btn-success pull-right"/>{% endif %}<a href="{{ route('index') }}" class="btn-default btn">{{ trans('form.cancel') }}</a>