This commit is contained in:
James Cole
2020-07-02 20:13:47 +02:00
parent 979c1ad305
commit 6874d6469d
2 changed files with 21 additions and 15 deletions

View File

@@ -112,12 +112,18 @@ class IndexController extends Controller
'bills' => [],
];
// expected today? default:
$array['next_expected_match_diff'] = trans('firefly.not_expected_period');
$nextExpectedMatch = new Carbon($array['next_expected_match']);
$array['next_expected_match_diff'] = $nextExpectedMatch->isToday()
? trans('firefly.today')
: $nextExpectedMatch->diffForHumans(
today(), Carbon::DIFF_RELATIVE_TO_NOW
);
if ($nextExpectedMatch->isToday()) {
$array['next_expected_match_diff'] = trans('firefly.today');
}
$current = $array['pay_dates'][0] ?? null;
if (null !== $current && !$nextExpectedMatch->isToday()) {
$currentExpectedMatch = Carbon::createFromFormat('!Y-m-d', $current);
$array['next_expected_match_diff'] = $currentExpectedMatch->diffForHumans(today(), Carbon::DIFF_RELATIVE_TO_NOW);
}
$currency = $bill->transactionCurrency ?? $defaultCurrency;
$array['currency_id'] = $currency->id;
$array['currency_name'] = $currency->name;

View File

@@ -108,7 +108,7 @@ class BillUpdateService
if (isset($data['skip']) && '' !== (string) $data['skip']) {
$bill->skip = $data['skip'];
}
if (isset($data['active']) && '' !== (string) $data['active']) {
if (isset($data['active']) && is_bool($data['active'])) {
$bill->active = $data['active'];
}