Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Some intermittent changes to storing journals.
James Cole166cdad58b4b
diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.phpindex 68c96bcc21..6b99629437 100644--- a/app/Http/Controllers/Transaction/SingleController.php+++ b/app/Http/Controllers/Transaction/SingleController.php@@ -337,35 +337,16 @@ class SingleController extends Controller*/public function store(JournalFormRequest $request, JournalRepositoryInterface $repository){- $doSplit = 1 === intval($request->get('split_journal'));- $createAnother = 1 === intval($request->get('create_another'));- $data = $request->getJournalData();- $data['user'] = auth()->user()->id;- $data['bill_id'] = null;- $data['bill_name'] = null;- $data['piggy_bank_name'] = null;- $data['transactions'] = [- [- 'amount' => $data['amount'],- 'currency_id' => $data['currency_id'],- 'description' => null,- 'reconciled' => false,- 'identifier' => 0,- 'currency_code' => null,- 'budget_id' => $data['budget_id'],- 'budget_name' => null,- 'category_id' => null,- 'category_name' => $data['category'],- 'source_id' => (int)$data['source_account_id'],- 'source_name' => $data['source_account_name'],- 'destination_id' => (int)$data['destination_account_id'],- 'destination_name' => $data['destination_account_name'],- 'foreign_currency_id' => null,- 'foreign_currency_code' => null,- 'foreign_amount' => null,- ],- ];- $journal = $repository->store($data);+ $doSplit = 1 === intval($request->get('split_journal'));+ $createAnother = 1 === intval($request->get('create_another'));+ $data = $request->getJournalData();+++ var_dump($data);exit;++ $journal = $repository->store($data);++if (null === $journal->id) {// error!Log::error('Could not store transaction journal: ', $journal->getErrors()->toArray());diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.phpindex 8a3651bb07..aec907fb6a 100644--- a/app/Http/Requests/JournalFormRequest.php+++ b/app/Http/Requests/JournalFormRequest.php@@ -46,10 +46,12 @@ class JournalFormRequest extends Request*/public function getJournalData(){+ var_dump($this->all());$data = ['type' => $this->get('what'), // type. can be 'deposit', 'withdrawal' or 'transfer''date' => $this->date('date'),'tags' => explode(',', $this->string('tags')),+ 'user' => auth()->user()->id,// all custom fields:@@ -65,15 +67,16 @@ class JournalFormRequest extends Request// journal data:'description' => $this->string('description'),'piggy_bank_id' => $this->integer('piggy_bank_id'),+ 'piggy_bank_name' => null,'bill_id' => null,'bill_name' => null,// native amount and stuff like that:- 'currency_id' => $this->integer('amount_currency_id_amount'),- 'amount' => $this->string('amount'),- 'native_amount' => $this->string('native_amount'),- 'source_amount' => $this->string('source_amount'),- 'destination_amount' => $this->string('destination_amount'),+ //'currency_id' => $this->integer('amount_currency_id_amount'),+ //'amount' => $this->string('amount'),+ //'native_amount' => $this->string('native_amount'),+ //'source_amount' => $this->string('source_amount'),+ //'destination_amount' => $this->string('destination_amount'),// transaction data:'transactions' => [@@ -98,6 +101,18 @@ class JournalFormRequest extends Request],],];+ switch ($data['type']) {+ case 'withdrawal':+ $data['transactions'][0]['currency_id'] = $this->integer('source_currency_id');+ break;+ case 'deposit':+ $data['transactions'][0]['currency_id'] = $this->integer('destination_currency_id');+ break;+ case 'transfer':+ $data['transactions'][0]['currency_id'] = $this->integer('destination_currency_id');+ break;++ }return $data;}