diff --git a/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php b/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php index 81097dd552..20f59a922d 100644 --- a/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php +++ b/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php @@ -113,7 +113,7 @@ class ChartJsAccountChartGenerator implements AccountChartGenerator 'data' => [], ]; $current = clone $start; - $range = Steam::balanceInRange($account, $start, $end); + $range = Steam::balanceInRange($account, $start, clone $end); $previous = array_values($range)[0]; while ($current <= $end) { $format = $current->format('Y-m-d'); @@ -142,7 +142,7 @@ class ChartJsAccountChartGenerator implements AccountChartGenerator // language: $format = trans('config.month_and_day'); - $data = [ + $data = [ 'count' => 1, 'labels' => [], 'datasets' => [ @@ -152,12 +152,17 @@ class ChartJsAccountChartGenerator implements AccountChartGenerator ] ], ]; - - $current = clone $start; + $range = Steam::balanceInRange($account, $start, $end); + $current = clone $start; + $previous = array_values($range)[0]; while ($end >= $current) { + $theDate = $current->format('Y-m-d'); + $balance = isset($range[$theDate]) ? $range[$theDate] : $previous; + $data['labels'][] = $current->formatLocalized($format); - $data['datasets'][0]['data'][] = Steam::balance($account, $current); + $data['datasets'][0]['data'][] = $balance; + $previous = $balance; $current->addDay(); } diff --git a/app/Generator/Chart/Bill/BillChartGenerator.php b/app/Generator/Chart/Bill/BillChartGenerator.php index c3583e0f94..bc20abb65d 100644 --- a/app/Generator/Chart/Bill/BillChartGenerator.php +++ b/app/Generator/Chart/Bill/BillChartGenerator.php @@ -14,12 +14,12 @@ interface BillChartGenerator { /** - * @param Collection $paid - * @param Collection $unpaid + * @param string $paid + * @param string $unpaid * * @return array */ - public function frontpage(Collection $paid, Collection $unpaid); + public function frontpage($paid, $unpaid); /** * @param Bill $bill diff --git a/app/Generator/Chart/Bill/ChartJsBillChartGenerator.php b/app/Generator/Chart/Bill/ChartJsBillChartGenerator.php index 9a319be137..52f3b540e7 100644 --- a/app/Generator/Chart/Bill/ChartJsBillChartGenerator.php +++ b/app/Generator/Chart/Bill/ChartJsBillChartGenerator.php @@ -2,11 +2,9 @@ namespace FireflyIII\Generator\Chart\Bill; -use Config; use FireflyIII\Models\Bill; use FireflyIII\Models\TransactionJournal; use Illuminate\Support\Collection; -use Preferences; /** * Class ChartJsBillChartGenerator @@ -17,42 +15,23 @@ class ChartJsBillChartGenerator implements BillChartGenerator { /** - * @param Collection $paid - * @param Collection $unpaid + * @param string $paid + * @param string $unpaid * * @return array */ - public function frontpage(Collection $paid, Collection $unpaid) + public function frontpage($paid, $unpaid) { - $paidDescriptions = []; - $paidAmount = 0; - $unpaidDescriptions = []; - $unpaidAmount = 0; bcscale(2); - - /** @var TransactionJournal $entry */ - foreach ($paid as $entry) { // loop paid and create single entry: - $paidDescriptions[] = $entry->description; - $paidAmount = bcadd($paidAmount, $entry->amount_positive); - } - /** @var Bill $entry */ - foreach ($unpaid as $entry) { // loop unpaid: - $description = $entry[0]->name . ' (' . $entry[1]->format('jS M Y') . ')'; - $amount = bcdiv(bcadd($entry[0]->amount_max, $entry[0]->amount_min), 2); - $unpaidDescriptions[] = $description; - $unpaidAmount = bcadd($unpaidAmount, $amount); - unset($amount, $description); - } - $data = [ [ - 'value' => $unpaidAmount, + 'value' => round($unpaid, 2), 'color' => 'rgba(53, 124, 165,0.7)', 'highlight' => 'rgba(53, 124, 165,0.9)', 'label' => trans('firefly.unpaid'), ], [ - 'value' => $paidAmount, + 'value' => round($paid * -1, 2), // paid is negative, must be positive. 'color' => 'rgba(0, 141, 76, 0.7)', 'highlight' => 'rgba(0, 141, 76, 0.9)', 'label' => trans('firefly.paid'), @@ -71,7 +50,7 @@ class ChartJsBillChartGenerator implements BillChartGenerator public function single(Bill $bill, Collection $entries) { // language: - $format = trans('config.month'); + $format = trans('config.month'); $data = [ 'count' => 3, @@ -86,11 +65,15 @@ class ChartJsBillChartGenerator implements BillChartGenerator $minAmount = []; $maxAmount = []; $actualAmount = []; + /** @var TransactionJournal $entry */ foreach ($entries as $entry) { $data['labels'][] = $entry->date->formatLocalized($format); $minAmount[] = round($bill->amount_min, 2); $maxAmount[] = round($bill->amount_max, 2); - $actualAmount[] = round(($entry->amount * -1), 2); + /* + * journalAmount has been collected in BillRepository::getJournals + */ + $actualAmount[] = round(($entry->journalAmount * -1), 2); } $data['datasets'][] = [ diff --git a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php index 42608e027d..6af66916ff 100644 --- a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php +++ b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php @@ -83,8 +83,8 @@ class ChartJsBudgetChartGenerator implements BudgetChartGenerator if ($entry[1] != 0 || $entry[2] != 0 || $entry[3] != 0) { $data['labels'][] = $entry[0]; $left[] = round($entry[1], 2); - $spent[] = round($entry[2], 2); - $overspent[] = round($entry[3], 2); + $spent[] = round($entry[2] * -1, 2); // spent is coming in negative, must be positive + $overspent[] = round($entry[3] * -1, 2); // same } } diff --git a/app/Generator/Chart/Category/CategoryChartGenerator.php b/app/Generator/Chart/Category/CategoryChartGenerator.php index f595fcf541..77e8880afa 100644 --- a/app/Generator/Chart/Category/CategoryChartGenerator.php +++ b/app/Generator/Chart/Category/CategoryChartGenerator.php @@ -54,5 +54,5 @@ interface CategoryChartGenerator * * @return array */ - public function spentInYear(Collection $categories, Collection $entries); + public function spentInPeriod(Collection $categories, Collection $entries); } diff --git a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php index 5b79fdbf47..8a2ed404c0 100644 --- a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php +++ b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php @@ -49,79 +49,6 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator return $data; } - /** - * @param Collection $entries - * - * @return array - */ - public function frontpage(Collection $entries) - { - $data = [ - 'count' => 1, - 'labels' => [], - 'datasets' => [ - [ - 'label' => trans('firefly.spent'), - 'data' => [] - ] - ], - ]; - foreach ($entries as $entry) { - if ($entry['sum'] != 0) { - $data['labels'][] = $entry['name']; - $data['datasets'][0]['data'][] = round(($entry['sum'] * -1), 2); - } - } - - return $data; - } - - /** - * @codeCoverageIgnore - * - * @param Collection $entries - * - * @return array - */ - public function period(Collection $entries) - { - return $this->all($entries); - - } - - /** - * @param Collection $categories - * @param Collection $entries - * - * @return array - */ - public function spentInYear(Collection $categories, Collection $entries) - { - - // language: - $format = trans('config.month'); - - $data = [ - 'count' => 0, - 'labels' => [], - 'datasets' => [], - ]; - - foreach ($categories as $category) { - $data['labels'][] = $category->name; - } - - foreach ($entries as $entry) { - $date = $entry[0]->formatLocalized($format); - array_shift($entry); - $data['count']++; - $data['datasets'][] = ['label' => $date, 'data' => $entry]; - } - - return $data; - - } - /** * @param Collection $categories * @param Collection $entries @@ -156,36 +83,30 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator } /** - * @param Collection $categories * @param Collection $entries * * @return array */ - public function spentInPeriod(Collection $categories, Collection $entries) + public function frontpage(Collection $entries) { - - // language: - $format = trans('config.month'); - $data = [ - 'count' => 0, + 'count' => 1, 'labels' => [], - 'datasets' => [], + 'datasets' => [ + [ + 'label' => trans('firefly.spent'), + 'data' => [] + ] + ], ]; - - foreach ($categories as $category) { - $data['labels'][] = $category->name; - } - foreach ($entries as $entry) { - $date = $entry[0]->formatLocalized($format); - array_shift($entry); - $data['count']++; - $data['datasets'][] = ['label' => $date, 'data' => $entry]; + if ($entry['sum'] != 0) { + $data['labels'][] = $entry['name']; + $data['datasets'][0]['data'][] = round(($entry['sum'] * -1), 2); + } } return $data; - } /** @@ -224,4 +145,50 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator return $data; } + + /** + * @codeCoverageIgnore + * + * @param Collection $entries + * + * @return array + */ + public function period(Collection $entries) + { + return $this->all($entries); + + } + + /** + * @param Collection $categories + * @param Collection $entries + * + * @return array + */ + public function spentInPeriod(Collection $categories, Collection $entries) + { + + // language: + $format = trans('config.month'); + + $data = [ + 'count' => 0, + 'labels' => [], + 'datasets' => [], + ]; + + foreach ($categories as $category) { + $data['labels'][] = $category->name; + } + + foreach ($entries as $entry) { + $date = $entry[0]->formatLocalized($format); + array_shift($entry); + $data['count']++; + $data['datasets'][] = ['label' => $date, 'data' => $entry]; + } + + return $data; + + } } diff --git a/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.php b/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.php index 3e10f5cac0..bea4b9605a 100644 --- a/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.php +++ b/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.php @@ -3,9 +3,7 @@ namespace FireflyIII\Generator\Chart\PiggyBank; use Carbon\Carbon; -use Config; use Illuminate\Support\Collection; -use Preferences; /** @@ -25,7 +23,7 @@ class ChartJsPiggyBankChartGenerator implements PiggyBankChartGenerator { // language: - $format = trans('config.month_and_day'); + $format = trans('config.month_and_day'); $data = [ 'count' => 1, diff --git a/app/Generator/Chart/Report/ChartJsReportChartGenerator.php b/app/Generator/Chart/Report/ChartJsReportChartGenerator.php index 8cb01d82d3..1089ba7305 100644 --- a/app/Generator/Chart/Report/ChartJsReportChartGenerator.php +++ b/app/Generator/Chart/Report/ChartJsReportChartGenerator.php @@ -2,9 +2,7 @@ namespace FireflyIII\Generator\Chart\Report; -use Config; use Illuminate\Support\Collection; -use Preferences; /** * Class ChartJsReportChartGenerator @@ -14,40 +12,6 @@ use Preferences; class ChartJsReportChartGenerator implements ReportChartGenerator { - /** - * @param Collection $entries - * - * @return array - */ - public function yearInOut(Collection $entries) - { - // language: - $format = trans('config.month'); - - $data = [ - 'count' => 2, - 'labels' => [], - 'datasets' => [ - [ - 'label' => trans('firefly.income'), - 'data' => [] - ], - [ - 'label' => trans('firefly.expenses'), - 'data' => [] - ] - ], - ]; - - foreach ($entries as $entry) { - $data['labels'][] = $entry[0]->formatLocalized($format); - $data['datasets'][0]['data'][] = round($entry[1], 2); - $data['datasets'][1]['data'][] = round($entry[2], 2); - } - - return $data; - } - /** * Same as above but other translations. * @@ -81,6 +45,71 @@ class ChartJsReportChartGenerator implements ReportChartGenerator return $data; } + /** + * @param string $income + * @param string $expense + * @param int $count + * + * @return array + */ + public function multiYearInOutSummarized($income, $expense, $count) + { + $data = [ + 'count' => 2, + 'labels' => [trans('firefly.sum_of_years'), trans('firefly.average_of_years')], + 'datasets' => [ + [ + 'label' => trans('firefly.income'), + 'data' => [] + ], + [ + 'label' => trans('firefly.expenses'), + 'data' => [] + ] + ], + ]; + $data['datasets'][0]['data'][] = round($income, 2); + $data['datasets'][1]['data'][] = round($expense, 2); + $data['datasets'][0]['data'][] = round(($income / $count), 2); + $data['datasets'][1]['data'][] = round(($expense / $count), 2); + + return $data; + } + + /** + * @param Collection $entries + * + * @return array + */ + public function yearInOut(Collection $entries) + { + // language: + $format = trans('config.month'); + + $data = [ + 'count' => 2, + 'labels' => [], + 'datasets' => [ + [ + 'label' => trans('firefly.income'), + 'data' => [] + ], + [ + 'label' => trans('firefly.expenses'), + 'data' => [] + ] + ], + ]; + + foreach ($entries as $entry) { + $data['labels'][] = $entry[0]->formatLocalized($format); + $data['datasets'][0]['data'][] = round($entry[1], 2); + $data['datasets'][1]['data'][] = round($entry[2], 2); + } + + return $data; + } + /** * @param string $income * @param string $expense @@ -112,35 +141,4 @@ class ChartJsReportChartGenerator implements ReportChartGenerator return $data; } - - /** - * @param string $income - * @param string $expense - * @param int $count - * - * @return array - */ - public function multiYearInOutSummarized($income, $expense, $count) - { - $data = [ - 'count' => 2, - 'labels' => [trans('firefly.sum_of_years'), trans('firefly.average_of_years')], - 'datasets' => [ - [ - 'label' => trans('firefly.income'), - 'data' => [] - ], - [ - 'label' => trans('firefly.expenses'), - 'data' => [] - ] - ], - ]; - $data['datasets'][0]['data'][] = round($income, 2); - $data['datasets'][1]['data'][] = round($expense, 2); - $data['datasets'][0]['data'][] = round(($income / $count), 2); - $data['datasets'][1]['data'][] = round(($expense / $count), 2); - - return $data; - } } diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php index ff62f2fb4c..981a1a0a8a 100644 --- a/app/Helpers/Attachments/AttachmentHelper.php +++ b/app/Helpers/Attachments/AttachmentHelper.php @@ -67,7 +67,9 @@ class AttachmentHelper implements AttachmentHelperInterface } } } else { - $this->processFile($files, $model); + if (!is_null($files)) { + $this->processFile($files, $model); + } } return true; diff --git a/app/Helpers/Csv/Converter/Date.php b/app/Helpers/Csv/Converter/Date.php index d43a961ac1..fa6a6a8cb4 100644 --- a/app/Helpers/Csv/Converter/Date.php +++ b/app/Helpers/Csv/Converter/Date.php @@ -17,7 +17,8 @@ class Date extends BasicConverter implements ConverterInterface { /** - * @return Carbon + * @return static + * @throws FireflyException */ public function convert() { diff --git a/app/Helpers/Report/ReportQuery.php b/app/Helpers/Report/ReportQuery.php index 6714c22e4c..ae484d8095 100644 --- a/app/Helpers/Report/ReportQuery.php +++ b/app/Helpers/Report/ReportQuery.php @@ -161,15 +161,6 @@ class ReportQuery implements ReportQueryInterface } } ); -// $data = $data->filter( -// function (TransactionJournal $journal) { -// if ($journal->amount != 0) { -// return $journal; -// } -// -// return null; -// } -// ); return $data; } diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index ab7993255d..b7a6c4c006 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -56,7 +56,8 @@ class AccountController extends Controller } /** - * @param Account $account + * @param AccountRepositoryInterface $repository + * @param Account $account * * @return \Illuminate\View\View */ diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index ac255e3783..5a750ac786 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -90,7 +90,8 @@ class AttachmentController extends Controller } /** - * @param Attachment $attachment + * @param Attachment $attachment + * @param AttachmentHelperInterface $helper */ public function download(Attachment $attachment, AttachmentHelperInterface $helper) { diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 1ea0a985df..ab6e06a35e 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -228,6 +228,11 @@ class AuthController extends Controller return $domains; } + /** + * @param $email + * + * @return bool + */ protected function isBlockedDomain($email) { $parts = explode('@', $email); diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.php index a366bd395a..93eda589b0 100644 --- a/app/Http/Controllers/Auth/PasswordController.php +++ b/app/Http/Controllers/Auth/PasswordController.php @@ -77,6 +77,8 @@ class PasswordController extends Controller return redirect()->back()->withErrors(['email' => trans($response)]); } + abort(404); + return ''; } } diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index 2bece914ec..6e92369b22 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -132,7 +132,9 @@ class BudgetController extends Controller } /** - * @param BudgetRepositoryInterface $repository + * @param BudgetRepositoryInterface $repository + * + * @param AccountRepositoryInterface $accountRepository * * @return \Illuminate\View\View */ diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 0c9ae93f15..04ef878492 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -146,6 +146,8 @@ class CategoryController extends Controller * @param CategoryRepositoryInterface $repository * @param Category $category * + * @param $date + * * @return \Illuminate\View\View */ public function showWithDate(CategoryRepositoryInterface $repository, Category $category, $date) diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php index c1df3470f3..5048553403 100644 --- a/app/Http/Controllers/Chart/AccountController.php +++ b/app/Http/Controllers/Chart/AccountController.php @@ -37,13 +37,12 @@ class AccountController extends Controller /** * Shows the balances for a given set of dates and accounts. * - * TODO fix parameters. + * @param $report_type + * @param Carbon $start + * @param Carbon $end + * @param Collection $accounts * - * @param AccountRepositoryInterface $repository - * - * @param $url - * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Illuminate\Http\JsonResponse */ public function report($report_type, Carbon $start, Carbon $end, Collection $accounts) { diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php index d15b168d1b..5f05b25c5c 100644 --- a/app/Http/Controllers/Chart/BillController.php +++ b/app/Http/Controllers/Chart/BillController.php @@ -33,7 +33,7 @@ class BillController extends Controller } /** - * Shows all bills and whether or not theyve been paid this month (pie chart). + * Shows all bills and whether or not they've been paid this month (pie chart). * * @param BillRepositoryInterface $repository * @@ -41,28 +41,24 @@ class BillController extends Controller */ public function frontpage(BillRepositoryInterface $repository) { - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); - $cache = new CacheProperties(); // chart properties for cache: - $cache->addProperty($start); - $cache->addProperty($end); - $cache->addProperty('bills'); - $cache->addProperty('frontpage'); - if ($cache->has()) { - return Response::json($cache->get()); // @codeCoverageIgnore + $start = Session::get('start', Carbon::now()->startOfMonth()); + $end = Session::get('end', Carbon::now()->endOfMonth()); + $paid = $repository->getBillsPaidInRange($start, $end); // will be a negative amount. + $unpaid = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount. + $creditCardDue = $repository->getCreditCardBill($start, $end); + + if ($creditCardDue < 0) { + // expenses are negative (bill not yet paid), + $creditCardDue = bcmul($creditCardDue, '-1'); + $unpaid = bcadd($unpaid, $creditCardDue); + } else { + // if more than zero, the bill has been paid: (transfer = positive). + // amount must be negative to be added to $paid: + $paid = bcadd($paid, $creditCardDue); } - $set = $repository->getBillsForChart($start, $end); - - // optionally expand this set with credit card data - $set = $repository->getCreditCardInfoForChart($set, $start, $end); - $paid = $set->get('paid'); - $unpaid = $set->get('unpaid'); - - // build chart: $data = $this->generator->frontpage($paid, $unpaid); - $cache->store($data); return Response::json($data); } diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index 14298452cc..8d854c474b 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -43,6 +43,8 @@ class BudgetController extends Controller * @param Carbon $end * @param Collection $accounts * @param Collection $budgets + * + * @return \Illuminate\Http\JsonResponse */ public function multiYear(BudgetRepositoryInterface $repository, $report_type, Carbon $start, Carbon $end, Collection $accounts, Collection $budgets) { @@ -110,8 +112,9 @@ class BudgetController extends Controller } /** - * @param BudgetRepositoryInterface $repository - * @param Budget $budget + * @param BudgetRepositoryInterface $repository + * @param AccountRepositoryInterface $accountRepository + * @param Budget $budget * * @return \Symfony\Component\HttpFoundation\Response */ @@ -205,17 +208,16 @@ class BudgetController extends Controller /** * Shows a budget list with spent/left/overspent. * - * @param BudgetRepositoryInterface $repository + * @param BudgetRepositoryInterface $repository + * + * @param AccountRepositoryInterface $accountRepository * * @return \Symfony\Component\HttpFoundation\Response */ public function frontpage(BudgetRepositoryInterface $repository, AccountRepositoryInterface $accountRepository) { - $budgets = $repository->getBudgets(); - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); - $allEntries = new Collection; - $accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']); + $start = Session::get('start', Carbon::now()->startOfMonth()); + $end = Session::get('end', Carbon::now()->endOfMonth()); // chart properties for cache: $cache = new CacheProperties(); @@ -227,52 +229,57 @@ class BudgetController extends Controller return Response::json($cache->get()); // @codeCoverageIgnore } + $budgets = $repository->getBudgetsAndLimitsInRange($start, $end); + $allEntries = new Collection; + $accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']); + + bcscale(2); /** @var Budget $budget */ foreach ($budgets as $budget) { - $repetitions = $repository->getBudgetLimitRepetitions($budget, $start, $end); - if ($repetitions->count() == 0) { - $expenses = $repository->balanceInPeriod($budget, $start, $end, $accounts) * -1; - $allEntries->push([$budget->name, 0, 0, $expenses, 0, 0]); - continue; + // we already have amount, startdate and enddate. + // if this "is" a limit repetition (as opposed to a budget without one entirely) + // depends on whether startdate and enddate are null. + $name = $budget->name; + if (is_null($budget->startdate) && is_null($budget->enddate)) { + $currentStart = clone $start; + $currentEnd = clone $end; + $expenses = $repository->balanceInPeriod($budget, $currentStart, $currentEnd, $accounts); + $amount = 0; + $left = 0; + $spent = $expenses; + $overspent = 0; + } else { + $currentStart = clone $budget->startdate; + $currentEnd = clone $budget->enddate; + $expenses = $repository->balanceInPeriod($budget, $currentStart, $currentEnd, $accounts); + $amount = $budget->amount; + // smaller than 1 means spent MORE than budget allows. + $left = bccomp(bcadd($budget->amount, $expenses), '0') < 1 ? 0 : bcadd($budget->amount, $expenses); + $spent = bccomp(bcadd($budget->amount, $expenses), '0') < 1 ? ($amount * -1) : $expenses; + $overspent = bccomp(bcadd($budget->amount, $expenses), '0') < 1 ? bcadd($budget->amount, $expenses) : 0; } - /** @var LimitRepetition $repetition */ - foreach ($repetitions as $repetition) { - $expenses = $repository->balanceInPeriod($budget, $repetition->startdate, $repetition->enddate, $accounts) * -1; - // $left can be less than zero. - // $overspent can be more than zero ( = overspending) - $left = max(bcsub($repetition->amount, $expenses), 0); // limited at zero. - $overspent = max(bcsub($expenses, $repetition->amount), 0); // limited at zero. - $name = $budget->name; - - // $spent is maxed to the repetition amount: - $spent = $expenses > $repetition->amount ? $repetition->amount : $expenses; - - - $allEntries->push([$name, $left, $spent, $overspent, $repetition->amount, $expenses]); - } + $allEntries->push([$name, $left, $spent, $overspent, $amount, $expenses]); } - $noBudgetExpenses = $repository->getWithoutBudgetSum($start, $end) * -1; + $noBudgetExpenses = $repository->getWithoutBudgetSum($start, $end); $allEntries->push([trans('firefly.noBudget'), 0, 0, $noBudgetExpenses, 0, 0]); - $data = $this->generator->frontpage($allEntries); $cache->store($data); return Response::json($data); - } /** - * Show a yearly overview for a budget. - * * @param BudgetRepositoryInterface $repository - * @param $year - * @param bool $shared + * @param $report_type + * @param Carbon $start + * @param Carbon $end + * @param Collection $accounts * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Illuminate\Http\JsonResponse */ public function year(BudgetRepositoryInterface $repository, $report_type, Carbon $start, Carbon $end, Collection $accounts) { @@ -291,7 +298,7 @@ class BudgetController extends Controller return Response::json($cache->get()); // @codeCoverageIgnore } -// filter empty budgets: + // filter empty budgets: foreach ($allBudgets as $budget) { $spent = $repository->balanceInPeriod($budget, $start, $end, $accounts); if ($spent != 0) { diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php index c12be90a40..6511dd92ac 100644 --- a/app/Http/Controllers/Chart/CategoryController.php +++ b/app/Http/Controllers/Chart/CategoryController.php @@ -135,6 +135,8 @@ class CategoryController extends Controller * @param Carbon $end * @param Collection $accounts * @param Collection $categories + * + * @return \Illuminate\Http\JsonResponse */ public function multiYear(CategoryRepositoryInterface $repository, $report_type, Carbon $start, Carbon $end, Collection $accounts, Collection $categories) { @@ -248,6 +250,8 @@ class CategoryController extends Controller * @param CategoryRepositoryInterface $repository * @param Category $category * + * @param $date + * * @return \Symfony\Component\HttpFoundation\Response */ public function specificPeriod(CategoryRepositoryInterface $repository, Category $category, $date) @@ -287,66 +291,6 @@ class CategoryController extends Controller } - /** - * This chart will only show expenses. - * - * @param CategoryRepositoryInterface $repository - * @param $report_type - * @param Carbon $start - * @param Carbon $end - * @param Collection $accounts - * - * @return \Illuminate\Http\JsonResponse - */ - public function spentInYear(CategoryRepositoryInterface $repository, $report_type, Carbon $start, Carbon $end, Collection $accounts) - { - - $cache = new CacheProperties; // chart properties for cache: - $cache->addProperty($start); - $cache->addProperty($report_type); - $cache->addProperty($end); - $cache->addProperty($accounts); - $cache->addProperty('category'); - $cache->addProperty('spent-in-year'); - if ($cache->has()) { - return Response::json($cache->get()); // @codeCoverageIgnore - } - - $allCategories = $repository->getCategories(); - $entries = new Collection; - $categories = $allCategories->filter( - function (Category $category) use ($repository, $start, $end, $accounts) { - $spent = $repository->balanceInPeriod($category, $start, $end, $accounts); - if ($spent < 0) { - return $category; - } - - return null; - } - ); - - while ($start < $end) { - $month = clone $start; // month is the current end of the period - $month->endOfMonth(); - $row = [clone $start]; // make a row: - - foreach ($categories as $category) { // each budget, fill the row - $spent = $repository->balanceInPeriod($category, $start, $month, $accounts); - if ($spent < 0) { - $row[] = $spent * -1; - } else { - $row[] = 0; - } - } - $entries->push($row); - $start->addMonth(); - } - $data = $this->generator->spentInYear($categories, $entries); - $cache->store($data); - - return Response::json($data); - } - /** * Returns a chart of what has been earned in this period in each category * grouped by month. @@ -389,7 +333,7 @@ class CategoryController extends Controller $categories = $categories->merge($set); // save the set combined with the data that is in it: // for example: - // [december 2015, salary:1000, bonus:200] + // december 2015, salary:1000, bonus:200 $sets->push([$currentStart, $set]); $start->addMonth(); } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index bb9b3d2bc6..465c38c441 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -1,7 +1,6 @@ startOfMonth()); $end = Session::get('end', Carbon::now()->endOfMonth()); bcscale(2); - // works for json too! - $cache = new CacheProperties; - $cache->addProperty($start); - $cache->addProperty($end); - $cache->addProperty('box-bills-paid'); - if ($cache->has()) { - return Response::json($cache->get()); // @codeCoverageIgnore + /* + * Since both this method and the chart use the exact same data, we can suffice + * with calling the one method in the bill repository that will get this amount. + */ + $amount = $repository->getBillsPaidInRange($start, $end); // will be a negative amount. + $creditCardDue = $repository->getCreditCardBill($start, $end); + if ($creditCardDue >= 0) { + $amount = bcadd($amount, $creditCardDue); } - // get amount from bills - $amount = $repository->billsPaidInRange($start, $end)->sum('paid'); + $amount = $amount * -1; - // add credit card bill. - $creditCards = $accountRepository->getCreditCards($end); // Find credit card accounts and possibly unpaid credit card bills. - /** @var Account $creditCard */ - foreach ($creditCards as $creditCard) { - if ($creditCard->balance == 0) { - // find a transfer TO the credit card which should account for - // anything paid. If not, the CC is not yet used. - $amount = bcadd($amount, $accountRepository->getTransfersInRange($creditCard, $start, $end)->sum('amount')); - } - } $data = ['box' => 'bills-paid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount]; - $cache->store($data); return Response::json($data); } /** - * @param BillRepositoryInterface $repository - * @param AccountRepositoryInterface $accountRepository + * @param BillRepositoryInterface $repository * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Illuminate\Http\JsonResponse */ - public function boxBillsUnpaid(BillRepositoryInterface $repository, AccountRepositoryInterface $accountRepository) + public function boxBillsUnpaid(BillRepositoryInterface $repository) { - $amount = 0; - $start = Session::get('start', Carbon::now()->startOfMonth()); - $end = Session::get('end', Carbon::now()->endOfMonth()); bcscale(2); + $start = Session::get('start', Carbon::now()->startOfMonth()); + $end = Session::get('end', Carbon::now()->endOfMonth()); + $amount = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount. + $creditCardDue = $repository->getCreditCardBill($start, $end); - // works for json too! - $cache = new CacheProperties; - $cache->addProperty($start); - $cache->addProperty($end); - $cache->addProperty('box-bills-unpaid'); - if ($cache->has()) { - return Response::json($cache->get()); // @codeCoverageIgnore - } - - $bills = $repository->getActiveBills(); - $unpaid = new Collection; // bills - - /** @var Bill $bill */ - foreach ($bills as $bill) { - $ranges = $repository->getRanges($bill, $start, $end); - - foreach ($ranges as $range) { - $journals = $repository->getJournalsInRange($bill, $range['start'], $range['end']); - if ($journals->count() == 0) { - $unpaid->push([$bill, $range['start']]); - } - } - } - unset($bill, $bills, $range, $ranges); - - $creditCards = $accountRepository->getCreditCards($end); - - /** @var Account $creditCard */ - foreach ($creditCards as $creditCard) { - $date = new Carbon($creditCard->getMeta('ccMonthlyPaymentDate')); - if ($creditCard->balance < 0) { - // unpaid! create a fake bill that matches the amount. - $description = $creditCard->name; - $fakeAmount = $creditCard->balance * -1; - $fakeBill = $repository->createFakeBill($description, $date, $fakeAmount); - $unpaid->push([$fakeBill, $date]); - } - } - /** @var Bill $entry */ - foreach ($unpaid as $entry) { - $current = bcdiv(bcadd($entry[0]->amount_max, $entry[0]->amount_min), 2); - $amount = bcadd($amount, $current); + if ($creditCardDue < 0) { + // expenses are negative (bill not yet paid), + $creditCardDue = bcmul($creditCardDue, '-1'); + $amount = bcadd($amount, $creditCardDue); } $data = ['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount]; - $cache->store($data); return Response::json($data); } /** - * @param ReportQueryInterface $reportQuery + * @param ReportQueryInterface $reportQuery + * + * @param AccountRepositoryInterface $accountRepository * * @return \Symfony\Component\HttpFoundation\Response */ @@ -193,7 +140,9 @@ class JsonController extends Controller } /** - * @param ReportQueryInterface $reportQuery + * @param ReportQueryInterface $reportQuery + * + * @param AccountRepositoryInterface $accountRepository * * @return \Symfony\Component\HttpFoundation\Response */ diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 59bf1f01ac..ccf47d7e4a 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -64,9 +64,12 @@ class ReportController extends Controller $accountList = join(',', $accountIds); - return view('reports.index', compact('months', 'accounts', 'start', 'accountList', - 'startOfMonth', 'endOfMonth', 'startOfYear', 'endOfYear' - )); + return view( + 'reports.index', compact( + 'months', 'accounts', 'start', 'accountList', + 'startOfMonth', 'endOfMonth', 'startOfYear', 'endOfYear' + ) + ); } /** @@ -154,6 +157,14 @@ class ReportController extends Controller ); } + /** + * @param $report_type + * @param $start + * @param $end + * @param $accounts + * + * @return View + */ public function defaultMultiYear($report_type, $start, $end, $accounts) { @@ -212,7 +223,6 @@ class ReportController extends Controller // more than one year date difference means year report. if ($start->diffInMonths($end) > 12) { - // return view('error')->with('message', 'No report yet for this time period.'); return $this->defaultMultiYear($report_type, $start, $end, $accounts); } // more than two months date difference means year report. @@ -221,7 +231,6 @@ class ReportController extends Controller } return $this->defaultMonth($report_type, $start, $end, $accounts); - break; } diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index 732c6d8047..8db37205bd 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -10,11 +10,13 @@ use FireflyIII\Events\JournalSaved; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Http\Requests\JournalFormRequest; use FireflyIII\Models\PiggyBank; +use FireflyIII\Models\PiggyBankEvent; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; +use Illuminate\Support\Collection; use Input; use Preferences; use Response; @@ -264,6 +266,15 @@ class TransactionController extends Controller */ public function show(JournalRepositoryInterface $repository, TransactionJournal $journal) { + + /** @var Collection $set */ + $events = $journal->piggyBankEvents()->get(); + $events->each( + function (PiggyBankEvent $event) { + $event->piggyBank = $event->piggyBank()->withTrashed()->first(); + } + ); + bcscale(2); $journal->transactions->each( function (Transaction $t) use ($journal, $repository) { @@ -274,13 +285,15 @@ class TransactionController extends Controller $what = strtolower($journal->getTransactionType()); $subTitle = trans('firefly.' . $journal->getTransactionType()) . ' "' . e($journal->description) . '"'; - return view('transactions.show', compact('journal', 'subTitle', 'what')); + return view('transactions.show', compact('journal','events', 'subTitle', 'what')); } /** * @param JournalFormRequest $request * @param JournalRepositoryInterface $repository * + * @param AttachmentHelperInterface $att + * * @return \Illuminate\Http\RedirectResponse */ public function store(JournalFormRequest $request, JournalRepositoryInterface $repository, AttachmentHelperInterface $att) diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index d867e9512f..a11d1d9e99 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -4,7 +4,7 @@ use App; use Auth; use Carbon\Carbon; use Closure; -use Config; +use FireflyIII\User; use Illuminate\Contracts\Auth\Guard; use Illuminate\Http\Request; use Preferences; @@ -46,6 +46,7 @@ class Authenticate */ public function handle(Request $request, Closure $next) { + if ($this->auth->guest()) { if ($request->ajax()) { return response('Unauthorized.', 401); @@ -54,16 +55,16 @@ class Authenticate } } - if (intval($this->auth->user()->blocked) == 1) { + if ($this->auth->user() instanceof User && intval($this->auth->user()->blocked) == 1) { Auth::logout(); return redirect()->route('index'); } // if logged in, set user language: - $pref = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US')); + $pref = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US')); App::setLocale($pref->data); - Carbon::setLocale(substr($pref->data,0,2)); + Carbon::setLocale(substr($pref->data, 0, 2)); $locale = explode(',', trans('config.locale')); $locale = array_map('trim', $locale); diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php index 2e6ccb2834..e429509482 100644 --- a/app/Http/breadcrumbs.php +++ b/app/Http/breadcrumbs.php @@ -1,6 +1,6 @@ push(trans('breadcrumbs.home'), route('index')); } @@ -24,7 +24,7 @@ Breadcrumbs::register( Breadcrumbs::register( 'index', - function (Generator $breadcrumbs) { + function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->push(trans('breadcrumbs.home'), route('index')); } @@ -33,21 +33,21 @@ Breadcrumbs::register( // accounts Breadcrumbs::register( - 'accounts.index', function (Generator $breadcrumbs, $what) { + 'accounts.index', function (BreadCrumbGenerator $breadcrumbs, $what) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('firefly.' . strtolower(e($what)) . '_accounts'), route('accounts.index', [$what])); } ); Breadcrumbs::register( - 'accounts.create', function (Generator $breadcrumbs, $what) { + 'accounts.create', function (BreadCrumbGenerator $breadcrumbs, $what) { $breadcrumbs->parent('accounts.index', $what); $breadcrumbs->push(trans('firefly.new_' . strtolower(e($what)) . '_account'), route('accounts.create', [$what])); } ); Breadcrumbs::register( - 'accounts.show', function (Generator $breadcrumbs, Account $account) { + 'accounts.show', function (BreadCrumbGenerator $breadcrumbs, Account $account) { $what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type); @@ -57,7 +57,7 @@ Breadcrumbs::register( } ); Breadcrumbs::register( - 'accounts.delete', function (Generator $breadcrumbs, Account $account) { + 'accounts.delete', function (BreadCrumbGenerator $breadcrumbs, Account $account) { $breadcrumbs->parent('accounts.show', $account); $breadcrumbs->push(trans('firefly.delete_account', ['name' => e($account->name)]), route('accounts.delete', [$account->id])); } @@ -65,7 +65,7 @@ Breadcrumbs::register( Breadcrumbs::register( - 'accounts.edit', function (Generator $breadcrumbs, Account $account) { + 'accounts.edit', function (BreadCrumbGenerator $breadcrumbs, Account $account) { $breadcrumbs->parent('accounts.show', $account); $what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type); @@ -75,40 +75,40 @@ Breadcrumbs::register( // budgets. Breadcrumbs::register( - 'budgets.index', function (Generator $breadcrumbs) { + 'budgets.index', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('firefly.budgets'), route('budgets.index')); } ); Breadcrumbs::register( - 'budgets.create', function (Generator $breadcrumbs) { + 'budgets.create', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('budgets.index'); $breadcrumbs->push(trans('firefly.create_new_budget'), route('budgets.create')); } ); Breadcrumbs::register( - 'budgets.edit', function (Generator $breadcrumbs, Budget $budget) { + 'budgets.edit', function (BreadCrumbGenerator $breadcrumbs, Budget $budget) { $breadcrumbs->parent('budgets.show', $budget); $breadcrumbs->push(trans('firefly.edit_budget', ['name' => e($budget->name)]), route('budgets.edit', [$budget->id])); } ); Breadcrumbs::register( - 'budgets.delete', function (Generator $breadcrumbs, Budget $budget) { + 'budgets.delete', function (BreadCrumbGenerator $breadcrumbs, Budget $budget) { $breadcrumbs->parent('budgets.show', $budget); $breadcrumbs->push(trans('firefly.delete_budget', ['name' => e($budget->name)]), route('budgets.delete', [$budget->id])); } ); Breadcrumbs::register( - 'budgets.noBudget', function (Generator $breadcrumbs, $subTitle) { + 'budgets.noBudget', function (BreadCrumbGenerator $breadcrumbs, $subTitle) { $breadcrumbs->parent('budgets.index'); $breadcrumbs->push($subTitle, route('budgets.noBudget')); } ); Breadcrumbs::register( - 'budgets.show', function (Generator $breadcrumbs, Budget $budget, LimitRepetition $repetition = null) { + 'budgets.show', function (BreadCrumbGenerator $breadcrumbs, Budget $budget, LimitRepetition $repetition = null) { $breadcrumbs->parent('budgets.index'); $breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id])); if (!is_null($repetition) && !is_null($repetition->id)) { @@ -121,33 +121,33 @@ Breadcrumbs::register( // categories Breadcrumbs::register( - 'categories.index', function (Generator $breadcrumbs) { + 'categories.index', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('firefly.categories'), route('categories.index')); } ); Breadcrumbs::register( - 'categories.create', function (Generator $breadcrumbs) { + 'categories.create', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('categories.index'); $breadcrumbs->push(trans('firefly.new_category'), route('categories.create')); } ); Breadcrumbs::register( - 'categories.edit', function (Generator $breadcrumbs, Category $category) { + 'categories.edit', function (BreadCrumbGenerator $breadcrumbs, Category $category) { $breadcrumbs->parent('categories.show', $category); $breadcrumbs->push(trans('firefly.edit_category', ['name' => e($category->name)]), route('categories.edit', [$category->id])); } ); Breadcrumbs::register( - 'categories.delete', function (Generator $breadcrumbs, Category $category) { + 'categories.delete', function (BreadCrumbGenerator $breadcrumbs, Category $category) { $breadcrumbs->parent('categories.show', $category); $breadcrumbs->push(trans('firefly.delete_category', ['name' => e($category->name)]), route('categories.delete', [$category->id])); } ); Breadcrumbs::register( - 'categories.show', function (Generator $breadcrumbs, Category $category) { + 'categories.show', function (BreadCrumbGenerator $breadcrumbs, Category $category) { $breadcrumbs->parent('categories.index'); $breadcrumbs->push(e($category->name), route('categories.show', [$category->id])); @@ -155,7 +155,7 @@ Breadcrumbs::register( ); Breadcrumbs::register( - 'categories.show.date', function (Generator $breadcrumbs, Category $category, Carbon $date) { + 'categories.show.date', function (BreadCrumbGenerator $breadcrumbs, Category $category, Carbon $date) { // get current period preference. $range = Preferences::get('viewRange', '1M')->data; @@ -168,7 +168,7 @@ Breadcrumbs::register( ); Breadcrumbs::register( - 'categories.noCategory', function (Generator $breadcrumbs, $subTitle) { + 'categories.noCategory', function (BreadCrumbGenerator $breadcrumbs, $subTitle) { $breadcrumbs->parent('categories.index'); $breadcrumbs->push($subTitle, route('categories.noCategory')); } @@ -176,35 +176,35 @@ Breadcrumbs::register( // CSV: Breadcrumbs::register( - 'csv.index', function (Generator $breadcrumbs) { + 'csv.index', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('firefly.csv_index_title'), route('csv.index')); } ); Breadcrumbs::register( - 'csv.column-roles', function (Generator $breadcrumbs) { + 'csv.column-roles', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('csv.index'); $breadcrumbs->push(trans('firefly.csv_define_column_roles'), route('csv.column-roles')); } ); Breadcrumbs::register( - 'csv.map', function (Generator $breadcrumbs) { + 'csv.map', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('csv.index'); $breadcrumbs->push(trans('firefly.csv_map_values'), route('csv.map')); } ); Breadcrumbs::register( - 'csv.download-config-page', function (Generator $breadcrumbs) { + 'csv.download-config-page', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('csv.index'); $breadcrumbs->push(trans('firefly.csv_download_config'), route('csv.download-config-page')); } ); Breadcrumbs::register( - 'csv.process', function (Generator $breadcrumbs) { + 'csv.process', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('csv.index'); $breadcrumbs->push(trans('firefly.csv_process_title'), route('csv.process')); } @@ -213,27 +213,27 @@ Breadcrumbs::register( // currencies. Breadcrumbs::register( - 'currency.index', function (Generator $breadcrumbs) { + 'currency.index', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('firefly.currencies'), route('currency.index')); } ); Breadcrumbs::register( - 'currency.create', function (Generator $breadcrumbs) { + 'currency.create', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('currency.index'); $breadcrumbs->push(trans('firefly.create_currency'), route('currency.create')); } ); Breadcrumbs::register( - 'currency.edit', function (Generator $breadcrumbs, TransactionCurrency $currency) { + '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])); } ); Breadcrumbs::register( - 'currency.delete', function (Generator $breadcrumbs, TransactionCurrency $currency) { + '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])); } @@ -242,33 +242,33 @@ Breadcrumbs::register( // piggy banks Breadcrumbs::register( - 'piggy-banks.index', function (Generator $breadcrumbs) { + 'piggy-banks.index', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('firefly.piggyBanks'), route('piggy-banks.index')); } ); Breadcrumbs::register( - 'piggy-banks.create', function (Generator $breadcrumbs) { + 'piggy-banks.create', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('piggy-banks.index'); $breadcrumbs->push(trans('breadcrumbs.newPiggyBank'), route('piggy-banks.create')); } ); Breadcrumbs::register( - 'piggy-banks.edit', function (Generator $breadcrumbs, PiggyBank $piggyBank) { + 'piggy-banks.edit', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { $breadcrumbs->parent('piggy-banks.show', $piggyBank); $breadcrumbs->push(trans('breadcrumbs.edit_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.edit', [$piggyBank->id])); } ); Breadcrumbs::register( - 'piggy-banks.delete', function (Generator $breadcrumbs, PiggyBank $piggyBank) { + 'piggy-banks.delete', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { $breadcrumbs->parent('piggy-banks.show', $piggyBank); $breadcrumbs->push(trans('firefly.delete_piggy_bank', ['name' => e($piggyBank->name)]), route('piggy-banks.delete', [$piggyBank->id])); } ); Breadcrumbs::register( - 'piggy-banks.show', function (Generator $breadcrumbs, PiggyBank $piggyBank) { + 'piggy-banks.show', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { $breadcrumbs->parent('piggy-banks.index'); $breadcrumbs->push(e($piggyBank->name), route('piggy-banks.show', [$piggyBank->id])); @@ -277,7 +277,7 @@ Breadcrumbs::register( // preferences Breadcrumbs::register( - 'preferences', function (Generator $breadcrumbs) { + 'preferences', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('breadcrumbs.preferences'), route('preferences')); @@ -286,21 +286,21 @@ Breadcrumbs::register( // profile Breadcrumbs::register( - 'profile', function (Generator $breadcrumbs) { + 'profile', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('breadcrumbs.profile'), route('profile')); } ); Breadcrumbs::register( - 'profile.change-password', function (Generator $breadcrumbs) { + 'profile.change-password', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('profile'); $breadcrumbs->push(trans('breadcrumbs.changePassword'), route('profile.change-password')); } ); Breadcrumbs::register( - 'profile.delete-account', function (Generator $breadcrumbs) { + 'profile.delete-account', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('profile'); $breadcrumbs->push(trans('firefly.delete_account'), route('profile.delete-account')); @@ -309,33 +309,33 @@ Breadcrumbs::register( // bills Breadcrumbs::register( - 'bills.index', function (Generator $breadcrumbs) { + 'bills.index', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('breadcrumbs.bills'), route('bills.index')); } ); Breadcrumbs::register( - 'bills.create', function (Generator $breadcrumbs) { + 'bills.create', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('bills.index'); $breadcrumbs->push(trans('breadcrumbs.newBill'), route('bills.create')); } ); Breadcrumbs::register( - 'bills.edit', function (Generator $breadcrumbs, Bill $bill) { + 'bills.edit', function (BreadCrumbGenerator $breadcrumbs, Bill $bill) { $breadcrumbs->parent('bills.show', $bill); $breadcrumbs->push(trans('breadcrumbs.edit_bill', ['name' => e($bill->name)]), route('bills.edit', [$bill->id])); } ); Breadcrumbs::register( - 'bills.delete', function (Generator $breadcrumbs, Bill $bill) { + 'bills.delete', function (BreadCrumbGenerator $breadcrumbs, Bill $bill) { $breadcrumbs->parent('bills.show', $bill); $breadcrumbs->push(trans('breadcrumbs.delete_bill', ['name' => e($bill->name)]), route('bills.delete', [$bill->id])); } ); Breadcrumbs::register( - 'bills.show', function (Generator $breadcrumbs, Bill $bill) { + 'bills.show', function (BreadCrumbGenerator $breadcrumbs, Bill $bill) { $breadcrumbs->parent('bills.index'); $breadcrumbs->push(e($bill->name), route('bills.show', [$bill->id])); @@ -344,14 +344,14 @@ Breadcrumbs::register( // reports Breadcrumbs::register( - 'reports.index', function (Generator $breadcrumbs) { + 'reports.index', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('breadcrumbs.reports'), route('reports.index')); } ); Breadcrumbs::register( - 'reports.report', function (Generator $breadcrumbs, Carbon $start, Carbon $end, $reportType, $accountIds) { + 'reports.report', function (BreadCrumbGenerator $breadcrumbs, Carbon $start, Carbon $end, $reportType, $accountIds) { $breadcrumbs->parent('reports.index'); $monthFormat = trans('config.month_and_day'); @@ -363,7 +363,7 @@ Breadcrumbs::register( // search Breadcrumbs::register( - 'search', function (Generator $breadcrumbs, $query) { + 'search', function (BreadCrumbGenerator $breadcrumbs, $query) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('breadcrumbs.searchResult', ['query' => e($query)]), route('search')); } @@ -371,33 +371,33 @@ Breadcrumbs::register( // transactions Breadcrumbs::register( - 'transactions.index', function (Generator $breadcrumbs, $what) { + 'transactions.index', function (BreadCrumbGenerator $breadcrumbs, $what) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', [$what])); } ); Breadcrumbs::register( - 'transactions.create', function (Generator $breadcrumbs, $what) { + 'transactions.create', function (BreadCrumbGenerator $breadcrumbs, $what) { $breadcrumbs->parent('transactions.index', $what); $breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('transactions.create', [$what])); } ); Breadcrumbs::register( - 'transactions.edit', function (Generator $breadcrumbs, TransactionJournal $journal) { + 'transactions.edit', function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) { $breadcrumbs->parent('transactions.show', $journal); $breadcrumbs->push(trans('breadcrumbs.edit_journal', ['description' => $journal->description]), route('transactions.edit', [$journal->id])); } ); Breadcrumbs::register( - 'transactions.delete', function (Generator $breadcrumbs, TransactionJournal $journal) { + 'transactions.delete', function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) { $breadcrumbs->parent('transactions.show', $journal); $breadcrumbs->push(trans('breadcrumbs.delete_journal', ['description' => e($journal->description)]), route('transactions.delete', [$journal->id])); } ); Breadcrumbs::register( - 'transactions.show', function (Generator $breadcrumbs, TransactionJournal $journal) { + 'transactions.show', function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) { $breadcrumbs->parent('transactions.index', strtolower($journal->getTransactionType())); $breadcrumbs->push($journal->description, route('transactions.show', [$journal->id])); @@ -407,28 +407,28 @@ Breadcrumbs::register( // tags Breadcrumbs::register( - 'tags.index', function (Generator $breadcrumbs) { + 'tags.index', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('home'); $breadcrumbs->push(trans('breadcrumbs.tags'), route('tags.index')); } ); Breadcrumbs::register( - 'tags.create', function (Generator $breadcrumbs) { + 'tags.create', function (BreadCrumbGenerator $breadcrumbs) { $breadcrumbs->parent('tags.index'); $breadcrumbs->push(trans('breadcrumbs.createTag'), route('tags.create')); } ); Breadcrumbs::register( - 'tags.edit', function (Generator $breadcrumbs, Tag $tag) { + 'tags.edit', function (BreadCrumbGenerator $breadcrumbs, Tag $tag) { $breadcrumbs->parent('tags.show', $tag); $breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => e($tag->tag)]), route('tags.edit', [$tag->id])); } ); Breadcrumbs::register( - 'tags.delete', function (Generator $breadcrumbs, Tag $tag) { + 'tags.delete', function (BreadCrumbGenerator $breadcrumbs, Tag $tag) { $breadcrumbs->parent('tags.show', $tag); $breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]), route('tags.delete', [$tag->id])); } @@ -436,7 +436,7 @@ Breadcrumbs::register( Breadcrumbs::register( - 'tags.show', function (Generator $breadcrumbs, Tag $tag) { + 'tags.show', function (BreadCrumbGenerator $breadcrumbs, Tag $tag) { $breadcrumbs->parent('tags.index'); $breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id])); } diff --git a/app/Http/routes.php b/app/Http/routes.php index 8b2917884f..ac043af6f3 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -30,7 +30,7 @@ Route::bind( throw new NotFoundHttpException; } ); -// account list! Yay! +// accounts Route::bind( 'accountList', function ($value) { diff --git a/app/Models/Bill.php b/app/Models/Bill.php index db88700e82..7f93843fa6 100644 --- a/app/Models/Bill.php +++ b/app/Models/Bill.php @@ -41,6 +41,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereMatchEncrypted($value) * @property \Carbon\Carbon $nextExpectedMatch * @property \Carbon\Carbon $lastFoundMatch + * @property-read string $expectedAmount */ class Bill extends Model { diff --git a/app/Models/Budget.php b/app/Models/Budget.php index 5184b576e6..07e7b146ee 100644 --- a/app/Models/Budget.php +++ b/app/Models/Budget.php @@ -78,7 +78,7 @@ class Budget extends Model */ public function getDates() { - return ['created_at', 'updated_at', 'deleted_at']; + return ['created_at', 'updated_at', 'deleted_at', 'startdate', 'enddate']; } /** diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php index 0678ea5865..a06e3dd35a 100644 --- a/app/Models/PiggyBankEvent.php +++ b/app/Models/PiggyBankEvent.php @@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\Model; * @property integer $transaction_journal_id * @property \Carbon\Carbon $date * @property float $amount - * @property-read \FireflyIII\Models\PiggyBank $piggyBank + * @property \FireflyIII\Models\PiggyBank $piggyBank * @property-read \FireflyIII\Models\TransactionJournal $transactionJournal * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereCreatedAt($value) diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 8d6c54af42..dcd9a867f1 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -16,7 +16,6 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\Support\CacheProperties; use Illuminate\Database\Eloquent\Relations\HasMany; -use Illuminate\Database\Query\Builder; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; use Log; @@ -118,7 +117,13 @@ class AccountRepository implements AccountRepositoryInterface */ public function getCreditCards(Carbon $date) { - return Auth::user()->accounts() + $cache = new CacheProperties(); + $cache->addProperty('user-credit-cards'); + if ($cache->has()) { + return $cache->get(); + } + + $set = Auth::user()->accounts() ->hasMetaValue('accountRole', 'ccAsset') ->hasMetaValue('ccType', 'monthlyFull') ->leftJoin('transactions', 'transactions.account_id', '=', 'accounts.id') @@ -134,6 +139,9 @@ class AccountRepository implements AccountRepositoryInterface DB::Raw('SUM(`transactions`.`amount`) AS `balance`') ] ); + $cache->store($set); + + return $set; } /** @@ -353,36 +361,6 @@ class AccountRepository implements AccountRepositoryInterface return $accounts; } - /** - * Get all transfers TO this account in this range. - * - * @param Account $account - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function getTransfersInRange(Account $account, Carbon $start, Carbon $end) - { - $set = TransactionJournal::whereIn( - 'id', function (Builder $q) use ($account, $start, $end) { - $q->select('transaction_journals.id') - ->from('transactions') - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->where('transactions.account_id', $account->id) - ->where('transactions.amount', '>', 0)// this makes the filter unnecessary. - ->where('transaction_journals.user_id', Auth::user()->id) - ->where('transaction_journals.date', '>=', $start->format('Y-m-d')) - ->where('transaction_journals.date', '<=', $end->format('Y-m-d')) - ->where('transaction_types.type', TransactionType::TRANSFER); - - } - )->get(); - - return $set; - } - /** * @param Account $account * @param Carbon $date diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index bb7b5e0c8f..d03cf070e6 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -76,18 +76,6 @@ interface AccountRepositoryInterface */ public function getPiggyBankAccounts(); - - /** - * Get all transfers TO this account in this range. - * - * @param Account $account - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function getTransfersInRange(Account $account, Carbon $start, Carbon $end); - /** * @param Preference $preference * diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index ded8eba0ec..1e08433502 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -9,11 +9,14 @@ use FireflyIII\Models\Account; use FireflyIII\Models\Bill; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; +use FireflyIII\Models\TransactionType; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use FireflyIII\Support\CacheProperties; +use Illuminate\Database\Query\Builder; use Illuminate\Database\Query\JoinClause; use Illuminate\Support\Collection; use Log; use Navigation; -use Steam; /** * Class BillRepository @@ -22,53 +25,6 @@ use Steam; */ class BillRepository implements BillRepositoryInterface { - /** - * @deprecated - * Returns the sum of all payments connected to this bill between the dates. - * - * @param Bill $bill - * @param Carbon $start - * @param Carbon $end - * - * @return integer - */ - public function billPaymentsInRange(Bill $bill, Carbon $start, Carbon $end) - { - $amount = 0; - $journals = $bill->transactionjournals()->before($end)->after($start)->get(); - /** @var TransactionJournal $journal */ - foreach ($journals as $journal) { - $amount += $journal->amount; - } - - return $amount; - } - - - /** - * Create a fake bill to help the chart controller. - * - * @param string $description - * @param Carbon $date - * @param float $amount - * - * @return Bill - */ - public function createFakeBill($description, Carbon $date, $amount) - { - $bill = new Bill; - $bill->name = $description; - $bill->match = $description; - $bill->amount_min = $amount; - $bill->amount_max = $amount; - $bill->date = $date; - $bill->repeat_freq = 'monthly'; - $bill->skip = 0; - $bill->automatch = false; - $bill->active = false; - - return $bill; - } /** * @param Bill $bill @@ -80,16 +36,6 @@ class BillRepository implements BillRepositoryInterface return $bill->delete(); } - /** - * @return Collection - */ - public function getActiveBills() - { - /** @var Collection $set */ - $set = Auth::user()->bills()->where('active', 1)->get()->sortBy('name'); - - return $set; - } /** * @return Collection @@ -130,7 +76,7 @@ class BillRepository implements BillRepositoryInterface $set = $set->filter( function (Bill $bill) use ($ids) { // get transaction journals from or to any of the mentioned accounts. - // if zero, return null. + // when zero, return null. $journals = $bill->transactionjournals()->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') ->whereIn('transactions.account_id', $ids)->count(); @@ -152,22 +98,43 @@ class BillRepository implements BillRepositoryInterface } /** + * This method also returns the amount of the journal in "journalAmount" + * for easy access. + * * @param Bill $bill * * @return Collection */ public function getJournals(Bill $bill) { - return $bill->transactionjournals()->withRelevantData() + $cache = new CacheProperties; + $cache->addProperty($bill->id); + $cache->addProperty('journals-for-bill'); + if ($cache->has()) { + return $cache->get(); // @codeCoverageIgnore + } + + $set = $bill->transactionjournals() + ->leftJoin( + 'transactions', function (JoinClause $join) { + $join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('amount', '<', 0); + } + ) ->orderBy('transaction_journals.date', 'DESC') ->orderBy('transaction_journals.order', 'ASC') ->orderBy('transaction_journals.id', 'DESC') - ->get(['transaction_journals.*']); + ->get(['transaction_journals.*', 'transactions.amount as journalAmount']); + $cache->store($set); + + return $set; } /** * Get all journals that were recorded on this bill between these dates. * + * @deprecated + * * @param Bill $bill * @param Carbon $start * @param Carbon $end @@ -448,109 +415,166 @@ class BillRepository implements BillRepositoryInterface } /** - * Gets a collection of paid bills and a collection of unpaid bills to be used - * in the pie chart on the front page. + * Get the total amount of money paid for the users active bills in the date range given. + * This amount will be negative (they're expenses). * * @param Carbon $start * @param Carbon $end * - * @return Collection + * @return string */ - public function getBillsForChart(Carbon $start, Carbon $end) + public function getBillsPaidInRange(Carbon $start, Carbon $end) { - $paid = new Collection; - $unpaid = new Collection; + $cache = new CacheProperties; + $cache->addProperty($start); + $cache->addProperty($end); + $cache->addProperty('bills-paid-in-range'); + if ($cache->has()) { + return $cache->get(); // @codeCoverageIgnore + } + $amount = '0'; + $bills = $this->getActiveBills(); - $bills = $this->getActiveBills(); /** @var Bill $bill */ foreach ($bills as $bill) { $ranges = $this->getRanges($bill, $start, $end); foreach ($ranges as $range) { - // paid a bill in this range? - $journals = $this->getJournalsInRange($bill, $range['start'], $range['end']); - if ($journals->count() == 0) { - $unpaid->push([$bill, $range['start']]); - } else { - $paid = $paid->merge($journals); - } - + $paid = $bill->transactionjournals() + ->before($range['end']) + ->after($range['start']) + ->leftJoin( + 'transactions', function (JoinClause $join) { + $join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '<', 0); + } + ) + ->first([DB::Raw('SUM(`transactions`.`amount`) as `sum_amount`')]); + $amount = bcadd($amount, $paid->sum_amount); } } - $set = new Collection; - $set->put('paid', $paid); - $set->put('unpaid', $unpaid); + $cache->store($amount); - return $set; + return $amount; } /** - * Takes the paid/unpaid bills collection set up before and expands it using - * credit cards the user might have. - * - * @param Collection $set - * @param Carbon $start - * @param Carbon $end - * * @return Collection */ - public function getCreditCardInfoForChart(Collection $set, Carbon $start, Carbon $end) + public function getActiveBills() { - - $accounts = app('FireflyIII\Repositories\Account\AccountRepositoryInterface'); - $creditCards = $accounts->getCreditCards($end); - $paid = $set->get('paid'); - $unpaid = $set->get('unpaid'); - - foreach ($creditCards as $creditCard) { - $date = new Carbon($creditCard->getMeta('ccMonthlyPaymentDate')); - if ($creditCard->balance < 0) { - // unpaid! create a fake bill that matches the amount. - $description = $creditCard->name; - $amount = $creditCard->balance * -1; - $fakeBill = $this->createFakeBill($description, $date, $amount); - unset($description, $amount); - $unpaid->push([$fakeBill, $date]); - } - if ($creditCard->balance == 0) { - // find transfer(s) TO the credit card which should account for - // anything paid. If not, the CC is not yet used. - $journals = $accounts->getTransfersInRange($creditCard, $start, $end); - $paid = $paid->merge($journals); - } - } - $set = new Collection; - $set->put('paid', $paid); - $set->put('unpaid', $unpaid); + /** @var Collection $set */ + $set = Auth::user()->bills() + ->where('active', 1) + ->get( + [ + 'bills.*', + DB::Raw('(`bills`.`amount_min` + `bills`.`amount_max` / 2) as `expectedAmount`') + ] + )->sortBy('name'); return $set; } + /** - * This method returns all active bills which have been paid for in the given range, - * with the field "paid" indicating how much the bill was for. + * Get the total amount of money due for the users active bills in the date range given. This amount will be positive. * * @param Carbon $start * @param Carbon $end * - * @return Collection + * @return string */ - public function billsPaidInRange(Carbon $start, Carbon $end) + public function getBillsUnpaidInRange(Carbon $start, Carbon $end) { - $set = Auth::user()->bills() - ->leftJoin('transaction_journals', 'transaction_journals.bill_id', '=', 'bills.id') - ->leftJoin( - 'transactions', function (JoinClause $join) { - $join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '>', 0); - } - ) - ->where('transaction_journals.date', '>=', $start->format('Y-m-d')) - ->where('transaction_journals.date', '<=', $end->format('Y-m-d')) - ->where('bills.active', 1) - ->groupBy('bills.id')->get( - ['bills.*', DB::Raw('SUM(`transactions`.`amount`) as `paid`')] - ); + $cache = new CacheProperties; + $cache->addProperty($start); + $cache->addProperty($end); + $cache->addProperty('bills-unpaid-in-range'); + if ($cache->has()) { + return $cache->get(); // @codeCoverageIgnore + } + $amount = '0'; + $bills = $this->getActiveBills(); + + /** @var Bill $bill */ + foreach ($bills as $bill) { + $ranges = $this->getRanges($bill, $start, $end); + $paidBill = '0'; + foreach ($ranges as $range) { + $paid = $bill->transactionjournals() + ->before($range['end']) + ->after($range['start']) + ->leftJoin( + 'transactions', function (JoinClause $join) { + $join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '>', 0); + } + ) + ->first([DB::Raw('SUM(`transactions`.`amount`) as `sum_amount`')]); + $paidBill = bcadd($paid->sum_amount, $paidBill); + } + if ($paidBill == 0) { + $amount = bcadd($amount, $bill->expectedAmount); + } + } + $cache->store($amount); + + return $amount; + } + + /** + * This method will tell you if you still have a CC bill to pay. Amount will be positive if the amount + * has been paid, otherwise it will be negative. + * + * @param Carbon $start + * @param Carbon $end + * + * @return string + */ + public function getCreditCardBill(Carbon $start, Carbon $end) + { + + $cache = new CacheProperties; + $cache->addProperty($start); + $cache->addProperty($end); + $cache->addProperty('credit-card-bill'); + if ($cache->has()) { + return $cache->get(); // @codeCoverageIgnore + } + /** @var AccountRepositoryInterface $accountRepository */ + $accountRepository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface'); + $amount = '0'; + $creditCards = $accountRepository->getCreditCards($end); // Find credit card accounts and possibly unpaid credit card bills. + /** @var Account $creditCard */ + foreach ($creditCards as $creditCard) { + if ($creditCard->balance == 0) { + // find a transfer TO the credit card which should account for + // anything paid. If not, the CC is not yet used. + $set = TransactionJournal::whereIn( + 'transaction_journals.id', function (Builder $q) use ($creditCard, $start, $end) { + $q->select('transaction_journals.id') + ->from('transactions') + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') + ->where('transactions.account_id', $creditCard->id) + ->where('transactions.amount', '>', 0)// this makes the filter unnecessary. + ->where('transaction_journals.user_id', Auth::user()->id) + ->where('transaction_journals.date', '>=', $start->format('Y-m-d')) + ->where('transaction_journals.date', '<=', $end->format('Y-m-d')) + ->where('transaction_types.type', TransactionType::TRANSFER); + } + )->leftJoin( + 'transactions', function (JoinClause $join) { + $join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '>', 0); + } + )->first([DB::Raw('SUM(`transactions`.`amount`) as `sum_amount`')]); + + $amount = bcadd($amount, $set->sum_amount); + } else { + $amount = bcadd($amount, $creditCard->balance); + } + } + + return $amount; - return $set; } } diff --git a/app/Repositories/Bill/BillRepositoryInterface.php b/app/Repositories/Bill/BillRepositoryInterface.php index 841259db84..d171aedcdb 100644 --- a/app/Repositories/Bill/BillRepositoryInterface.php +++ b/app/Repositories/Bill/BillRepositoryInterface.php @@ -16,61 +16,41 @@ interface BillRepositoryInterface { /** - * Takes the paid/unpaid bills collection set up before and expands it using - * credit cards the user might have. - * - * @param Collection $set - * @param Carbon $start - * @param Carbon $end - * - * @return Collection - */ - public function getCreditCardInfoForChart(Collection $set, Carbon $start, Carbon $end); - - /** - * Gets a collection of paid bills and a collection of unpaid bills to be used - * in the pie chart on the front page. + * This method will tell you if you still have a CC bill to pay. Amount will be negative if the amount + * has been paid * * @param Carbon $start * @param Carbon $end * - * @return Collection + * @return string */ - public function getBillsForChart(Carbon $start, Carbon $end); + public function getCreditCardBill(Carbon $start, Carbon $end); /** - * @deprecated - * Returns the sum of all payments connected to this bill between the dates. - * - * @param Bill $bill - * @param Carbon $start - * @param Carbon $end - * - * @return float - */ - public function billPaymentsInRange(Bill $bill, Carbon $start, Carbon $end); - - /** - * This method returns all active bills which have been paid for in the given range, - * with the field "paid" indicating how much the bill was for. + * Get the total amount of money paid for the users active bills in the date range given. * * @param Carbon $start * @param Carbon $end * - * @return Collection + * @return string */ - public function billsPaidInRange(Carbon $start, Carbon $end); + public function getBillsPaidInRange(Carbon $start, Carbon $end); /** - * Create a fake bill to help the chart controller. + * Get the total amount of money due for the users active bills in the date range given. * - * @param string $description - * @param Carbon $date - * @param float $amount + * @param Carbon $start + * @param Carbon $end * - * @return Bill + * @return string */ - public function createFakeBill($description, Carbon $date, $amount); + public function getBillsUnpaidInRange(Carbon $start, Carbon $end); + + /** + * @return Collection + */ + public function getActiveBills(); + /** * @param Bill $bill @@ -79,11 +59,6 @@ interface BillRepositoryInterface */ public function destroy(Bill $bill); - /** - * @return Collection - */ - public function getActiveBills(); - /** * @return Collection */ @@ -126,7 +101,7 @@ interface BillRepositoryInterface /** * Every bill repeats itself weekly, monthly or yearly (or whatever). This method takes a date-range (usually the view-range of Firefly itself) * and returns date ranges that fall within the given range; those ranges are the bills expected. When a bill is due on the 14th of the month and - * you give 1st and the 31st of that month as argument, you'll get one response, matching the range of your bill. + * you give 1st and the 31st of that month as argument, you'll get one response, matching the range of your bill (from the 14th to the 31th). * * @param Bill $bill * @param Carbon $start diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 2338cc8436..a38cd42261 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -4,13 +4,16 @@ namespace FireflyIII\Repositories\Budget; use Auth; use Carbon\Carbon; +use DB; use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\LimitRepetition; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Shared\ComponentRepository; use FireflyIII\Support\CacheProperties; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Query\Builder as QueryBuilder; +use Illuminate\Database\Query\JoinClause; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; use Input; @@ -76,6 +79,50 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn return $set; } + /** + * Returns a list of budgets, budget limits and limit repetitions + * (doubling any of them in a left join) + * + * @param Carbon $start + * @param Carbon $end + * + * @return Collection + */ + public function getBudgetsAndLimitsInRange(Carbon $start, Carbon $end) + { + /** @var Collection $set */ + $set = Auth::user() + ->budgets() + ->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budgets.id') + ->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id') + ->where( + function (Builder $query) use ($start, $end) { + $query->where( + function (Builder $query) use ($start, $end) { + $query->where('limit_repetitions.startdate', '>=', $start->format('Y-m-d')); + $query->where('limit_repetitions.startdate', '<=', $end->format('Y-m-d')); + } + ); + $query->orWhere( + function (Builder $query) { + $query->whereNull('limit_repetitions.startdate'); + $query->whereNull('limit_repetitions.enddate'); + } + ); + } + ) + ->get(['budgets.*', 'limit_repetitions.startdate', 'limit_repetitions.enddate', 'limit_repetitions.amount']); + + $set = $set->sortBy( + function (Budget $budget) { + return strtolower($budget->name); + } + ); + + return $set; + + } + /** * @param Budget $budget * @param Carbon $start @@ -143,8 +190,6 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn ->where('limit_repetitions.startdate', $start->format('Y-m-d 00:00:00')) ->where('limit_repetitions.enddate', $end->format('Y-m-d 00:00:00')) ->first(['limit_repetitions.*']); - //Log::debug('Looking for limit reps for budget #' . $budget->id . ' start [' . $start . '] and end [' . $end . '].'); - //Log::debug(DB::getQueryLog()) $cache->store($data); return $data; @@ -247,6 +292,7 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn /** * @deprecated + * * @param Budget $budget * @param Carbon $date * @@ -294,25 +340,30 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn */ public function getWithoutBudgetSum(Carbon $start, Carbon $end) { - $noBudgetSet = Auth::user() - ->transactionjournals() - ->whereNotIn( - 'transaction_journals.id', function (QueryBuilder $query) use ($start, $end) { - $query - ->select('transaction_journals.id') - ->from('transaction_journals') - ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00')) - ->where('transaction_journals.date', '<=', $end->format('Y-m-d 00:00:00')) - ->whereNotNull('budget_transaction_journal.budget_id'); - } - ) - ->after($start) - ->before($end) - ->transactionTypes([TransactionType::WITHDRAWAL]) - ->get(['transaction_journals.*'])->sum('amount'); + $entry = Auth::user() + ->transactionjournals() + ->whereNotIn( + 'transaction_journals.id', function (QueryBuilder $query) use ($start, $end) { + $query + ->select('transaction_journals.id') + ->from('transaction_journals') + ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00')) + ->where('transaction_journals.date', '<=', $end->format('Y-m-d 00:00:00')) + ->whereNotNull('budget_transaction_journal.budget_id'); + } + ) + ->after($start) + ->before($end) + ->leftJoin( + 'transactions', function (JoinClause $join) { + $join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '<', 0); + } + ) + ->transactionTypes([TransactionType::WITHDRAWAL]) + ->first([DB::Raw('SUM(`transactions`.`amount`) as `journalAmount`')]); - return $noBudgetSet; + return $entry->journalAmount; } /** diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php index 2e886960bf..9ac42a85be 100644 --- a/app/Repositories/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetRepositoryInterface.php @@ -63,6 +63,17 @@ interface BudgetRepositoryInterface */ public function getBudgets(); + /** + * Returns a list of budgets, budget limits and limit repetitions + * (doubling any of them in a left join) + * + * @param Carbon $start + * @param Carbon $end + * + * @return Collection + */ + public function getBudgetsAndLimitsInRange(Carbon $start, Carbon $end); + /** * @param Budget $budget * @param Carbon $start @@ -97,6 +108,7 @@ interface BudgetRepositoryInterface /** * @deprecated + * * @param Budget $budget * * @return Carbon @@ -105,6 +117,7 @@ interface BudgetRepositoryInterface /** * @deprecated + * * @param Budget $budget * @param Carbon $date * diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 8a94d61781..bf8eb047af 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -53,7 +53,7 @@ class CategoryRepository extends ComponentRepository implements CategoryReposito $cache = new CacheProperties; $cache->addProperty('category-list'); - if($cache->has()) { + if ($cache->has()) { return $cache->get(); } @@ -346,8 +346,6 @@ class CategoryRepository extends ComponentRepository implements CategoryReposito * @param \Carbon\Carbon $start * @param \Carbon\Carbon $end * - * @param bool $shared - * * @return string */ public function spentInPeriod(Category $category, Carbon $start, Carbon $end) @@ -377,8 +375,6 @@ class CategoryRepository extends ComponentRepository implements CategoryReposito * @param \Carbon\Carbon $start * @param \Carbon\Carbon $end * - * @param bool $shared - * * @return string */ public function earnedInPeriod(Category $category, Carbon $start, Carbon $end) @@ -403,11 +399,14 @@ class CategoryRepository extends ComponentRepository implements CategoryReposito return $sum; } + /** * @param Category $category * @param int $page + * @param Carbon $start + * @param Carbon $end * - * @return Collection + * @return mixed */ public function getJournalsInRange(Category $category, $page, Carbon $start, Carbon $end) { @@ -428,6 +427,9 @@ class CategoryRepository extends ComponentRepository implements CategoryReposito /** * @param Category $category * + * @param Carbon $start + * @param Carbon $end + * * @return int */ public function countJournalsInRange(Category $category, Carbon $start, Carbon $end) diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.php index 60cd43a755..34553e7ea3 100644 --- a/app/Repositories/Category/CategoryRepositoryInterface.php +++ b/app/Repositories/Category/CategoryRepositoryInterface.php @@ -23,6 +23,9 @@ interface CategoryRepositoryInterface /** * @param Category $category * + * @param Carbon $start + * @param Carbon $end + * * @return int */ public function countJournalsInRange(Category $category, Carbon $start, Carbon $end); @@ -141,6 +144,9 @@ interface CategoryRepositoryInterface * @param Category $category * @param int $page * + * @param Carbon $start + * @param Carbon $end + * * @return Collection */ public function getJournalsInRange(Category $category, $page, Carbon $start, Carbon $end); @@ -190,8 +196,6 @@ interface CategoryRepositoryInterface * @param \Carbon\Carbon $start * @param \Carbon\Carbon $end * - * @param bool $shared - * * @return string */ public function spentInPeriod(Category $category, Carbon $start, Carbon $end); @@ -201,8 +205,6 @@ interface CategoryRepositoryInterface * @param \Carbon\Carbon $start * @param \Carbon\Carbon $end * - * @param bool $shared - * * @return string */ public function earnedInPeriod(Category $category, Carbon $start, Carbon $end); diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index b9015e99ba..0f3cc946ea 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -172,12 +172,12 @@ class JournalRepository implements JournalRepositoryInterface // store actual journal. $journal = new TransactionJournal( [ - 'user_id' => $data['user'], - 'transaction_type_id' => $transactionType->id, - 'transaction_currency_id' => $data['amount_currency_id_amount'], - 'description' => $data['description'], - 'completed' => 0, - 'date' => $data['date'], + 'user_id' => $data['user'], + 'transaction_type_id' => $transactionType->id, + 'amount_currency_id_amount' => $data['amount_currency_id_amount'], + 'description' => $data['description'], + 'completed' => 0, + 'date' => $data['date'], ] ); $journal->save(); @@ -236,7 +236,7 @@ class JournalRepository implements JournalRepositoryInterface public function update(TransactionJournal $journal, array $data) { // update actual journal. - $journal->transaction_currency_id = $data['amount_currency_id']; + $journal->transaction_currency_id = $data['amount_currency_id_amount']; $journal->description = $data['description']; $journal->date = $data['date']; diff --git a/app/Repositories/Shared/ComponentRepository.php b/app/Repositories/Shared/ComponentRepository.php index 8a198fe14a..f9584ef72d 100644 --- a/app/Repositories/Shared/ComponentRepository.php +++ b/app/Repositories/Shared/ComponentRepository.php @@ -3,10 +3,10 @@ namespace FireflyIII\Repositories\Shared; use Carbon\Carbon; +use DB; use FireflyIII\Models\Account; use FireflyIII\Models\TransactionType; use FireflyIII\Support\CacheProperties; -use Illuminate\Database\Query\JoinClause; use Illuminate\Support\Collection; /** @@ -35,27 +35,29 @@ class ComponentRepository $cache->addProperty($accounts); $cache->addProperty('balanceInPeriodList'); + if ($cache->has()) { + return $cache->get(); // @codeCoverageIgnore + } + $ids = []; /** @var Account $account */ foreach ($accounts as $account) { $ids[] = $account->id; } - if ($cache->has()) { - return $cache->get(); // @codeCoverageIgnore - } - $sum = $object->transactionjournals() - ->transactionTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::OPENING_BALANCE]) - ->before($end) - ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') - ->whereIn('accounts.id', $ids) - ->after($start) - ->get(['transaction_journals.*'])->sum('amount'); + $entry = $object->transactionjournals() + ->transactionTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::OPENING_BALANCE]) + ->before($end) + ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') + ->whereIn('accounts.id', $ids) + ->after($start) + ->first([DB::Raw('SUM(`transactions`.`amount`) as `journalAmount`')]); + $amount = $entry->journalAmount; - $cache->store($sum); + $cache->store($amount); - return $sum; + return $amount; } } diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 8a1118ac6f..4b711f18e3 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -76,10 +76,11 @@ class Steam * Gets the balance for the given account during the whole range, using this format: * * [yyyy-mm-dd] => 123,2 - * * @param Account $account * @param Carbon $start * @param Carbon $end + * + * @return array */ public function balanceInRange(Account $account, Carbon $start, Carbon $end) { diff --git a/composer.json b/composer.json index 58e3d29a20..3e12f62800 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "doctrine/dbal": "~2.5", "illuminate/html": "~5.0", "league/commonmark": "~0.7", - "rcrowe/twigbridge": "0.7.x@dev", + "rcrowe/twigbridge": "~0.9", "zizaco/entrust": "dev-laravel-5", "league/csv": "^7.1" }, diff --git a/composer.lock b/composer.lock index 3c22531a9a..262eefd6f6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "79e0f94d7571803d13e30aa48111b1ab", - "content-hash": "968497c3098b5a38109e66c170c8becd", + "hash": "4fc3975430321d76dd859916a9dcbfb0", + "content-hash": "ad9d33604e0a88fabea148474769942d", "packages": [ { "name": "classpreloader/classpreloader", @@ -269,16 +269,16 @@ }, { "name": "doctrine/cache", - "version": "v1.5.2", + "version": "v1.5.4", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "47c7128262da274f590ae6f86eb137a7a64e82af" + "reference": "47cdc76ceb95cc591d9c79a36dc3794975b5d136" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/47c7128262da274f590ae6f86eb137a7a64e82af", - "reference": "47c7128262da274f590ae6f86eb137a7a64e82af", + "url": "https://api.github.com/repos/doctrine/cache/zipball/47cdc76ceb95cc591d9c79a36dc3794975b5d136", + "reference": "47cdc76ceb95cc591d9c79a36dc3794975b5d136", "shasum": "" }, "require": { @@ -335,7 +335,7 @@ "cache", "caching" ], - "time": "2015-12-03 10:50:37" + "time": "2015-12-19 05:03:47" }, { "name": "doctrine/collections", @@ -405,16 +405,16 @@ }, { "name": "doctrine/common", - "version": "v2.5.2", + "version": "v2.6.1", "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "311001fd9865a4d0d59efff4eac6d7dcb3f5270c" + "reference": "a579557bc689580c19fee4e27487a67fe60defc0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/311001fd9865a4d0d59efff4eac6d7dcb3f5270c", - "reference": "311001fd9865a4d0d59efff4eac6d7dcb3f5270c", + "url": "https://api.github.com/repos/doctrine/common/zipball/a579557bc689580c19fee4e27487a67fe60defc0", + "reference": "a579557bc689580c19fee4e27487a67fe60defc0", "shasum": "" }, "require": { @@ -423,20 +423,20 @@ "doctrine/collections": "1.*", "doctrine/inflector": "1.*", "doctrine/lexer": "1.*", - "php": ">=5.3.2" + "php": "~5.5|~7.0" }, "require-dev": { - "phpunit/phpunit": "~3.7" + "phpunit/phpunit": "~4.8|~5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5.x-dev" + "dev-master": "2.7.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\": "lib/" + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" } }, "notification-url": "https://packagist.org/downloads/", @@ -474,24 +474,24 @@ "persistence", "spl" ], - "time": "2015-12-04 12:49:42" + "time": "2015-12-25 13:18:31" }, { "name": "doctrine/dbal", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c" + "reference": "2fbcea96eae34a53183377cdbb0b9bec33974648" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/01dbcbc5cd0a913d751418e635434a18a2f2a75c", - "reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/2fbcea96eae34a53183377cdbb0b9bec33974648", + "reference": "2fbcea96eae34a53183377cdbb0b9bec33974648", "shasum": "" }, "require": { - "doctrine/common": ">=2.4,<2.6-dev", + "doctrine/common": ">=2.4,<2.7-dev", "php": ">=5.3.2" }, "require-dev": { @@ -545,7 +545,7 @@ "persistence", "queryobject" ], - "time": "2015-09-16 16:29:33" + "time": "2015-12-25 16:28:24" }, { "name": "doctrine/inflector", @@ -1148,16 +1148,16 @@ }, { "name": "league/flysystem", - "version": "1.0.15", + "version": "1.0.16", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "31525caf9e8772683672fefd8a1ca0c0736020f4" + "reference": "183e1a610664baf6dcd6fceda415baf43cbdc031" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/31525caf9e8772683672fefd8a1ca0c0736020f4", - "reference": "31525caf9e8772683672fefd8a1ca0c0736020f4", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/183e1a610664baf6dcd6fceda415baf43cbdc031", + "reference": "183e1a610664baf6dcd6fceda415baf43cbdc031", "shasum": "" }, "require": { @@ -1171,7 +1171,7 @@ "mockery/mockery": "~0.9", "phpspec/phpspec": "^2.2", "phpspec/prophecy-phpunit": "~1.0", - "phpunit/phpunit": "~4.1" + "phpunit/phpunit": "~4.8" }, "suggest": { "ext-fileinfo": "Required for MimeType", @@ -1228,7 +1228,7 @@ "sftp", "storage" ], - "time": "2015-09-30 22:26:59" + "time": "2015-12-19 20:16:43" }, { "name": "monolog/monolog", @@ -1609,21 +1609,21 @@ }, { "name": "rcrowe/twigbridge", - "version": "dev-master", + "version": "v0.9.1", "source": { "type": "git", "url": "https://github.com/rcrowe/TwigBridge.git", - "reference": "0e2693d99745eb8bbd01a80e841951c0738e1d15" + "reference": "634c4d12fc3dc633d202341b7a29a107f77a67da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rcrowe/TwigBridge/zipball/0e2693d99745eb8bbd01a80e841951c0738e1d15", - "reference": "0e2693d99745eb8bbd01a80e841951c0738e1d15", + "url": "https://api.github.com/repos/rcrowe/TwigBridge/zipball/634c4d12fc3dc633d202341b7a29a107f77a67da", + "reference": "634c4d12fc3dc633d202341b7a29a107f77a67da", "shasum": "" }, "require": { - "illuminate/support": "5.0.*|5.1.*", - "illuminate/view": "5.0.*|5.1.*", + "illuminate/support": "5.0.*|5.1.*|5.2.*", + "illuminate/view": "5.0.*|5.1.*|5.2.*", "php": ">=5.4.0", "twig/twig": "~1.15|~2.0" }, @@ -1641,7 +1641,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.7-dev" + "dev-master": "0.10-dev" } }, "autoload": { @@ -1669,7 +1669,7 @@ "laravel", "twig" ], - "time": "2015-05-21 13:46:00" + "time": "2015-12-21 22:03:34" }, { "name": "swiftmailer/swiftmailer", @@ -1726,16 +1726,16 @@ }, { "name": "symfony/console", - "version": "v2.7.7", + "version": "v2.7.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "16bb1cb86df43c90931df65f529e7ebd79636750" + "reference": "4e35a78f932a4c07bd349efea647ac741c1419b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/16bb1cb86df43c90931df65f529e7ebd79636750", - "reference": "16bb1cb86df43c90931df65f529e7ebd79636750", + "url": "https://api.github.com/repos/symfony/console/zipball/4e35a78f932a4c07bd349efea647ac741c1419b6", + "reference": "4e35a78f932a4c07bd349efea647ac741c1419b6", "shasum": "" }, "require": { @@ -1781,20 +1781,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2015-11-18 09:54:26" + "time": "2015-12-23 11:17:38" }, { "name": "symfony/css-selector", - "version": "v2.7.7", + "version": "v2.7.8", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "abb47717fb88aebd9437da2fc8bb01a50a36679f" + "reference": "35bebec48d3d08e3138257419e3ca84070152012" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/abb47717fb88aebd9437da2fc8bb01a50a36679f", - "reference": "abb47717fb88aebd9437da2fc8bb01a50a36679f", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/35bebec48d3d08e3138257419e3ca84070152012", + "reference": "35bebec48d3d08e3138257419e3ca84070152012", "shasum": "" }, "require": { @@ -1834,20 +1834,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2015-10-30 20:10:21" + "time": "2015-12-05 17:37:09" }, { "name": "symfony/debug", - "version": "v2.7.7", + "version": "v2.7.8", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "0dbc119596f4afc82d9b2eb2a7e6a4af1ee763fa" + "reference": "08589346bd2ec9a8eb3d935e3b1fedba9bb6463f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/0dbc119596f4afc82d9b2eb2a7e6a4af1ee763fa", - "reference": "0dbc119596f4afc82d9b2eb2a7e6a4af1ee763fa", + "url": "https://api.github.com/repos/symfony/debug/zipball/08589346bd2ec9a8eb3d935e3b1fedba9bb6463f", + "reference": "08589346bd2ec9a8eb3d935e3b1fedba9bb6463f", "shasum": "" }, "require": { @@ -1891,11 +1891,11 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2015-10-30 20:10:21" + "time": "2015-12-26 14:05:15" }, { "name": "symfony/dom-crawler", - "version": "v2.7.7", + "version": "v2.7.8", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -1950,7 +1950,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.0", + "version": "v2.8.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -2010,16 +2010,16 @@ }, { "name": "symfony/finder", - "version": "v2.7.7", + "version": "v2.7.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "a06a0c0ff7db3736a50d530c908cca547bf13da9" + "reference": "937edcbac3f2dd3187c56cf90368867d55dee991" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/a06a0c0ff7db3736a50d530c908cca547bf13da9", - "reference": "a06a0c0ff7db3736a50d530c908cca547bf13da9", + "url": "https://api.github.com/repos/symfony/finder/zipball/937edcbac3f2dd3187c56cf90368867d55dee991", + "reference": "937edcbac3f2dd3187c56cf90368867d55dee991", "shasum": "" }, "require": { @@ -2055,20 +2055,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2015-10-30 20:10:21" + "time": "2015-12-05 11:06:38" }, { "name": "symfony/http-foundation", - "version": "v2.7.7", + "version": "v2.7.8", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "e83a3d105ddaf5a113e803c904fdec552d1f1c35" + "reference": "cf11faac7df5384bb14774ad7266add227e10ec1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e83a3d105ddaf5a113e803c904fdec552d1f1c35", - "reference": "e83a3d105ddaf5a113e803c904fdec552d1f1c35", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/cf11faac7df5384bb14774ad7266add227e10ec1", + "reference": "cf11faac7df5384bb14774ad7266add227e10ec1", "shasum": "" }, "require": { @@ -2110,20 +2110,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2015-11-20 17:41:18" + "time": "2015-12-18 15:35:58" }, { "name": "symfony/http-kernel", - "version": "v2.7.7", + "version": "v2.7.8", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "5570de31e8fbc03777a8c61eb24f9b626e5e5941" + "reference": "2dea13800e1a48710cf23a2c60c804c88e72ed57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/5570de31e8fbc03777a8c61eb24f9b626e5e5941", - "reference": "5570de31e8fbc03777a8c61eb24f9b626e5e5941", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/2dea13800e1a48710cf23a2c60c804c88e72ed57", + "reference": "2dea13800e1a48710cf23a2c60c804c88e72ed57", "shasum": "" }, "require": { @@ -2192,20 +2192,20 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2015-11-23 11:57:49" + "time": "2015-12-26 15:01:55" }, { "name": "symfony/polyfill-php56", - "version": "v1.0.0", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php56.git", - "reference": "a6bd4770a6967517e6610529e14afaa3111094a3" + "reference": "e2e77609a9e2328eb370fbb0e0d8b2000ebb488f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/a6bd4770a6967517e6610529e14afaa3111094a3", - "reference": "a6bd4770a6967517e6610529e14afaa3111094a3", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/e2e77609a9e2328eb370fbb0e0d8b2000ebb488f", + "reference": "e2e77609a9e2328eb370fbb0e0d8b2000ebb488f", "shasum": "" }, "require": { @@ -2248,11 +2248,11 @@ "portable", "shim" ], - "time": "2015-11-04 20:28:58" + "time": "2015-12-18 15:10:25" }, { "name": "symfony/polyfill-util", - "version": "v1.0.0", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-util.git", @@ -2304,16 +2304,16 @@ }, { "name": "symfony/process", - "version": "v2.7.7", + "version": "v2.7.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "f6290983c8725d0afa29bdc3e5295879de3e58f5" + "reference": "a3fb8f4c4afc4f1b285de5df07e568602934f525" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/f6290983c8725d0afa29bdc3e5295879de3e58f5", - "reference": "f6290983c8725d0afa29bdc3e5295879de3e58f5", + "url": "https://api.github.com/repos/symfony/process/zipball/a3fb8f4c4afc4f1b285de5df07e568602934f525", + "reference": "a3fb8f4c4afc4f1b285de5df07e568602934f525", "shasum": "" }, "require": { @@ -2349,20 +2349,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2015-11-19 16:11:24" + "time": "2015-12-23 11:03:39" }, { "name": "symfony/routing", - "version": "v2.7.7", + "version": "v2.7.8", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "7450f6196711b124fb8b04a12286d01a0401ddfe" + "reference": "2c100bd94be50e2a1fce7fe1ac534e28776c24ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/7450f6196711b124fb8b04a12286d01a0401ddfe", - "reference": "7450f6196711b124fb8b04a12286d01a0401ddfe", + "url": "https://api.github.com/repos/symfony/routing/zipball/2c100bd94be50e2a1fce7fe1ac534e28776c24ff", + "reference": "2c100bd94be50e2a1fce7fe1ac534e28776c24ff", "shasum": "" }, "require": { @@ -2422,20 +2422,20 @@ "uri", "url" ], - "time": "2015-11-18 13:41:01" + "time": "2015-12-23 06:54:35" }, { "name": "symfony/translation", - "version": "v2.7.7", + "version": "v2.7.8", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "e4ecb9c3ba1304eaf24de15c2d7a428101c1982f" + "reference": "e7e95debf0465f7886d2994cd808f9382adb423c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/e4ecb9c3ba1304eaf24de15c2d7a428101c1982f", - "reference": "e4ecb9c3ba1304eaf24de15c2d7a428101c1982f", + "url": "https://api.github.com/repos/symfony/translation/zipball/e7e95debf0465f7886d2994cd808f9382adb423c", + "reference": "e7e95debf0465f7886d2994cd808f9382adb423c", "shasum": "" }, "require": { @@ -2485,20 +2485,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2015-11-18 13:41:01" + "time": "2015-12-05 17:37:09" }, { "name": "symfony/var-dumper", - "version": "v2.7.7", + "version": "v2.7.8", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "72bcb27411780eaee9469729aace73c0d46fb2b8" + "reference": "ec3233d755578c56612c13d81d4ef141f8f94e9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/72bcb27411780eaee9469729aace73c0d46fb2b8", - "reference": "72bcb27411780eaee9469729aace73c0d46fb2b8", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ec3233d755578c56612c13d81d4ef141f8f94e9e", + "reference": "ec3233d755578c56612c13d81d4ef141f8f94e9e", "shasum": "" }, "require": { @@ -2544,7 +2544,7 @@ "debug", "dump" ], - "time": "2015-11-18 13:41:01" + "time": "2015-12-05 10:02:55" }, { "name": "twig/twig", @@ -2779,28 +2779,28 @@ "packages-dev": [ { "name": "barryvdh/laravel-debugbar", - "version": "v2.0.6", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-debugbar.git", - "reference": "23672cbbe78278ff1fdb258caa0b1de7b5d0bc0c" + "reference": "974fd16e328ca851a081449100d9509af59cf0ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/23672cbbe78278ff1fdb258caa0b1de7b5d0bc0c", - "reference": "23672cbbe78278ff1fdb258caa0b1de7b5d0bc0c", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/974fd16e328ca851a081449100d9509af59cf0ff", + "reference": "974fd16e328ca851a081449100d9509af59cf0ff", "shasum": "" }, "require": { - "illuminate/support": "~5.0.17|5.1.*", - "maximebf/debugbar": "~1.10.2", + "illuminate/support": "~5.0.17|5.1.*|5.2.*", + "maximebf/debugbar": "~1.11.0", "php": ">=5.4.0", - "symfony/finder": "~2.6" + "symfony/finder": "~2.6|~3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" } }, "autoload": { @@ -2829,26 +2829,26 @@ "profiler", "webprofiler" ], - "time": "2015-09-09 11:39:27" + "time": "2015-12-22 06:22:38" }, { "name": "barryvdh/laravel-ide-helper", - "version": "v2.1.0", + "version": "v2.1.2", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-ide-helper.git", - "reference": "83999f8467374adcb8893f566c9171c9d9691f50" + "reference": "d82e8f191fb043a0f8cbf2de64fd3027bfa4f772" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/83999f8467374adcb8893f566c9171c9d9691f50", - "reference": "83999f8467374adcb8893f566c9171c9d9691f50", + "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/d82e8f191fb043a0f8cbf2de64fd3027bfa4f772", + "reference": "d82e8f191fb043a0f8cbf2de64fd3027bfa4f772", "shasum": "" }, "require": { - "illuminate/console": "5.0.x|5.1.x", - "illuminate/filesystem": "5.0.x|5.1.x", - "illuminate/support": "5.0.x|5.1.x", + "illuminate/console": "5.0.x|5.1.x|5.2.x", + "illuminate/filesystem": "5.0.x|5.1.x|5.2.x", + "illuminate/support": "5.0.x|5.1.x|5.2.x", "php": ">=5.4.0", "phpdocumentor/reflection-docblock": "2.0.4", "symfony/class-loader": "~2.3" @@ -2892,29 +2892,29 @@ "phpstorm", "sublime" ], - "time": "2015-08-13 11:40:00" + "time": "2015-12-21 19:48:06" }, { "name": "maximebf/debugbar", - "version": "v1.10.5", + "version": "v1.11.0", "source": { "type": "git", "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "30e53e8a28284b69dd223c9f5ee8957befd72636" + "reference": "07741d84d39d10f00551c94284cdefcc69703e77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/30e53e8a28284b69dd223c9f5ee8957befd72636", - "reference": "30e53e8a28284b69dd223c9f5ee8957befd72636", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/07741d84d39d10f00551c94284cdefcc69703e77", + "reference": "07741d84d39d10f00551c94284cdefcc69703e77", "shasum": "" }, "require": { "php": ">=5.3.0", - "psr/log": "~1.0", - "symfony/var-dumper": "~2.6" + "psr/log": "^1.0", + "symfony/var-dumper": "^2.6|^3.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0|^5.0" }, "suggest": { "kriswallsmith/assetic": "The best way to manage assets", @@ -2924,12 +2924,12 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.10-dev" + "dev-master": "1.11-dev" } }, "autoload": { - "psr-0": { - "DebugBar": "src/" + "psr-4": { + "DebugBar\\": "src/DebugBar/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2941,14 +2941,19 @@ "name": "Maxime Bouroumeau-Fuseau", "email": "maxime.bouroumeau@gmail.com", "homepage": "http://maximebf.com" + }, + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" } ], "description": "Debug bar in the browser for php application", "homepage": "https://github.com/maximebf/php-debugbar", "keywords": [ - "debug" + "debug", + "debugbar" ], - "time": "2015-10-19 20:35:12" + "time": "2015-12-10 09:50:24" }, { "name": "phpdocumentor/reflection-docblock", @@ -3001,16 +3006,16 @@ }, { "name": "symfony/class-loader", - "version": "v2.8.0", + "version": "v2.8.1", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", - "reference": "51f83451bf0ddfc696e47e4642d6cd10fcfce160" + "reference": "ec74b0a279cf3a9bd36172b3e3061591d380ce6c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/class-loader/zipball/51f83451bf0ddfc696e47e4642d6cd10fcfce160", - "reference": "51f83451bf0ddfc696e47e4642d6cd10fcfce160", + "url": "https://api.github.com/repos/symfony/class-loader/zipball/ec74b0a279cf3a9bd36172b3e3061591d380ce6c", + "reference": "ec74b0a279cf3a9bd36172b3e3061591d380ce6c", "shasum": "" }, "require": { @@ -3049,13 +3054,12 @@ ], "description": "Symfony ClassLoader Component", "homepage": "https://symfony.com", - "time": "2015-11-26 07:00:59" + "time": "2015-12-05 17:37:59" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": { - "rcrowe/twigbridge": 20, "zizaco/entrust": 20, "barryvdh/laravel-debugbar": 0 }, diff --git a/config/firefly.php b/config/firefly.php index 0ad434380e..2ebd6019aa 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -2,7 +2,7 @@ return [ 'chart' => 'chartjs', - 'version' => '3.5.5', + 'version' => '3.5.6', 'index_periods' => ['1D', '1W', '1M', '3M', '6M', '1Y', 'custom'], 'budget_periods' => ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly'], 'csv_import_enabled' => true, diff --git a/resources/lang/fr_FR/firefly.php b/resources/lang/fr_FR/firefly.php index 53eedbd87e..d9dfa8daff 100644 --- a/resources/lang/fr_FR/firefly.php +++ b/resources/lang/fr_FR/firefly.php @@ -328,7 +328,7 @@ return [ 'Default account' => 'Asset account', 'Expense account' => 'Expense account', 'Revenue account' => 'Revenue account', - 'Initial balance account' => 'Initial balance account', + 'Initial balance account' => 'Initial balance account', 'budgets' => 'Budgets', 'tags' => 'Tags', 'reports' => 'Reports', @@ -364,13 +364,13 @@ return [ 'profile' => 'Profile', // reports - 'report_default' => 'Default financial report for :start until :end', - 'quick_link_reports' => 'Quick links', - 'quick_link_default_report' => 'Default financial report', - 'report_this_month_quick' => 'Current month, all accounts', - 'report_this_year_quick' => 'Current year, all accounts', - 'report_all_time_quick' => 'All-time, all accounts', - 'reports_can_bookmark' => 'Remember that reports can be bookmarked.', + 'report_default' => 'Default financial report for :start until :end', + 'quick_link_reports' => 'Quick links', + 'quick_link_default_report' => 'Default financial report', + 'report_this_month_quick' => 'Current month, all accounts', + 'report_this_year_quick' => 'Current year, all accounts', + 'report_all_time_quick' => 'All-time, all accounts', + 'reports_can_bookmark' => 'Remember that reports can be bookmarked.', 'incomeVsExpenses' => 'Income vs. expenses', 'accountBalances' => 'Account balances', 'balanceStartOfYear' => 'Balance at start of year', @@ -389,7 +389,7 @@ return [ 'outsideOfBudgets' => 'Outside of budgets', 'leftInBudget' => 'Left in budget', 'sumOfSums' => 'Sum of sums', - 'noCategory' => '(no category)', + 'noCategory' => '(no category)', 'notCharged' => 'Not charged (yet)', 'inactive' => 'Inactive', 'difference' => 'Difference', @@ -399,18 +399,18 @@ return [ 'showTheRest' => 'Show everything', 'hideTheRest' => 'Show only the top :number', 'sum_of_year' => 'Sum of year', - 'sum_of_years' => 'Sum of years', + 'sum_of_years' => 'Sum of years', 'average_of_year' => 'Average of year', - 'average_of_years' => 'Average of years', + 'average_of_years' => 'Average of years', 'categories_earned_in_year' => 'Categories (by earnings)', 'categories_spent_in_year' => 'Categories (by spendings)', - 'report_type' => 'Report type', - 'report_type_default' => 'Default financial report', - 'report_included_accounts' => 'Included accounts', - 'report_date_range' => 'Date range', - 'report_include_help' => 'In all cases, transfers to shared accounts count as expenses, and transfers from shared accounts count as income.', - 'report_preset_ranges' => 'Pre-set ranges', - 'shared' => 'Shared', + 'report_type' => 'Report type', + 'report_type_default' => 'Default financial report', + 'report_included_accounts' => 'Included accounts', + 'report_date_range' => 'Date range', + 'report_include_help' => 'In all cases, transfers to shared accounts count as expenses, and transfers from shared accounts count as income.', + 'report_preset_ranges' => 'Pre-set ranges', + 'shared' => 'Shared', // charts 'dayOfMonth' => 'Day of the month', diff --git a/resources/lang/nl_NL/validation.php b/resources/lang/nl_NL/validation.php index 33ec3e5570..bfd6f6004f 100644 --- a/resources/lang/nl_NL/validation.php +++ b/resources/lang/nl_NL/validation.php @@ -35,7 +35,7 @@ return [ "in" => ":attribute is ongeldig.", "integer" => ":attribute moet een getal zijn.", "ip" => ":attribute moet een geldig IP-adres zijn.", - 'json' => 'De :attribute moet een JSON tekst zijn.', + 'json' => 'De :attribute moet een JSON tekst zijn.', "max.numeric" => ":attribute mag niet hoger dan :max zijn.", "max.file" => ":attribute mag niet meer dan :max kilobytes zijn.", "max.string" => ":attribute mag niet uit meer dan :max karakters bestaan.", @@ -50,7 +50,7 @@ return [ "regex" => ":attribute formaat is ongeldig.", "required" => ":attribute is verplicht.", "required_if" => ":attribute is verplicht indien :other gelijk is aan :value.", - 'required_unless' => ':attribute is verplicht tenzij :other gelijk is aan :values.', + 'required_unless' => ':attribute is verplicht tenzij :other gelijk is aan :values.', "required_with" => ":attribute is verplicht i.c.m. :values", "required_with_all" => ":attribute is verplicht i.c.m. :values", "required_without" => ":attribute is verplicht als :values niet ingevuld is.", diff --git a/resources/lang/pt_BR/validation.php b/resources/lang/pt_BR/validation.php index 80f0e059f4..7819d30ce1 100755 --- a/resources/lang/pt_BR/validation.php +++ b/resources/lang/pt_BR/validation.php @@ -35,7 +35,7 @@ return [ "in" => "O campo :attribute não contém um valor válido.", "integer" => "O campo :attribute deverá conter um número inteiro.", "ip" => "O campo :attribute deverá conter um IP válido.", - 'json' => 'O campo :attribute deverá conter uma string JSON válida.', + 'json' => 'O campo :attribute deverá conter uma string JSON válida.', "max.numeric" => "O campo :attribute não deverá conter um valor superior a :max.", "max.file" => "O campo :attribute não deverá ter um tamanho superior a :max kilobytes.", "max.string" => "O campo :attribute não deverá conter mais de :max caracteres.", @@ -50,7 +50,7 @@ return [ "regex" => "O formato do valor para o campo :attribute é inválido.", "required" => "O campo :attribute é obrigatório.", "required_if" => "O campo :attribute é obrigatório quando o valor do campo :other é igual a :value.", - 'required_unless' => 'O campo :attribute é obrigatório a menos que :other esteja presente em :values.', + 'required_unless' => 'O campo :attribute é obrigatório a menos que :other esteja presente em :values.', "required_with" => "O campo :attribute é obrigatório quando :values está presente.", "required_with_all" => "O campo :attribute é obrigatório quando um dos :values está presente.", "required_without" => "O campo :attribute é obrigatório quanto :values não está presente.", diff --git a/resources/twig/emails/registered-html.twig b/resources/twig/emails/registered-html.twig index 48edb4ffc0..d05f6901d0 100644 --- a/resources/twig/emails/registered-html.twig +++ b/resources/twig/emails/registered-html.twig @@ -60,6 +60,7 @@ + diff --git a/resources/twig/form/amount.twig b/resources/twig/form/amount.twig index ea390ecddb..46f9fec160 100644 --- a/resources/twig/form/amount.twig +++ b/resources/twig/form/amount.twig @@ -5,7 +5,8 @@