diff --git a/app/controllers/GoogleTableController.php b/app/controllers/GoogleTableController.php index 52af4237e3..592aeb8ea9 100644 --- a/app/controllers/GoogleTableController.php +++ b/app/controllers/GoogleTableController.php @@ -100,11 +100,11 @@ class GoogleTableController extends BaseController $chart->addColumn('Name_URL', 'string'); $chart->addColumn('Name', 'string'); $chart->addColumn('Matches','string'); - $chart->addColumn('Min amount','number'); - $chart->addColumn('Max amount','number'); + $chart->addColumn('Minimum amount','number'); + $chart->addColumn('Maximum amount','number'); - /** @var \FireflyIII\Database\RecurringTransaction $repository */ - $repository = App::make('FireflyIII\Database\RecurringTransaction'); + /** @var \FireflyIII\Database\Recurring $repository */ + $repository = App::make('FireflyIII\Database\Recurring'); $set = $repository->get(); @@ -136,6 +136,75 @@ class GoogleTableController extends BaseController return Response::json($chart->getData()); } + public function transactionsByRecurring(RecurringTransaction $recurring) { + /** @var \Grumpydictator\Gchart\GChart $chart */ + $chart = App::make('gchart'); + $chart->addColumn('ID', 'number'); + $chart->addColumn('ID_Edit', 'string'); + $chart->addColumn('ID_Delete', 'string'); + $chart->addColumn('Date', 'date'); + $chart->addColumn('Description_URL', 'string'); + $chart->addColumn('Description', 'string'); + $chart->addColumn('Amount', 'number'); + $chart->addColumn('From_URL', 'string'); + $chart->addColumn('From', 'string'); + $chart->addColumn('To_URL', 'string'); + $chart->addColumn('To', 'string'); + $chart->addColumn('Budget_URL', 'string'); + $chart->addColumn('Budget', 'string'); + $chart->addColumn('Category_URL', 'string'); + $chart->addColumn('Category', 'string'); + + $journals = $recurring->transactionjournals()->get(); + + /** @var TransactionJournal $transaction */ + foreach ($journals as $journal) { + $date = $journal->date; + $descriptionURL = route('transactions.show', $journal->id); + $description = $journal->description; + /** @var Transaction $transaction */ + foreach ($journal->transactions as $transaction) { + if (floatval($transaction->amount) > 0) { + $amount = floatval($transaction->amount); + $to = $transaction->account->name; + $toURL = route('accounts.show', $transaction->account->id); + } else { + $from = $transaction->account->name; + $fromURL = route('accounts.show', $transaction->account->id); + } + + } + if (isset($journal->budgets[0])) { + $budgetURL = route('budgets.show', $journal->budgets[0]->id); + $component = $journal->budgets[0]->name; + } else { + $budgetURL = ''; + $component = ''; + } + + if (isset($journal->categories[0])) { + $categoryURL = route('categories.show', $journal->categories[0]->id); + $category = $journal->categories[0]->name; + } else { + $categoryURL = ''; + $category = ''; + } + + + $id = $journal->id; + $edit = route('transactions.edit', $journal->id); + $delete = route('transactions.delete', $journal->id); + $chart->addRow( + $id, $edit, $delete, $date, $descriptionURL, $description, $amount, $fromURL, $from, $toURL, $to, $budgetURL, $component, $categoryURL, + $category + ); + } + + $chart->generate(); + + return Response::json($chart->getData()); + } + /** * @param Account $account */ diff --git a/app/controllers/PiggybankController.php b/app/controllers/PiggybankController.php index c3e84a1f06..f0521704c2 100644 --- a/app/controllers/PiggybankController.php +++ b/app/controllers/PiggybankController.php @@ -1,7 +1,6 @@ with('recurringTransaction', $recurringTransaction)->with( - 'subTitle', 'Delete "' . $recurringTransaction->name . '"' - ); + 'subTitle', 'Delete "' . $recurringTransaction->name . '"' + ); } /** @@ -48,8 +47,8 @@ class RecurringController extends BaseController { //Event::fire('recurring.destroy', [$recurringTransaction]); - /** @var \FireflyIII\Database\RecurringTransaction $repository */ - $repository = App::make('FireflyIII\Database\RecurringTransaction'); + /** @var \FireflyIII\Database\Recurring $repository */ + $repository = App::make('FireflyIII\Database\Recurring'); $result = $repository->destroy($recurringTransaction); if ($result === true) { @@ -72,8 +71,8 @@ class RecurringController extends BaseController $periods = \Config::get('firefly.periods_to_text'); return View::make('recurring.edit')->with('periods', $periods)->with('recurringTransaction', $recurringTransaction)->with( - 'subTitle', 'Edit "' . $recurringTransaction->name . '"' - ); + 'subTitle', 'Edit "' . $recurringTransaction->name . '"' + ); } /** @@ -96,7 +95,11 @@ class RecurringController extends BaseController return Redirect::back(); } - throw new NotImplementedException; + + /** @var \FireflyIII\Database\Recurring $repos */ + $repos = App::make('FireflyIII\Database\Recurring'); + $repos->scanEverything($recurringTransaction); + Session::flash('success', 'Rescanned everything.'); return Redirect::back(); @@ -112,7 +115,7 @@ class RecurringController extends BaseController public function store() { - $data = Input::except('_token'); + $data = Input::except('_token'); /** @var \FireflyIII\Database\Recurring $repos */ $repos = App::make('FireflyIII\Database\Recurring'); @@ -155,6 +158,43 @@ class RecurringController extends BaseController public function update(RecurringTransaction $recurringTransaction) { - throw new NotImplementedException; + /** @var \FireflyIII\Database\Recurring $repos */ + $repos = App::make('FireflyIII\Database\Recurring'); + $data = Input::except('_token'); + + switch (Input::get('post_submit_action')) { + default: + throw new FireflyException('Cannot handle post_submit_action "' . e(Input::get('post_submit_action')) . '"'); + break; + case 'create_another': + case 'update': + $messages = $repos->validate($data); + /** @var MessageBag $messages ['errors'] */ + if ($messages['errors']->count() > 0) { + Session::flash('warnings', $messages['warnings']); + Session::flash('successes', $messages['successes']); + Session::flash('error', 'Could not save recurring transaction: ' . $messages['errors']->first()); + + return Redirect::route('recurring.edit', $recurringTransaction->id)->withInput()->withErrors($messages['errors']); + } + // store! + $repos->update($recurringTransaction, $data); + Session::flash('success', 'Recurring transaction updated!'); + + if ($data['post_submit_action'] == 'create_another') { + return Redirect::route('recurring.edit', $recurringTransaction->id); + } else { + return Redirect::route('recurring.index'); + } + case 'validate_only': + $messageBags = $repos->validate($data); + Session::flash('warnings', $messageBags['warnings']); + Session::flash('successes', $messageBags['successes']); + Session::flash('errors', $messageBags['errors']); + + return Redirect::route('recurring.edit', $recurringTransaction->id)->withInput(); + break; + } + } } \ No newline at end of file diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php index 2cf16b311c..c916a42e5e 100644 --- a/app/controllers/TransactionController.php +++ b/app/controllers/TransactionController.php @@ -309,60 +309,6 @@ class TransactionController extends BaseController return Redirect::route('transactions.create', $what)->withInput(); break; } - - - throw new NotImplementedException; - /* - * Collect data to process: - */ - $data = Input::except(['_token']); - $data['what'] = $what; - - switch (Input::get('post_submit_action')) { - case 'store': - case 'create_another': - /* - * Try to store: - */ - $messageBag = $this->_helper->store($data); - - /* - * Failure! - */ - if ($messageBag->count() > 0) { - Session::flash('error', 'Could not save transaction: ' . $messageBag->first()); - - return Redirect::route('transactions.create', [$what])->withInput()->withErrors($messageBag); - } - - /* - * Success! - */ - Session::flash('success', 'Transaction "' . e(Input::get('description')) . '" saved!'); - - /* - * Redirect to original location or back to the form. - */ - if (Input::get('post_submit_action') == 'create_another') { - return Redirect::route('transactions.create', $what)->withInput(); - } else { - return Redirect::route('transactions.index.' . $what); - } - - break; - case 'validate_only': - $messageBags = $this->_helper->validate($data); - - Session::flash('warnings', $messageBags['warnings']); - Session::flash('successes', $messageBags['successes']); - Session::flash('errors', $messageBags['errors']); - - return Redirect::route('transactions.create', [$what])->withInput(); - break; - default: - throw new FireflyException('Method ' . Input::get('post_submit_action') . ' not implemented yet.'); - break; - } } @@ -374,46 +320,46 @@ class TransactionController extends BaseController public function update(TransactionJournal $journal) { throw new NotImplementedException; - switch (Input::get('post_submit_action')) { - case 'update': - case 'return_to_edit': - $what = strtolower($journal->transactionType->type); - $messageBag = $this->_helper->update($journal, Input::all()); - if ($messageBag->count() == 0) { - // has been saved, return to index: - Session::flash('success', 'Transaction updated!'); - Event::fire('journals.update', [$journal]); - - if (Input::get('post_submit_action') == 'return_to_edit') { - return Redirect::route('transactions.edit', $journal->id)->withInput(); - } else { - return Redirect::route('transactions.index.' . $what); - } - } else { - Session::flash('error', 'Could not update transaction: ' . $journal->errors()->first()); - - return Redirect::route('transactions.edit', $journal->id)->withInput()->withErrors( - $journal->errors() - ); - } - - break; - case 'validate_only': - $data = Input::all(); - $data['what'] = strtolower($journal->transactionType->type); - $messageBags = $this->_helper->validate($data); - - Session::flash('warnings', $messageBags['warnings']); - Session::flash('successes', $messageBags['successes']); - Session::flash('errors', $messageBags['errors']); - - return Redirect::route('transactions.edit', $journal->id)->withInput(); - break; - default: - throw new FireflyException('Method ' . Input::get('post_submit_action') . ' not implemented yet.'); - break; - } - +// switch (Input::get('post_submit_action')) { +// case 'update': +// case 'return_to_edit': +// $what = strtolower($journal->transactionType->type); +// $messageBag = $this->_helper->update($journal, Input::all()); +// if ($messageBag->count() == 0) { +// // has been saved, return to index: +// Session::flash('success', 'Transaction updated!'); +// Event::fire('journals.update', [$journal]); +// +// if (Input::get('post_submit_action') == 'return_to_edit') { +// return Redirect::route('transactions.edit', $journal->id)->withInput(); +// } else { +// return Redirect::route('transactions.index.' . $what); +// } +// } else { +// Session::flash('error', 'Could not update transaction: ' . $journal->errors()->first()); +// +// return Redirect::route('transactions.edit', $journal->id)->withInput()->withErrors( +// $journal->errors() +// ); +// } +// +// break; +// case 'validate_only': +// $data = Input::all(); +// $data['what'] = strtolower($journal->transactionType->type); +// $messageBags = $this->_helper->validate($data); +// +// Session::flash('warnings', $messageBags['warnings']); +// Session::flash('successes', $messageBags['successes']); +// Session::flash('errors', $messageBags['errors']); +// +// return Redirect::route('transactions.edit', $journal->id)->withInput(); +// break; +// default: +// throw new FireflyException('Method ' . Input::get('post_submit_action') . ' not implemented yet.'); +// break; +// } +// } diff --git a/app/lib/FireflyIII/Database/Ifaces/RecurringInterface.php b/app/lib/FireflyIII/Database/Ifaces/RecurringInterface.php index 9f9184db52..b820b64776 100644 --- a/app/lib/FireflyIII/Database/Ifaces/RecurringInterface.php +++ b/app/lib/FireflyIII/Database/Ifaces/RecurringInterface.php @@ -20,4 +20,19 @@ interface RecurringInterface */ public function getJournalForRecurringInRange(\RecurringTransaction $recurring, Carbon $start, Carbon $end); + /** + * @param \RecurringTransaction $recurring + * + * @return bool + */ + public function scanEverything(\RecurringTransaction $recurring); + + /** + * @param \RecurringTransaction $recurring + * @param \TransactionJournal $journal + * + * @return bool + */ + public function scan(\RecurringTransaction $recurring,\TransactionJournal $journal); + } \ No newline at end of file diff --git a/app/lib/FireflyIII/Database/Recurring.php b/app/lib/FireflyIII/Database/Recurring.php index 704a13dd1e..7265f57f88 100644 --- a/app/lib/FireflyIII/Database/Recurring.php +++ b/app/lib/FireflyIII/Database/Recurring.php @@ -11,6 +11,7 @@ use FireflyIII\Exception\NotImplementedException; use Illuminate\Support\Collection; use Illuminate\Support\MessageBag; use LaravelBook\Ardent\Ardent; +use stdObject; /** * Class Recurring @@ -36,8 +37,9 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface */ public function destroy(Ardent $model) { - // TODO: Implement destroy() method. - throw new NotImplementedException; + $model->delete(); + + return true; } /** @@ -47,8 +49,38 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface */ public function store(array $data) { - // TODO: Implement store() method. - throw new NotImplementedException; + var_dump($data); + $recurring = new \RecurringTransaction; + $recurring->user()->associate($this->getUser()); + $recurring->name = $data['name']; + $recurring->match = $data['match']; + $recurring->amount_max = floatval($data['amount_max']); + $recurring->amount_min = floatval($data['amount_min']); + + $date = new Carbon($data['date']); + + + $recurring->active = isset($data['active']) && intval($data['active']) == 1 ? 1 : 0; + $recurring->automatch = isset($data['automatch']) && intval($data['automatch']) == 1 ? 1 : 0; + $recurring->repeat_freq = $data['repeat_freq']; + + /* + * Jump to the start of the period. + */ + /** @var \FireflyIII\Shared\Toolkit\Date $toolkit */ + $toolkit = \App::make('FireflyIII\Shared\Toolkit\Date'); + $date = $toolkit->startOfPeriod($date, $data['repeat_freq']); + $recurring->date = $date; + $recurring->skip = intval($data['skip']); + + if (!$recurring->validate()) { + var_dump($recurring->errors()); + exit(); + } + + $recurring->save(); + + return $recurring; } /** @@ -59,8 +91,29 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface */ public function update(Ardent $model, array $data) { - // TODO: Implement update() method. - throw new NotImplementedException; + var_dump($data); + + $model->name = $data['name']; + $model->match = $data['match']; + $model->amount_max = floatval($data['amount_max']); + $model->amount_min = floatval($data['amount_min']); + + $date = new Carbon($data['date']); + + $model->date = $date; + $model->active = isset($data['active']) && intval($data['active']) == 1 ? 1 : 0; + $model->automatch = isset($data['automatch']) && intval($data['automatch']) == 1 ? 1 : 0; + $model->repeat_freq = $data['repeat_freq']; + $model->skip = intval($data['skip']); + + if (!$model->validate()) { + var_dump($model->errors()); + exit(); + } + + $model->save(); + + return true; } /** @@ -94,7 +147,7 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface if (isset($model['amount_max']) && floatval($model['amount_max']) < 0.02) { $errors->add('amount_max', 'Maximum amount must be higher.'); } - if(isset($model['amount_min']) && isset($model['amount_max']) && floatval($model['amount_min']) > floatval($model['amount_max'])) { + if (isset($model['amount_min']) && isset($model['amount_max']) && floatval($model['amount_min']) > floatval($model['amount_max'])) { $errors->add('amount_max', 'Maximum amount can not be less than minimum amount.'); $errors->add('amount_min', 'Minimum amount can not be more than maximum amount.'); } @@ -116,10 +169,10 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface $errors->add('skip', 'Invalid skip.'); } - $set = ['name','match','amount_min','amount_max','date','repeat_freq','skip','automatch','active']; - foreach($set as $entry) { - if(!$errors->has($entry)) { - $successes->add($entry,'OK'); + $set = ['name', 'match', 'amount_min', 'amount_max', 'date', 'repeat_freq', 'skip', 'automatch', 'active']; + foreach ($set as $entry) { + if (!$errors->has($entry)) { + $successes->add($entry, 'OK'); } } @@ -199,4 +252,111 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface return $this->getUser()->transactionjournals()->where('recurring_transaction_id', $recurring->id)->after($start)->before($end)->first(); } + + /** + * @param \RecurringTransaction $recurring + * @param \TransactionJournal $journal + * + * @return bool + */ + public function scan(\RecurringTransaction $recurring, \TransactionJournal $journal) + { + /* + * Match words. + */ + $wordMatch = false; + $matches = explode(',', $recurring->match); + $description = strtolower($journal->description); + + /* + * Attach expense account to description for more narrow matching. + */ + if (count($journal->transactions) < 2) { + $transactions = $journal->transactions()->get(); + } else { + $transactions = $journal->transactions; + } + /** @var \Transaction $transaction */ + foreach ($transactions as $transaction) { + /** @var \Account $account */ + $account = $transaction->account()->first(); + /** @var \AccountType $type */ + $type = $account->accountType()->first(); + if ($type->type == 'Expense account' || $type->type == 'Beneficiary account') { + $description .= ' ' . strtolower($account->name); + } + } + \Log::debug('Final description: ' . $description); + \Log::debug('Matches searched: ' . join(':', $matches)); + + $count = 0; + foreach ($matches as $word) { + if (!(strpos($description, strtolower($word)) === false)) { + $count++; + } + } + if ($count >= count($matches)) { + $wordMatch = true; + \Log::debug('word match is true'); + } + + + /* + * Match amount. + */ + + $amountMatch = false; + if (count($transactions) > 1) { + + $amount = max(floatval($transactions[0]->amount), floatval($transactions[1]->amount)); + $min = floatval($recurring->amount_min); + $max = floatval($recurring->amount_max); + if ($amount >= $min && $amount <= $max) { + $amountMatch = true; + \Log::debug('Amount match is true!'); + } + } + + /* + * If both, update! + */ + if ($wordMatch && $amountMatch) { + $journal->recurringTransaction()->associate($recurring); + $journal->save(); + } + } + + /** + * @param \RecurringTransaction $recurring + * + * @return bool + * @throws NotImplementedException + */ + public function scanEverything(\RecurringTransaction $recurring) + { + // get all journals that (may) be relevant. + // this is usually almost all of them. + + /** @var \FireflyIII\Database\TransactionJournal $journalRepository */ + $journalRepository = \App::make('FireflyIII\Database\TransactionJournal'); + + $set = \DB::table('transactions')->where('amount', '>', 0)->where('amount', '>=', $recurring->amount_min)->where( + 'amount', '<=', $recurring->amount_max + )->get(['transaction_journal_id']); + $ids = []; + + /** @var \Transaction $entry */ + foreach ($set as $entry) { + $ids[] = intval($entry->transaction_journal_id); + } + if (count($ids) > 0) { + $journals = $journalRepository->getByIds($ids); + /** @var \TransactionJournal $journal */ + foreach ($journals as $journal) { + $this->scan($recurring, $journal); + } + } + + return true; + } } \ No newline at end of file diff --git a/app/lib/FireflyIII/Database/TransactionJournal.php b/app/lib/FireflyIII/Database/TransactionJournal.php index 0c2430ae62..5e5420b93b 100644 --- a/app/lib/FireflyIII/Database/TransactionJournal.php +++ b/app/lib/FireflyIII/Database/TransactionJournal.php @@ -355,8 +355,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData */ public function getByIds(array $ids) { - // TODO: Implement getByIds() method. - throw new NotImplementedException; + return $this->getUser()->transactionjournals()->with('transactions')->whereIn('id', $ids)->orderBy('date', 'ASC')->get(); } /** @@ -390,9 +389,10 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData $end->endOfMonth(); $sum = \DB::table('transactions')->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')->leftJoin( - 'transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id' - )->where('amount', '>', 0)->where('transaction_types.type', '=', 'Withdrawal')->where('transaction_journals.date', '>=', $date->format('Y-m-d')) - ->where('transaction_journals.date', '<=', $end->format('Y-m-d'))->sum('transactions.amount'); + 'transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id' + )->where('amount', '>', 0)->where('transaction_types.type', '=', 'Withdrawal')->where('transaction_journals.date', '>=', $date->format('Y-m-d'))->where( + 'transaction_journals.date', '<=', $end->format('Y-m-d') + )->sum('transactions.amount'); $sum = floatval($sum); return $sum; @@ -410,9 +410,10 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData $end->endOfMonth(); $sum = \DB::table('transactions')->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')->leftJoin( - 'transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id' - )->where('amount', '>', 0)->where('transaction_types.type', '=', 'Deposit')->where('transaction_journals.date', '>=', $date->format('Y-m-d')) - ->where('transaction_journals.date', '<=', $end->format('Y-m-d'))->sum('transactions.amount'); + 'transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id' + )->where('amount', '>', 0)->where('transaction_types.type', '=', 'Deposit')->where('transaction_journals.date', '>=', $date->format('Y-m-d'))->where( + 'transaction_journals.date', '<=', $end->format('Y-m-d') + )->sum('transactions.amount'); $sum = floatval($sum); return $sum; @@ -441,12 +442,12 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData $accountID = $account->id; $query = $this->_user->transactionjournals()->with(['transactions', 'transactioncurrency', 'transactiontype'])->leftJoin( - 'transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id' - )->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')->where('accounts.id', $accountID)->where( - 'date', '>=', $start->format('Y-m-d') - )->where('date', '<=', $end->format('Y-m-d'))->orderBy('transaction_journals.date', 'DESC')->orderBy('transaction_journals.id', 'DESC')->take( - $count - )->get(['transaction_journals.*']); + 'transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id' + )->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')->where('accounts.id', $accountID)->where( + 'date', '>=', $start->format('Y-m-d') + )->where('date', '<=', $end->format('Y-m-d'))->orderBy('transaction_journals.date', 'DESC')->orderBy('transaction_journals.id', 'DESC')->take( + $count + )->get(['transaction_journals.*']); return $query; } diff --git a/app/lib/FireflyIII/Shared/Toolkit/Date.php b/app/lib/FireflyIII/Shared/Toolkit/Date.php index 845381346e..352685dfca 100644 --- a/app/lib/FireflyIII/Shared/Toolkit/Date.php +++ b/app/lib/FireflyIII/Shared/Toolkit/Date.php @@ -3,7 +3,7 @@ namespace FireflyIII\Shared\Toolkit; use Carbon\Carbon; -use Firefly\Exception\FireflyException; +use FireflyIII\Exception\FireflyException; /** * Class Date @@ -84,4 +84,44 @@ class Date break; } } + + /** + * @param Carbon $date + * @param $repeatFreq + * + * @return Carbon + * @throws FireflyException + */ + public function startOfPeriod(Carbon $date, $repeatFreq) + { + switch ($repeatFreq) { + default: + throw new FireflyException('Cannot do startOfPeriod for $repeat_freq ' . $repeatFreq); + break; + case 'daily': + $date->startOfDay(); + break; + case 'weekly': + $date->startOfWeek(); + break; + case 'monthly': + $date->startOfMonth(); + break; + case 'quarterly': + $date->firstOfQuarter(); + break; + case 'half-year': + $month = intval($date->format('m')); + $date->startOfYear(); + if ($month >= 7) { + $date->addMonths(6); + } + break; + case 'yearly': + $date->startOfYear(); + break; + } + + return $date; + } } \ No newline at end of file diff --git a/app/models/RecurringTransaction.php b/app/models/RecurringTransaction.php index c2c45a8ac2..556535baec 100644 --- a/app/models/RecurringTransaction.php +++ b/app/models/RecurringTransaction.php @@ -91,6 +91,14 @@ class RecurringTransaction extends Ardent return $start; } + /** + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function transactionjournals() + { + return $this->hasMany('TransactionJournal'); + } + /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ diff --git a/app/views/recurring/delete.blade.php b/app/views/recurring/delete.blade.php index 44fa177b1a..c8ab0e5381 100644 --- a/app/views/recurring/delete.blade.php +++ b/app/views/recurring/delete.blade.php @@ -1,29 +1,31 @@ @extends('layouts.default') @section('content') -
- Remember that deleting something is permanent. -
-- Press "Delete permanently" If you are sure you want to delete "{{{$recurringTransaction->name}}}". -
-+ Are you sure? +
++ + Cancel +
+Date | -Description | -Amount (€) | -From | -To | -Budget / category | -ID | -
---|