diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php index b5573c83a4..06fc158fcc 100644 --- a/app/Http/Controllers/Account/ReconcileController.php +++ b/app/Http/Controllers/Account/ReconcileController.php @@ -90,8 +90,6 @@ class ReconcileController extends Controller ]; Session::flash('preFilled', $preFilled); - Session::flash('gaEventCategory', 'transactions'); - Session::flash('gaEventAction', 'edit-reconciliation'); // put previous url in session if not redirect from store (not "return_to_edit"). if (true !== session('reconcile.edit.fromUpdate')) { diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index e8dd4be714..aa85f922c2 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -96,8 +96,6 @@ class AccountController extends Controller $this->rememberPreviousUri('accounts.create.uri'); } $request->session()->forget('accounts.create.fromStore'); - $request->session()->flash('gaEventCategory', 'accounts'); - $request->session()->flash('gaEventAction', 'create-' . $what); return view('accounts.create', compact('subTitleIcon', 'what', 'subTitle', 'currencySelectList', 'allCurrencies', 'roles')); } @@ -118,8 +116,6 @@ class AccountController extends Controller // put previous url in session $this->rememberPreviousUri('accounts.delete.uri'); - $request->session()->flash('gaEventCategory', 'accounts'); - $request->session()->flash('gaEventAction', 'delete-' . $typeName); return view('accounts.delete', compact('account', 'subTitle', 'accountList')); } @@ -198,8 +194,6 @@ class AccountController extends Controller 'currency_id' => $currency->id, ]; $request->session()->flash('preFilled', $preFilled); - $request->session()->flash('gaEventCategory', 'accounts'); - $request->session()->flash('gaEventAction', 'edit-' . $what); return view( 'accounts.edit', diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index b2ef0b7875..dc156b49e4 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -70,8 +70,6 @@ class AttachmentController extends Controller // put previous url in session $this->rememberPreviousUri('attachments.delete.uri'); - $request->session()->flash('gaEventCategory', 'attachments'); - $request->session()->flash('gaEventAction', 'delete-attachment'); return view('attachments.delete', compact('attachment', 'subTitle')); } diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index 7aa321d9a8..a433b292ac 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -85,8 +85,6 @@ class BillController extends Controller $this->rememberPreviousUri('bills.create.uri'); } $request->session()->forget('bills.create.fromStore'); - $request->session()->flash('gaEventCategory', 'bills'); - $request->session()->flash('gaEventAction', 'create'); return view('bills.create', compact('periods', 'subTitle')); } @@ -101,8 +99,6 @@ class BillController extends Controller { // put previous url in session $this->rememberPreviousUri('bills.delete.uri'); - $request->session()->flash('gaEventCategory', 'bills'); - $request->session()->flash('gaEventAction', 'delete'); $subTitle = trans('firefly.delete_bill', ['name' => $bill->name]); return view('bills.delete', compact('bill', 'subTitle')); @@ -162,8 +158,6 @@ class BillController extends Controller $request->session()->flash('preFilled', $preFilled); $request->session()->forget('bills.edit.fromUpdate'); - $request->session()->flash('gaEventCategory', 'bills'); - $request->session()->flash('gaEventAction', 'edit'); return view('bills.edit', compact('subTitle', 'periods', 'bill')); } diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index 0350973a73..f7bce98240 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -111,8 +111,6 @@ class BudgetController extends Controller $this->rememberPreviousUri('budgets.create.uri'); } $request->session()->forget('budgets.create.fromStore'); - $request->session()->flash('gaEventCategory', 'budgets'); - $request->session()->flash('gaEventAction', 'create'); $subTitle = (string)trans('firefly.create_new_budget'); return view('budgets.create', compact('subTitle')); @@ -130,8 +128,6 @@ class BudgetController extends Controller // put previous url in session $this->rememberPreviousUri('budgets.delete.uri'); - $request->session()->flash('gaEventCategory', 'budgets'); - $request->session()->flash('gaEventAction', 'delete'); return view('budgets.delete', compact('budget', 'subTitle')); } @@ -167,8 +163,6 @@ class BudgetController extends Controller $this->rememberPreviousUri('budgets.edit.uri'); } $request->session()->forget('budgets.edit.fromUpdate'); - $request->session()->flash('gaEventCategory', 'budgets'); - $request->session()->flash('gaEventAction', 'edit'); return view('budgets.edit', compact('budget', 'subTitle')); } diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 4c0a759a07..1773902ee8 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -74,8 +74,6 @@ class CategoryController extends Controller $this->rememberPreviousUri('categories.create.uri'); } $request->session()->forget('categories.create.fromStore'); - $request->session()->flash('gaEventCategory', 'categories'); - $request->session()->flash('gaEventAction', 'create'); $subTitle = trans('firefly.create_new_category'); return view('categories.create', compact('subTitle')); @@ -93,8 +91,6 @@ class CategoryController extends Controller // put previous url in session $this->rememberPreviousUri('categories.delete.uri'); - $request->session()->flash('gaEventCategory', 'categories'); - $request->session()->flash('gaEventAction', 'delete'); return view('categories.delete', compact('category', 'subTitle')); } @@ -132,8 +128,6 @@ class CategoryController extends Controller $this->rememberPreviousUri('categories.edit.uri'); } $request->session()->forget('categories.edit.fromUpdate'); - $request->session()->flash('gaEventCategory', 'categories'); - $request->session()->flash('gaEventAction', 'edit'); return view('categories.edit', compact('category', 'subTitle')); } diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php index 911aa55673..ca7cf7b9f3 100644 --- a/app/Http/Controllers/CurrencyController.php +++ b/app/Http/Controllers/CurrencyController.php @@ -83,8 +83,6 @@ class CurrencyController extends Controller $this->rememberPreviousUri('currencies.create.uri'); } $request->session()->forget('currencies.create.fromStore'); - $request->session()->flash('gaEventCategory', 'currency'); - $request->session()->flash('gaEventAction', 'create'); return view('currencies.create', compact('subTitleIcon', 'subTitle')); } @@ -131,8 +129,6 @@ class CurrencyController extends Controller // put previous url in session $this->rememberPreviousUri('currencies.delete.uri'); - $request->session()->flash('gaEventCategory', 'currency'); - $request->session()->flash('gaEventAction', 'delete'); $subTitle = trans('form.delete_currency', ['name' => $currency->name]); return view('currencies.delete', compact('currency', 'subTitle')); @@ -191,8 +187,6 @@ class CurrencyController extends Controller $this->rememberPreviousUri('currencies.edit.uri'); } $request->session()->forget('currencies.edit.fromUpdate'); - $request->session()->flash('gaEventCategory', 'currency'); - $request->session()->flash('gaEventAction', 'edit'); return view('currencies.edit', compact('currency', 'subTitle', 'subTitleIcon')); } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 8d432147a1..1dd55b1cc9 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -36,6 +36,7 @@ use Illuminate\Support\Collection; use Log; use Monolog\Handler\RotatingFileHandler; use Preferences; +use ReflectionException; use Route as RouteFacade; use Session; use View; @@ -171,7 +172,11 @@ class HomeController extends Controller Log::debug('Call route:clear...'); Artisan::call('route:clear'); Log::debug('Call twig:clean...'); - Artisan::call('twig:clean'); + try { + Artisan::call('twig:clean'); + } catch(ReflectionException $e) { + // dont care + } Log::debug('Call view:clear...'); Artisan::call('view:clear'); Log::debug('Done! Redirecting...'); diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php index 875adce839..5d150b6193 100644 --- a/app/Http/Controllers/PiggyBankController.php +++ b/app/Http/Controllers/PiggyBankController.php @@ -120,8 +120,6 @@ class PiggyBankController extends Controller $this->rememberPreviousUri('piggy-banks.create.uri'); } Session::forget('piggy-banks.create.fromStore'); - Session::flash('gaEventCategory', 'piggy-banks'); - Session::flash('gaEventAction', 'create'); return view('piggy-banks.create', compact('accounts', 'subTitle', 'subTitleIcon')); } @@ -137,8 +135,6 @@ class PiggyBankController extends Controller // put previous url in session $this->rememberPreviousUri('piggy-banks.delete.uri'); - Session::flash('gaEventCategory', 'piggy-banks'); - Session::flash('gaEventAction', 'delete'); return view('piggy-banks.delete', compact('piggyBank', 'subTitle')); } @@ -188,8 +184,6 @@ class PiggyBankController extends Controller 'note' => null === $note ? '' : $note->text, ]; Session::flash('preFilled', $preFilled); - Session::flash('gaEventCategory', 'piggy-banks'); - Session::flash('gaEventAction', 'edit'); // put previous url in session if not redirect from store (not "return_to_edit"). if (true !== session('piggy-banks.edit.fromUpdate')) { diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 3235961b5e..88532a8d74 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -241,9 +241,6 @@ class ProfileController extends Controller Session::flush(); $repository->destroy($user); - Session::flash('gaEventCategory', 'user'); - Session::flash('gaEventAction', 'delete-account'); - return redirect(route('index')); } diff --git a/app/Http/Controllers/Report/ExpenseController.php b/app/Http/Controllers/Report/ExpenseController.php index ccaad3cd78..b23fbf8cf8 100644 --- a/app/Http/Controllers/Report/ExpenseController.php +++ b/app/Http/Controllers/Report/ExpenseController.php @@ -43,7 +43,7 @@ class ExpenseController extends Controller protected $accountRepository; /** - * + * Constructor for ExpenseController */ public function __construct() { @@ -60,6 +60,8 @@ class ExpenseController extends Controller } /** + * Generates the overview per budget. + * * @param Collection $accounts * @param Collection $expense * @param Carbon $start @@ -86,18 +88,18 @@ class ExpenseController extends Controller $all = $all->merge($combi); } // now find spent / earned: - $spent = $this->spentByBudget($accounts, $all, $start, $end); - // do some merging to get the budget info ready. + $spent = $this->spentByBudget($accounts, $all, $start, $end); + // join arrays somehow: $together = []; - foreach ($spent as $budgetId => $spentInfo) { - if (!isset($together[$budgetId])) { - $together[$budgetId]['spent'] = $spentInfo; - // get category info: - $first = reset($spentInfo); - $together[$budgetId]['budget'] = $first['budget']; + foreach ($spent as $categoryId => $spentInfo) { + if (!isset($together[$categoryId])) { + $together[$categoryId]['spent'] = $spentInfo; + $together[$categoryId]['budget'] = $spentInfo['name']; + $together[$categoryId]['grand_total'] = '0'; } + $together[$categoryId]['grand_total'] = bcadd($spentInfo['grand_total'], $together[$categoryId]['grand_total']); } - + unset($spentInfo); $result = view('reports.partials.exp-budgets', compact('together'))->render(); $cache->store($result); @@ -105,6 +107,8 @@ class ExpenseController extends Controller } /** + * Generates the overview per category (spent and earned). + * * @param Collection $accounts * @param Collection $expense * @param Carbon $start @@ -133,25 +137,24 @@ class ExpenseController extends Controller // now find spent / earned: $spent = $this->spentByCategory($accounts, $all, $start, $end); $earned = $this->earnedByCategory($accounts, $all, $start, $end); - // join arrays somehow: $together = []; foreach ($spent as $categoryId => $spentInfo) { if (!isset($together[$categoryId])) { - $together[$categoryId]['spent'] = $spentInfo; - // get category info: - $first = reset($spentInfo); - $together[$categoryId]['category'] = $first['category']; + $together[$categoryId]['spent'] = $spentInfo; + $together[$categoryId]['category'] = $spentInfo['name']; + $together[$categoryId]['grand_total'] = '0'; } + $together[$categoryId]['grand_total'] = bcadd($spentInfo['grand_total'], $together[$categoryId]['grand_total']); } - + unset($spentInfo); foreach ($earned as $categoryId => $earnedInfo) { if (!isset($together[$categoryId])) { - $together[$categoryId]['earned'] = $earnedInfo; - // get category info: - $first = reset($earnedInfo); - $together[$categoryId]['category'] = $first['category']; + $together[$categoryId]['earned'] = $earnedInfo; + $together[$categoryId]['category'] = $earnedInfo['name']; + $together[$categoryId]['grand_total'] = '0'; } + $together[$categoryId]['grand_total'] = bcadd($earnedInfo['grand_total'], $together[$categoryId]['grand_total']); } $result = view('reports.partials.exp-categories', compact('together'))->render(); @@ -161,6 +164,8 @@ class ExpenseController extends Controller } /** + * Overview of spending + * * @param Collection $accounts * @param Collection $expense * @param Carbon $start @@ -234,7 +239,7 @@ class ExpenseController extends Controller * @param Carbon $start * @param Carbon $end * - * @return string + * @return array */ protected function earnedByCategory(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array { @@ -260,21 +265,32 @@ class ExpenseController extends Controller // if not set, set to zero: if (!isset($sum[$categoryId][$currencyId])) { - $sum[$categoryId][$currencyId] = [ - 'sum' => '0', - 'category' => [ - 'id' => $categoryId, - 'name' => $categoryName, - ], - 'currency' => [ - 'symbol' => $transaction->transaction_currency_symbol, - 'dp' => $transaction->transaction_currency_dp, + + $sum[$categoryId] = [ + 'grand_total' => '0', + 'name' => $categoryName, + 'per_currency' => [ + $currencyId => [ + 'sum' => '0', + 'category' => [ + 'id' => $categoryId, + 'name' => $categoryName, + ], + 'currency' => [ + 'symbol' => $transaction->transaction_currency_symbol, + 'dp' => $transaction->transaction_currency_dp, + ], + ], ], ]; + } // add amount - $sum[$categoryId][$currencyId]['sum'] = bcadd($sum[$categoryId][$currencyId]['sum'], $transaction->transaction_amount); + $sum[$categoryId]['per_currency'][$currencyId]['sum'] = bcadd( + $sum[$categoryId]['per_currency'][$currencyId]['sum'], $transaction->transaction_amount + ); + $sum[$categoryId]['grand_total'] = bcadd($sum[$categoryId]['grand_total'], $transaction->transaction_amount); } return $sum; @@ -287,14 +303,17 @@ class ExpenseController extends Controller $collector->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setAccounts($assets); $collector->setOpposingAccounts($opposing); $set = $collector->getJournals(); - $sum = []; + $sum = [ + 'grand_sum' => '0', + 'per_currency' => [], + ]; // loop to support multi currency foreach ($set as $transaction) { $currencyId = $transaction->transaction_currency_id; // if not set, set to zero: - if (!isset($sum[$currencyId])) { - $sum[$currencyId] = [ + if (!isset($sum['per_currency'][$currencyId])) { + $sum['per_currency'][$currencyId] = [ 'sum' => '0', 'currency' => [ 'symbol' => $transaction->transaction_currency_symbol, @@ -304,7 +323,8 @@ class ExpenseController extends Controller } // add amount - $sum[$currencyId]['sum'] = bcadd($sum[$currencyId]['sum'], $transaction->transaction_amount); + $sum['per_currency'][$currencyId]['sum'] = bcadd($sum['per_currency'][$currencyId]['sum'], $transaction->transaction_amount); + $sum['grand_sum'] = bcadd($sum['grand_sum'], $transaction->transaction_amount); } return $sum; @@ -328,7 +348,7 @@ class ExpenseController extends Controller $sum = []; // loop to support multi currency foreach ($set as $transaction) { - $currencyId = $transaction->transaction_currency_id; + $currencyId = $transaction->transaction_currency_id; $budgetName = $transaction->transaction_budget_name; $budgetId = intval($transaction->transaction_budget_id); // if null, grab from journal: @@ -342,21 +362,31 @@ class ExpenseController extends Controller // if not set, set to zero: if (!isset($sum[$budgetId][$currencyId])) { - $sum[$budgetId][$currencyId] = [ - 'sum' => '0', - 'budget' => [ - 'id' => $budgetId, - 'name' => $budgetName, - ], - 'currency' => [ - 'symbol' => $transaction->transaction_currency_symbol, - 'dp' => $transaction->transaction_currency_dp, + + $sum[$budgetId] = [ + 'grand_total' => '0', + 'name' => $budgetName, + 'per_currency' => [ + $currencyId => [ + 'sum' => '0', + 'budget' => [ + 'id' => $budgetId, + 'name' => $budgetName, + ], + 'currency' => [ + 'symbol' => $transaction->transaction_currency_symbol, + 'dp' => $transaction->transaction_currency_dp, + ], + ], ], ]; } // add amount - $sum[$budgetId][$currencyId]['sum'] = bcadd($sum[$budgetId][$currencyId]['sum'], $transaction->transaction_amount); + $sum[$budgetId]['per_currency'][$currencyId]['sum'] = bcadd( + $sum[$budgetId]['per_currency'][$currencyId]['sum'], $transaction->transaction_amount + ); + $sum[$budgetId]['grand_total'] = bcadd($sum[$budgetId]['grand_total'], $transaction->transaction_amount); } return $sum; @@ -368,7 +398,7 @@ class ExpenseController extends Controller * @param Carbon $start * @param Carbon $end * - * @return string + * @return array */ protected function spentByCategory(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array { @@ -394,21 +424,31 @@ class ExpenseController extends Controller // if not set, set to zero: if (!isset($sum[$categoryId][$currencyId])) { - $sum[$categoryId][$currencyId] = [ - 'sum' => '0', - 'category' => [ - 'id' => $categoryId, - 'name' => $categoryName, - ], - 'currency' => [ - 'symbol' => $transaction->transaction_currency_symbol, - 'dp' => $transaction->transaction_currency_dp, + + $sum[$categoryId] = [ + 'grand_total' => '0', + 'name' => $categoryName, + 'per_currency' => [ + $currencyId => [ + 'sum' => '0', + 'category' => [ + 'id' => $categoryId, + 'name' => $categoryName, + ], + 'currency' => [ + 'symbol' => $transaction->transaction_currency_symbol, + 'dp' => $transaction->transaction_currency_dp, + ], + ], ], ]; } // add amount - $sum[$categoryId][$currencyId]['sum'] = bcadd($sum[$categoryId][$currencyId]['sum'], $transaction->transaction_amount); + $sum[$categoryId]['per_currency'][$currencyId]['sum'] = bcadd( + $sum[$categoryId]['per_currency'][$currencyId]['sum'], $transaction->transaction_amount + ); + $sum[$categoryId]['grand_total'] = bcadd($sum[$categoryId]['grand_total'], $transaction->transaction_amount); } return $sum; @@ -420,7 +460,7 @@ class ExpenseController extends Controller * @param Carbon $start * @param Carbon $end * - * @return string + * @return array */ protected function spentInPeriod(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array { @@ -429,14 +469,17 @@ class ExpenseController extends Controller $collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setAccounts($assets); $collector->setOpposingAccounts($opposing); $set = $collector->getJournals(); - $sum = []; + $sum = [ + 'grand_sum' => '0', + 'per_currency' => [], + ]; // loop to support multi currency foreach ($set as $transaction) { $currencyId = $transaction->transaction_currency_id; // if not set, set to zero: - if (!isset($sum[$currencyId])) { - $sum[$currencyId] = [ + if (!isset($sum['per_currency'][$currencyId])) { + $sum['per_currency'][$currencyId] = [ 'sum' => '0', 'currency' => [ 'symbol' => $transaction->transaction_currency_symbol, @@ -446,7 +489,8 @@ class ExpenseController extends Controller } // add amount - $sum[$currencyId]['sum'] = bcadd($sum[$currencyId]['sum'], $transaction->transaction_amount); + $sum['per_currency'][$currencyId]['sum'] = bcadd($sum['per_currency'][$currencyId]['sum'], $transaction->transaction_amount); + $sum['grand_sum'] = bcadd($sum['grand_sum'], $transaction->transaction_amount); } return $sum; diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php index aeec282409..82f184600b 100644 --- a/app/Http/Controllers/RuleController.php +++ b/app/Http/Controllers/RuleController.php @@ -102,8 +102,6 @@ class RuleController extends Controller $this->rememberPreviousUri('rules.create.uri'); } Session::forget('rules.create.fromStore'); - Session::flash('gaEventCategory', 'rules'); - Session::flash('gaEventAction', 'create-rule'); return view( 'rules.rule.create', @@ -124,8 +122,6 @@ class RuleController extends Controller // put previous url in session $this->rememberPreviousUri('rules.delete.uri'); - Session::flash('gaEventCategory', 'rules'); - Session::flash('gaEventAction', 'delete-rule'); return view('rules.rule.delete', compact('rule', 'subTitle')); } @@ -203,8 +199,6 @@ class RuleController extends Controller $this->rememberPreviousUri('rules.edit.uri'); } Session::forget('rules.edit.fromUpdate'); - Session::flash('gaEventCategory', 'rules'); - Session::flash('gaEventAction', 'edit-rule'); return view( 'rules.rule.edit', diff --git a/app/Http/Controllers/RuleGroupController.php b/app/Http/Controllers/RuleGroupController.php index 0ba9141041..9528ee4178 100644 --- a/app/Http/Controllers/RuleGroupController.php +++ b/app/Http/Controllers/RuleGroupController.php @@ -71,8 +71,6 @@ class RuleGroupController extends Controller $this->rememberPreviousUri('rule-groups.create.uri'); } Session::forget('rule-groups.create.fromStore'); - Session::flash('gaEventCategory', 'rules'); - Session::flash('gaEventAction', 'create-rule-group'); return view('rules.rule-group.create', compact('subTitleIcon', 'subTitle')); } @@ -92,8 +90,6 @@ class RuleGroupController extends Controller // put previous url in session $this->rememberPreviousUri('rule-groups.delete.uri'); - Session::flash('gaEventCategory', 'rules'); - Session::flash('gaEventAction', 'delete-rule-group'); return view('rules.rule-group.delete', compact('ruleGroup', 'subTitle', 'ruleGroupList')); } @@ -145,8 +141,6 @@ class RuleGroupController extends Controller $this->rememberPreviousUri('rule-groups.edit.uri'); } Session::forget('rule-groups.edit.fromUpdate'); - Session::flash('gaEventCategory', 'rules'); - Session::flash('gaEventAction', 'edit-rule-group'); return view('rules.rule-group.edit', compact('ruleGroup', 'subTitle')); } diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 550b67574d..3d1bb319d6 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -88,8 +88,6 @@ class TagController extends Controller $this->rememberPreviousUri('tags.create.uri'); } Session::forget('tags.create.fromStore'); - Session::flash('gaEventCategory', 'tags'); - Session::flash('gaEventAction', 'create'); return view('tags.create', compact('subTitle', 'subTitleIcon', 'apiKey')); } @@ -107,8 +105,6 @@ class TagController extends Controller // put previous url in session $this->rememberPreviousUri('tags.delete.uri'); - Session::flash('gaEventCategory', 'tags'); - Session::flash('gaEventAction', 'delete'); return view('tags.delete', compact('tag', 'subTitle')); } @@ -147,8 +143,6 @@ class TagController extends Controller $this->rememberPreviousUri('tags.edit.uri'); } Session::forget('tags.edit.fromUpdate'); - Session::flash('gaEventCategory', 'tags'); - Session::flash('gaEventAction', 'edit'); return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'apiKey')); } diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index ed25b29bf6..ae7a3dabcc 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -70,8 +70,6 @@ class MassController extends Controller // put previous url in session $this->rememberPreviousUri('transactions.mass-delete.uri'); - Session::flash('gaEventCategory', 'transactions'); - Session::flash('gaEventAction', 'mass-delete'); return view('transactions.mass-delete', compact('journals', 'subTitle')); } @@ -166,8 +164,6 @@ class MassController extends Controller // put previous url in session $this->rememberPreviousUri('transactions.mass-edit.uri'); - Session::flash('gaEventCategory', 'transactions'); - Session::flash('gaEventAction', 'mass-edit'); // collect some useful meta data for the mass edit: $filtered->each( diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php index 8e746e85e3..13a0578616 100644 --- a/app/Http/Controllers/Transaction/SingleController.php +++ b/app/Http/Controllers/Transaction/SingleController.php @@ -173,8 +173,6 @@ class SingleController extends Controller $this->rememberPreviousUri('transactions.create.uri'); } Session::forget('transactions.create.fromStore'); - Session::flash('gaEventCategory', 'transactions'); - Session::flash('gaEventAction', 'create-' . $what); asort($piggies); @@ -205,8 +203,6 @@ class SingleController extends Controller // put previous url in session $this->rememberPreviousUri('transactions.delete.uri'); - Session::flash('gaEventCategory', 'transactions'); - Session::flash('gaEventAction', 'delete-' . $what); return view('transactions.single.delete', compact('journal', 'subTitle', 'what')); } @@ -313,8 +309,6 @@ class SingleController extends Controller } Session::flash('preFilled', $preFilled); - Session::flash('gaEventCategory', 'transactions'); - Session::flash('gaEventAction', 'edit-' . $what); // put previous url in session if not redirect from store (not "return_to_edit"). if (true !== session('transactions.edit.fromUpdate')) { diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php index a5fe0a63ef..9b141fe5e8 100644 --- a/app/Http/Controllers/Transaction/SplitController.php +++ b/app/Http/Controllers/Transaction/SplitController.php @@ -116,8 +116,6 @@ class SplitController extends Controller $accountArray[$account->id]['currency_id'] = intval($account->getMeta('currency_id')); } - Session::flash('gaEventCategory', 'transactions'); - Session::flash('gaEventAction', 'edit-split-' . $preFilled['what']); // put previous url in session if not redirect from store (not "return_to_edit"). if (true !== session('transactions.edit-split.fromUpdate')) { diff --git a/resources/views/layout/default.twig b/resources/views/layout/default.twig index 7c52a8acff..d01ab308c0 100644 --- a/resources/views/layout/default.twig +++ b/resources/views/layout/default.twig @@ -215,16 +215,6 @@ })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', {'siteSpeedSampleRate': 100}); ga('send', 'pageview'); - - // send an event if relevant: - {% if Session.has('gaEventCategory') and Session.has('gaEventAction') and not Session.has('gaEventLabel') %} - ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}'); - {% endif %} - - // send event if relevant: - {% if Session.has('gaEventCategory') and Session.has('gaEventAction') and Session.has('gaEventLabel') %} - ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}', '{{ Session.get('gaEventLabel') }}'); - {% endif %} {% endif %} diff --git a/resources/views/layout/empty.twig b/resources/views/layout/empty.twig index 02fc0c111e..f96c8615d1 100644 --- a/resources/views/layout/empty.twig +++ b/resources/views/layout/empty.twig @@ -47,16 +47,6 @@ })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', {'siteSpeedSampleRate': 100}); ga('send', 'pageview'); - - // send an event if relevant: - {% if Session.has('gaEventCategory') and Session.has('gaEventAction') and not Session.has('gaEventLabel') %} - ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}'); - {% endif %} - - // send event if relevant: - {% if Session.has('gaEventCategory') and Session.has('gaEventAction') and Session.has('gaEventLabel') %} - ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}', '{{ Session.get('gaEventLabel') }}'); - {% endif %} {% endif %} diff --git a/resources/views/layout/guest.twig b/resources/views/layout/guest.twig index 2b2b10e8fd..3742c6d910 100644 --- a/resources/views/layout/guest.twig +++ b/resources/views/layout/guest.twig @@ -58,16 +58,6 @@ })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', {'siteSpeedSampleRate': 100}); ga('send', 'pageview'); - - // send an event if relevant: - {% if Session.has('gaEventCategory') and Session.has('gaEventAction') and not Session.has('gaEventLabel') %} - ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}'); - {% endif %} - - // send event if relevant: - {% if Session.has('gaEventCategory') and Session.has('gaEventAction') and Session.has('gaEventLabel') %} - ga('send', 'event', '{{ Session.get('gaEventCategory') }}', '{{ Session.get('gaEventAction') }}', '{{ Session.get('gaEventLabel') }}'); - {% endif %} {% endif %} diff --git a/resources/views/reports/partials/exp-budgets.twig b/resources/views/reports/partials/exp-budgets.twig index 1d5e382ce9..de59cc258e 100644 --- a/resources/views/reports/partials/exp-budgets.twig +++ b/resources/views/reports/partials/exp-budgets.twig @@ -1,26 +1,25 @@ - - + + {% for budgetId, entry in together %} - - - - + + {% for categoryId, entry in together %} - - -
{{ 'budget'|_ }}{{ 'spent'|_ }}{{ 'category'|_ }}{{ 'spent'|_ }}
- - {% if entry.budget.name|length ==0 %} + + {% if entry.budget == null %} {{ 'no_budget_squared'|_ }} {% else %} - {{ entry.budget.name }} + {{ entry.budget }} {% endif %} - {% if entry.spent|length ==0 %} + + {% if entry.spent.per_currency|length ==0 %} {{ '0'|formatAmount }} {% else %} - {% for expense in entry.spent %} + {% for expense in entry.spent.per_currency %} {{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}
{% endfor %} {% endif %} diff --git a/resources/views/reports/partials/exp-categories.twig b/resources/views/reports/partials/exp-categories.twig index 6483faf128..aff8d62089 100644 --- a/resources/views/reports/partials/exp-categories.twig +++ b/resources/views/reports/partials/exp-categories.twig @@ -2,34 +2,35 @@
{{ 'category'|_ }}{{ 'spent'|_ }}{{ 'earned'|_ }}{{ 'spent'|_ }}{{ 'earned'|_ }}
- {% if entry.category.name|length ==0 %} + + {% if entry.category == null %} {{ 'noCategory'|_ }} {% else %} - {{ entry.category.name }} + {{ entry.category }} + {% endif %} - {% if entry.spent|length ==0 %} + + {% if entry.spent.per_currency|length ==0 %} {{ '0'|formatAmount }} {% else %} - {% for expense in entry.spent %} + {% for expense in entry.spent.per_currency %} {{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}
{% endfor %} {% endif %}
- {% if entry.earned|length ==0 %} + + {% if entry.earned.per_currency|length ==0 %} {{ '0'|formatAmount }} {% else %} - {% for income in entry.earned %} + {% for income in entry.earned.per_currency %} {{ formatAmountBySymbol(income.sum, income.currency.symbol, income.currency.dp) }}
{% endfor %} {% endif %} diff --git a/resources/views/reports/partials/exp-not-grouped.twig b/resources/views/reports/partials/exp-not-grouped.twig index c946e8e307..bc454b7d44 100644 --- a/resources/views/reports/partials/exp-not-grouped.twig +++ b/resources/views/reports/partials/exp-not-grouped.twig @@ -1,33 +1,33 @@ + - - + + {% for name, amounts in result %} - - - - - + + + + + {% endfor %} -
{{ 'name'|_ }}
{{ name }} - {% if amounts.spent|length == 0%} - {{ '0'|formatAmount }} - {% endif %} - {% for expense in amounts.spent %} - {{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}
- {% endfor %} -
- {% if amounts.earned|length == 0 %} - {{ '0'|formatAmount }} - {% endif %} - {% for income in amounts.earned %} - {{ formatAmountBySymbol(income.sum, income.currency.symbol, income.currency.dp) }}
- {% endfor %} -
{{ name }} + {% if amounts.spent.per_currency|length == 0%} + {{ '0'|formatAmount }} + {% endif %} + {% for expense in amounts.spent.per_currency %} + {{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}
+ {% endfor %} +
+ {% if amounts.earned.per_currency|length == 0%} + {{ '0'|formatAmount }} + {% endif %} + {% for income in amounts.earned.per_currency %} + {{ formatAmountBySymbol(income.sum, income.currency.symbol, income.currency.dp) }}
+ {% endfor %} +