Remove the use of deprecated methods.

This commit is contained in:
James Cole
2023-10-29 05:54:01 +01:00
parent a28f561e0c
commit 4bb171128e
10 changed files with 43 additions and 137 deletions

View File

@@ -109,19 +109,22 @@ class ReportController extends Controller
while ($current < $end) {
// get balances by date, grouped by currency.
$result = $helper->getNetWorthByCurrency($filtered, $current);
$result = $helper->byAccounts($filtered, $current);
// loop result, add to array.
/** @var array $netWorthItem */
foreach ($result as $netWorthItem) {
$currencyId = $netWorthItem['currency']->id;
foreach ($result as $key => $netWorthItem) {
if('native' === $key) {
continue;
}
$currencyId = $netWorthItem['currency_id'];
$label = $current->isoFormat((string)trans('config.month_and_day_js', [], $locale));
if (!array_key_exists($currencyId, $chartData)) {
$chartData[$currencyId] = [
'label' => 'Net worth in ' . $netWorthItem['currency']->name,
'label' => 'Net worth in ' . $netWorthItem['currency_name'],
'type' => 'line',
'currency_symbol' => $netWorthItem['currency']->symbol,
'currency_code' => $netWorthItem['currency']->code,
'currency_symbol' => $netWorthItem['currency_symbol'],
'currency_code' => $netWorthItem['currency_code'],
'entries' => [],
];
}

View File

@@ -268,12 +268,13 @@ class BoxController extends Controller
}
);
$netWorthSet = $netWorthHelper->getNetWorthByCurrency($filtered, $date);
$netWorthSet = $netWorthHelper->byAccounts($filtered, $date);
$return = [];
foreach ($netWorthSet as $data) {
/** @var TransactionCurrency $currency */
$currency = $data['currency'];
$return[$currency->id] = app('amount')->formatAnything($currency, $data['balance'], false);
foreach ($netWorthSet as $key => $data) {
if('native' === $key) {
continue;
}
$return[$data['currency_id']] = app('amount')->formatFlat($data['currency_symbol'], $data['currency_decimal_places'], $data['balance'], false);
}
$return = [
'net_worths' => array_values($return),

View File

@@ -158,7 +158,7 @@ class InstallController extends Controller
}
// clear cache as well.
Cache::clear();
Preferences::mark();
app('preferences')->mark();
return true;
}

View File

@@ -54,23 +54,23 @@ class InterestingMessage
}
if ($this->groupMessage($request)) {
Preferences::mark();
app('preferences')->mark();
$this->handleGroupMessage($request);
}
if ($this->accountMessage($request)) {
Preferences::mark();
app('preferences')->mark();
$this->handleAccountMessage($request);
}
if ($this->billMessage($request)) {
Preferences::mark();
app('preferences')->mark();
$this->handleBillMessage($request);
}
if ($this->webhookMessage($request)) {
Preferences::mark();
app('preferences')->mark();
$this->handleWebhookMessage($request);
}
if ($this->currencyMessage($request)) {
Preferences::mark();
app('preferences')->mark();
$this->handleCurrencyMessage($request);
}