Various bugfixes and code clean up.

This commit is contained in:
James Cole
2018-07-27 04:46:21 +02:00
parent 2ad8e7f343
commit 0312ba8ad7
60 changed files with 223 additions and 353 deletions

View File

@@ -54,7 +54,9 @@ class BoxController extends Controller
*/
public function available(BudgetRepositoryInterface $repository): JsonResponse
{
/** @var Carbon $start */
$start = session('start', Carbon::now()->startOfMonth());
/** @var Carbon $end */
$end = session('end', Carbon::now()->endOfMonth());
$today = new Carbon;
$cache = new CacheProperties;
@@ -111,7 +113,9 @@ class BoxController extends Controller
public function balance(CurrencyRepositoryInterface $repository): JsonResponse
{
// Cache result, return cache if present.
/** @var Carbon $start */
$start = session('start', Carbon::now()->startOfMonth());
/** @var Carbon $end */
$end = session('end', Carbon::now()->endOfMonth());
$cache = new CacheProperties;
$cache->addProperty($start);
@@ -195,7 +199,9 @@ class BoxController extends Controller
*/
public function bills(BillRepositoryInterface $repository): JsonResponse
{
/** @var Carbon $start */
$start = session('start', Carbon::now()->startOfMonth());
/** @var Carbon $end */
$end = session('end', Carbon::now()->endOfMonth());
$cache = new CacheProperties;

View File

@@ -161,7 +161,7 @@ class ReconcileController extends Controller
$currencyId = (int)$this->accountRepos->getMetaValue($account, 'currency_id');
$currency = $this->currencyRepos->findNull($currencyId);
if (0 === $currency) {
if (0 === $currencyId) {
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
}

View File

@@ -156,10 +156,10 @@ class RecurrenceController extends Controller
if ($date > $today || 'true' === (string)$request->get('past')) {
$weekly = sprintf('weekly,%s', $date->dayOfWeekIso);
$monthly = sprintf('monthly,%s', $date->day);
$dayOfWeek = trans(sprintf('config.dow_%s', $date->dayOfWeekIso));
$dayOfWeek = (string)trans(sprintf('config.dow_%s', $date->dayOfWeekIso));
$ndom = sprintf('ndom,%s,%s', $date->weekOfMonth, $date->dayOfWeekIso);
$yearly = sprintf('yearly,%s', $date->format('Y-m-d'));
$yearlyDate = $date->formatLocalized(trans('config.month_and_day_no_year'));
$yearlyDate = $date->formatLocalized((string)trans('config.month_and_day_no_year'));
$result = [
'daily' => ['label' => (string)trans('firefly.recurring_daily'), 'selected' => 0 === strpos($preSelected, 'daily')],
$weekly => ['label' => (string)trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek]),