diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php index 19ccf48434..f5948f4785 100644 --- a/app/Http/Controllers/CurrencyController.php +++ b/app/Http/Controllers/CurrencyController.php @@ -60,14 +60,14 @@ class CurrencyController extends Controller $subTitle = trans('firefly.create_currency'); // put previous url in session if not redirect from store (not "create another"). - if (session('currency.create.fromStore') !== true) { - Session::put('currency.create.url', URL::previous()); + if (session('currencies.create.fromStore') !== true) { + Session::put('currencies.create.url', URL::previous()); } - Session::forget('currency.create.fromStore'); + Session::forget('currencies.create.fromStore'); Session::flash('gaEventCategory', 'currency'); Session::flash('gaEventAction', 'create'); - return view('currency.create', compact('subTitleIcon', 'subTitle')); + return view('currencies.create', compact('subTitleIcon', 'subTitle')); } /** @@ -85,7 +85,7 @@ class CurrencyController extends Controller Cache::forget('FFCURRENCYSYMBOL'); Cache::forget('FFCURRENCYCODE'); - return redirect(route('currency.index')); + return redirect(route('currencies.index')); } @@ -99,18 +99,18 @@ class CurrencyController extends Controller if (!$this->canDeleteCurrency($currency)) { Session::flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name])); - return redirect(route('currency.index')); + return redirect(route('currencies.index')); } // put previous url in session - Session::put('currency.delete.url', URL::previous()); + Session::put('currencies.delete.url', URL::previous()); Session::flash('gaEventCategory', 'currency'); Session::flash('gaEventAction', 'delete'); $subTitle = trans('form.delete_currency', ['name' => $currency->name]); - return view('currency.delete', compact('currency', 'subTitle')); + return view('currencies.delete', compact('currency', 'subTitle')); } /** @@ -124,7 +124,7 @@ class CurrencyController extends Controller if (!$this->canDeleteCurrency($currency)) { Session::flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name])); - return redirect(route('currency.index')); + return redirect(route('currencies.index')); } Session::flash('success', trans('firefly.deleted_currency', ['name' => $currency->name])); @@ -132,7 +132,7 @@ class CurrencyController extends Controller $currency->forceDelete(); } - return redirect(session('currency.delete.url')); + return redirect(session('currencies.delete.url')); } /** @@ -147,14 +147,14 @@ class CurrencyController extends Controller $currency->symbol = htmlentities($currency->symbol); // put previous url in session if not redirect from store (not "return_to_edit"). - if (session('currency.edit.fromUpdate') !== true) { - Session::put('currency.edit.url', URL::previous()); + if (session('currencies.edit.fromUpdate') !== true) { + Session::put('currencies.edit.url', URL::previous()); } - Session::forget('currency.edit.fromUpdate'); + Session::forget('currencies.edit.fromUpdate'); Session::flash('gaEventCategory', 'currency'); Session::flash('gaEventAction', 'edit'); - return view('currency.edit', compact('currency', 'subTitle', 'subTitleIcon')); + return view('currencies.edit', compact('currency', 'subTitle', 'subTitleIcon')); } @@ -174,7 +174,7 @@ class CurrencyController extends Controller } - return view('currency.index', compact('currencies', 'defaultCurrency')); + return view('currencies.index', compact('currencies', 'defaultCurrency')); } /** @@ -189,7 +189,7 @@ class CurrencyController extends Controller if (!auth()->user()->hasRole('owner')) { Log::error('User ' . auth()->user()->id . ' is not admin, but tried to store a currency.'); - return redirect(session('currency.create.url')); + return redirect(session('currencies.create.url')); } $data = $request->getCurrencyData(); @@ -197,13 +197,13 @@ class CurrencyController extends Controller Session::flash('success', trans('firefly.created_currency', ['name' => $currency->name])); if (intval(Input::get('create_another')) === 1) { - Session::put('currency.create.fromStore', true); + Session::put('currencies.create.fromStore', true); - return redirect(route('currency.create'))->withInput(); + return redirect(route('currencies.create'))->withInput(); } // redirect to previous URL. - return redirect(session('currency.create.url')); + return redirect(session('currencies.create.url')); } @@ -226,13 +226,13 @@ class CurrencyController extends Controller if (intval(Input::get('return_to_edit')) === 1) { - Session::put('currency.edit.fromUpdate', true); + Session::put('currencies.edit.fromUpdate', true); - return redirect(route('currency.edit', [$currency->id])); + return redirect(route('currencies.edit', [$currency->id])); } // redirect to previous URL. - return redirect(session('currency.edit.url')); + return redirect(session('currencies.edit.url')); } diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php index a7883f2a4a..38c40f3f40 100644 --- a/app/Http/Controllers/Transaction/SplitController.php +++ b/app/Http/Controllers/Transaction/SplitController.php @@ -135,20 +135,7 @@ class SplitController extends Controller return $this->redirectToAccount($journal); } - $data = $this->arrayFromInput($request); - - // need to do some validation! - // sum of amount must be > 0 - $sum = '0'; - foreach ($data['transactions'] as $transaction) { - Session::flash('error',strval(trans('validation.amount_zero'))); - $sum = bcadd($sum, strval($transaction['amount'])); - } - if (bccomp($sum, '0') === 0) { - return redirect(route('transactions.edit-split', [$journal->id]))->withInput(); - } - - + $data = $this->arrayFromInput($request); $journal = $repository->updateSplitJournal($journal, $data); // save attachments: diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php index 925c0cac99..879fb077e7 100644 --- a/app/Http/breadcrumbs.php +++ b/app/Http/breadcrumbs.php @@ -327,29 +327,29 @@ Breadcrumbs::register( * CURRENCIES */ Breadcrumbs::register( - 'currency.index', function (BreadCrumbGenerator $breadcrumbs) { + 'currencies.index', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('home'); - $breadcrumbs->push(trans('firefly.currencies'), route('currency.index')); + $breadcrumbs->push(trans('firefly.currencies'), route('currencies.index')); } ); Breadcrumbs::register( - 'currency.create', function (BreadCrumbGenerator $breadcrumbs) { - $breadcrumbs->parent('currency.index'); - $breadcrumbs->push(trans('firefly.create_currency'), route('currency.create')); + 'currencies.create', function (BreadCrumbGenerator $breadcrumbs) { + $breadcrumbs->parent('currencies.index'); + $breadcrumbs->push(trans('firefly.create_currency'), route('currencies.create')); } ); Breadcrumbs::register( - 'currency.edit', function (BreadCrumbGenerator $breadcrumbs, TransactionCurrency $currency) { - $breadcrumbs->parent('currency.index'); - $breadcrumbs->push(trans('breadcrumbs.edit_currency', ['name' => e($currency->name)]), route('currency.edit', [$currency->id])); + 'currencies.edit', function (BreadCrumbGenerator $breadcrumbs, TransactionCurrency $currency) { + $breadcrumbs->parent('currencies.index'); + $breadcrumbs->push(trans('breadcrumbs.edit_currency', ['name' => e($currency->name)]), route('currencies.edit', [$currency->id])); } ); Breadcrumbs::register( - 'currency.delete', function (BreadCrumbGenerator $breadcrumbs, TransactionCurrency $currency) { - $breadcrumbs->parent('currency.index'); - $breadcrumbs->push(trans('breadcrumbs.delete_currency', ['name' => e($currency->name)]), route('currency.delete', [$currency->id])); + 'currencies.delete', function (BreadCrumbGenerator $breadcrumbs, TransactionCurrency $currency) { + $breadcrumbs->parent('currencies.index'); + $breadcrumbs->push(trans('breadcrumbs.delete_currency', ['name' => e($currency->name)]), route('currencies.delete', [$currency->id])); } ); diff --git a/resources/views/currency/create.twig b/resources/views/currencies/create.twig similarity index 92% rename from resources/views/currency/create.twig rename to resources/views/currencies/create.twig index 26dec5a0b1..8192a47171 100644 --- a/resources/views/currency/create.twig +++ b/resources/views/currencies/create.twig @@ -5,7 +5,7 @@ {% endblock %} {% block content %} -