mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-19 10:53:31 +00:00
Code for #5179
This commit is contained in:
@@ -101,7 +101,7 @@ class IndexController extends Controller
|
|||||||
|
|
||||||
$accounts->each(
|
$accounts->each(
|
||||||
function (Account $account) use ($activities, $startBalances, $endBalances) {
|
function (Account $account) use ($activities, $startBalances, $endBalances) {
|
||||||
$account->lastActivityDate = $this->isInArray($activities, $account->id);
|
$account->lastActivityDate = $this->isInArrayDate($activities, $account->id);
|
||||||
$account->startBalance = $this->isInArray($startBalances, $account->id);
|
$account->startBalance = $this->isInArray($startBalances, $account->id);
|
||||||
$account->endBalance = $this->isInArray($endBalances, $account->id);
|
$account->endBalance = $this->isInArray($endBalances, $account->id);
|
||||||
$account->difference = bcsub($account->endBalance, $account->startBalance);
|
$account->difference = bcsub($account->endBalance, $account->startBalance);
|
||||||
@@ -163,7 +163,7 @@ class IndexController extends Controller
|
|||||||
$accounts->each(
|
$accounts->each(
|
||||||
function (Account $account) use ($activities, $startBalances, $endBalances) {
|
function (Account $account) use ($activities, $startBalances, $endBalances) {
|
||||||
// See reference nr. 68
|
// See reference nr. 68
|
||||||
$account->lastActivityDate = $this->isInArray($activities, $account->id);
|
$account->lastActivityDate = $this->isInArrayDate($activities, $account->id);
|
||||||
$account->startBalance = $this->isInArray($startBalances, $account->id);
|
$account->startBalance = $this->isInArray($startBalances, $account->id);
|
||||||
$account->endBalance = $this->isInArray($endBalances, $account->id);
|
$account->endBalance = $this->isInArray($endBalances, $account->id);
|
||||||
$account->difference = bcsub($account->endBalance, $account->startBalance);
|
$account->difference = bcsub($account->endBalance, $account->startBalance);
|
||||||
|
@@ -23,6 +23,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Support\Http\Controllers;
|
namespace FireflyIII\Support\Http\Controllers;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trait BasicDataSupport
|
* Trait BasicDataSupport
|
||||||
*
|
*
|
||||||
@@ -30,15 +32,28 @@ namespace FireflyIII\Support\Http\Controllers;
|
|||||||
trait BasicDataSupport
|
trait BasicDataSupport
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Find the ID in a given array. Return '0' of not there (amount).
|
* Find the ID in a given array. Return '0' if not there (amount).
|
||||||
*
|
*
|
||||||
* @param array $array
|
* @param array $array
|
||||||
* @param int $entryId
|
* @param int $entryId
|
||||||
*
|
*
|
||||||
* @return null|mixed
|
* @return null|mixed
|
||||||
*/
|
*/
|
||||||
protected function isInArray(array $array, int $entryId) // helper for data (math, calculations)
|
protected function isInArray(array $array, int $entryId)
|
||||||
{
|
{
|
||||||
return $array[$entryId] ?? '0';
|
return $array[$entryId] ?? '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the ID in a given array. Return null if not there (amount).
|
||||||
|
*
|
||||||
|
* @param array $array
|
||||||
|
* @param int $entryId
|
||||||
|
*
|
||||||
|
* @return null|Carbon
|
||||||
|
*/
|
||||||
|
protected function isInArrayDate(array $array, int $entryId): ?Carbon
|
||||||
|
{
|
||||||
|
return $array[$entryId] ?? null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -84,6 +84,7 @@
|
|||||||
{% if objectType != 'liabilities' %}
|
{% if objectType != 'liabilities' %}
|
||||||
{% if account.lastActivityDate %}
|
{% if account.lastActivityDate %}
|
||||||
<td class="hidden-sm hidden-xs hidden-md">
|
<td class="hidden-sm hidden-xs hidden-md">
|
||||||
|
<!-- {{ account.lastActivityDate }} -->
|
||||||
{{ account.lastActivityDate.formatLocalized(monthAndDayFormat) }}
|
{{ account.lastActivityDate.formatLocalized(monthAndDayFormat) }}
|
||||||
</td>
|
</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
Reference in New Issue
Block a user