Skip to content

Firefly III: a personal finances manager

🤖 Auto commit for release 'develop' on 2026-09-13

JC5a532eeff1eab
diff --git a/app/Api/V1/Controllers/Insight/Income/TagController.php b/app/Api/V1/Controllers/Insight/Income/TagController.php
index df99eef909..94be2ae461 100644
--- a/app/Api/V1/Controllers/Insight/Income/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Income/TagController.php
@@ -158,7 +158,10 @@ final class TagController extends Controller
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
- $response[$foreignKey]['difference'] = bcadd((string) $response[$foreignKey]['difference'], Steam::positive($journal['foreign_amount']));
+ $response[$foreignKey]['difference'] = bcadd(
+ (string) $response[$foreignKey]['difference'],
+ Steam::positive($journal['foreign_amount'])
+ );
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference'];
}
}
diff --git a/app/Api/V1/Controllers/Insight/Transfer/TagController.php b/app/Api/V1/Controllers/Insight/Transfer/TagController.php
index f92a7aa9f0..b7b85fd376 100644
--- a/app/Api/V1/Controllers/Insight/Transfer/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Transfer/TagController.php
@@ -155,7 +155,10 @@ final class TagController extends Controller
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
- $response[$foreignKey]['difference'] = bcadd((string) $response[$foreignKey]['difference'], Steam::positive($journal['foreign_amount']));
+ $response[$foreignKey]['difference'] = bcadd(
+ (string) $response[$foreignKey]['difference'],
+ Steam::positive($journal['foreign_amount'])
+ );
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference']; // intentional float
}
}
diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php
index 2edb4f5531..d461374baa 100644
--- a/app/Http/Controllers/Budget/BudgetLimitController.php
+++ b/app/Http/Controllers/Budget/BudgetLimitController.php
@@ -198,7 +198,13 @@ final class BudgetLimitController extends Controller
if ($request->expectsJson()) {
$array = $limit->toArray();
// add some extra metadata:
- $spentArr = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection()->push($budget), $currency);
+ $spentArr = $this->opsRepository->sumExpenses(
+ $limit->start_date,
+ $limit->end_date,
+ null,
+ new Collection()->push($budget),
+ $currency
+ );
$array['spent'] = $spentArr[$currency->id]['sum'] ?? '0';
$array['left_formatted'] = Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
$array['amount_formatted'] = Amount::formatAnything($limit->transactionCurrency, $limit['amount']);
diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php
index 215ebbd484..d40d4432a3 100644
--- a/app/Http/Controllers/Budget/IndexController.php
+++ b/app/Http/Controllers/Budget/IndexController.php
@@ -284,7 +284,10 @@ final class IndexController extends Controller
if (array_key_exists($currency->id, $spentArr) && array_key_exists('sum', $spentArr[$currency->id])) {
$array['spent'][$currency->id]['spent'] = $spentArr[$currency->id]['sum'];
- $array['spent'][$currency->id]['spent_outside'] = Steam::negative(bcsub($spentInLimits[$currency->id], $spentArr[$currency->id]['sum']));
+ $array['spent'][$currency->id]['spent_outside'] = Steam::negative(bcsub(
+ $spentInLimits[$currency->id],
+ $spentArr[$currency->id]['sum']
+ ));
$array['spent'][$currency->id]['currency_id'] = $currency->id;
$array['spent'][$currency->id]['currency_symbol'] = $currency->symbol;
$array['spent'][$currency->id]['currency_decimal_places'] = $currency->decimal_places;
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index ad724137dc..f4b32fe5c5 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -539,7 +539,13 @@ final class BudgetController extends Controller
}
// get spent amount in this period for this currency.
- $sum = $this->opsRepository->sumExpenses($currentStart, $currentEnd, $accounts, new Collection()->push($budget), $currency);
+ $sum = $this->opsRepository->sumExpenses(
+ $currentStart,
+ $currentEnd,
+ $accounts,
+ new Collection()->push($budget),
+ $currency
+ );
$amount = Steam::positive($sum[$currency->id]['sum'] ?? '0');
$chartData[0]['entries'][$title] = Steam::bcround($amount, $currency->decimal_places);
diff --git a/app/Jobs/CreateAutoBudgetLimits.php b/app/Jobs/CreateAutoBudgetLimits.php
index 476da65ac3..affea656a0 100644
--- a/app/Jobs/CreateAutoBudgetLimits.php
+++ b/app/Jobs/CreateAutoBudgetLimits.php
@@ -132,7 +132,13 @@ class CreateAutoBudgetLimits implements ShouldQueue
// if has one, calculate expenses and use that as a base.
$repository = app(OperationsRepositoryInterface::class);
$repository->setUser($autoBudget->budget->user);
- $spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection()->push($autoBudget->budget), $autoBudget->transactionCurrency);
+ $spent = $repository->sumExpenses(
+ $previousStart,
+ $previousEnd,
+ null,
+ new Collection()->push($autoBudget->budget),
+ $autoBudget->transactionCurrency
+ );
$currencyId = $autoBudget->transaction_currency_id;
$spentAmount = $spent[$currencyId]['sum'] ?? '0';
Log::debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
@@ -222,7 +228,13 @@ class CreateAutoBudgetLimits implements ShouldQueue
// if has one, calculate expenses and use that as a base.
$repository = app(OperationsRepositoryInterface::class);
$repository->setUser($autoBudget->budget->user);
- $spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection()->push($autoBudget->budget), $autoBudget->transactionCurrency);
+ $spent = $repository->sumExpenses(
+ $previousStart,
+ $previousEnd,
+ null,
+ new Collection()->push($autoBudget->budget),
+ $autoBudget->transactionCurrency
+ );
$currencyId = $autoBudget->transaction_currency_id;
$spentAmount = $spent[$currencyId]['sum'] ?? '0';
Log::debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
diff --git a/app/Support/Http/Controllers/AugumentData.php b/app/Support/Http/Controllers/AugumentData.php
index a3a940b1ba..a507156873 100644
--- a/app/Support/Http/Controllers/AugumentData.php
+++ b/app/Support/Http/Controllers/AugumentData.php
@@ -222,7 +222,14 @@ trait AugumentData
$currentEnd->addMonth();
}
// primary currency amount.
- $expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency, $this->convertToPrimary);
+ $expenses = $opsRepository->sumExpenses(
+ $currentStart,
+ $currentEnd,
+ null,
+ $budgetCollection,
+ $entry->transactionCurrency,
+ $this->convertToPrimary
+ );
$spent = $expenses[$currency->id]['sum'] ?? '0';
$entry->pc_spent = $spent;
diff --git a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
index d0c09bf027..2428353cb0 100644
--- a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
@@ -354,7 +354,11 @@ class RecurringEnrichment implements EnrichmentInterface
/** @var RecurrenceRepetition $repetition */
foreach ($set as $repetition) {
- $recurrence = $this->collection->filter(static fn (Recurrence $item): bool => (int) $item->id === (int) $repetition->recurrence_id)->first();
+ $recurrence = $this->collection->filter(
+ static fn (Recurrence $item): bool => (int) $item->id === (int) $repetition->recurrence_id
+ )
+ ->first()
+ ;
$fromDate = clone ($recurrence->latest_date ?? $recurrence->first_date);
$recurrenceId = (int) $repetition->recurrence_id;
$repId = (int) $repetition->id;
diff --git a/config/firefly.php b/config/firefly.php
index 43ca4abf89..ae5aceb85f 100644
--- a/config/firefly.php
+++ b/config/firefly.php
@@ -79,7 +79,7 @@ return [
// see cer.php for exchange rates feature flag.
],
'version' => 'develop/2026-09-13',
-'build_time' => 1789313992,
+'build_time' => 1789320602,
'api_version' => '2.1.0', // field is no longer used.
'db_version' => 28, // field is no longer used.
diff --git a/resources/assets/v3/js/pages/dashboard/dashboard.js b/resources/assets/v3/js/pages/dashboard/dashboard.js
index 0537475610..fedf18da91 100644
--- a/resources/assets/v3/js/pages/dashboard/dashboard.js
+++ b/resources/assets/v3/js/pages/dashboard/dashboard.js
@@ -47,7 +47,7 @@ let index = function () {
format(end, "yyyy-LL-dd"),
"accounts-chart",
value,
- true
+ true,
);
});
},
diff --git a/resources/assets/v3/js/shared/draw-chart.js b/resources/assets/v3/js/shared/draw-chart.js
index 87d1a25977..9bddee9abc 100644
--- a/resources/assets/v3/js/shared/draw-chart.js
+++ b/resources/assets/v3/js/shared/draw-chart.js
@@ -21,12 +21,11 @@
import Chart from "chart.js/auto";
import formatMoney from "../util/format-money.js";
import i18next from "i18next";
-import format from '../util/format.js';
-import annotationPlugin from 'chartjs-plugin-annotation';
+import format from "../util/format.js";
+import annotationPlugin from "chartjs-plugin-annotation";
Chart.register(annotationPlugin);
-
let defaultChartOptions = {
elements: {
line: {
@@ -58,7 +57,13 @@ let defaultChartOptions = {
},
};
-export function drawMultiCurrencyChart(type, url, holder, anonymous, drawTodayMarker) {
+export function drawMultiCurrencyChart(
+ type,
+ url,
+ holder,
+ anonymous,
+ drawTodayMarker,
+) {
if ("line" === type) {
drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker);
}
@@ -72,64 +77,41 @@ export function drawSingleCurrencyChart(type, url, holder, anonymous) {
function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker) {
document.getElementById(holder).classList.remove("general-chart-error");
- window.axios.get(url).then((response) => {
- let all = response.data;
- let options = {...defaultChartOptions};
- let today = new Date();
- let firstScale = ''; // used for today marker.
- let drawTodayIndex = '';
- let data = {
- datasets: [],
- labels: [],
- };
- let axes = {};
- // collect all Y axes from the data.
- for (let i = 0; i < all.length; i++) {
- if (Object.hasOwn(all, i)) {
- let current = all[i];
- // take the labels from index 0.
- if (0 === i) {
- for (let j in current.entries) {
- if (Object.hasOwn(current.entries, j)) {
- let date = new Date(j);
- if (drawTodayMarker && isSameDay(date, today)) {
- console.log('Today is ', j, date);
- drawTodayIndex = j;
- }
- data.labels.push(format(date, i18next.t('config.month_and_day_fns')));
- }
- }
- firstScale = 'y' + current.currency_code;
- }
- // add the dataset.
- let dataset = {
- label: current.label,
- currency_code: current.currency_code,
- data: [],
- yAxisID: 'y' + current.currency_code,
- };
- for (let j in current.entries) {
- if (Object.hasOwn(current.entries, j)) {
- dataset.data.push(current.entries[j]);
- }
- }
- data.datasets.push(dataset);
-
- let currencyCode = current.currency_code;
- let axisId = 'y' + currencyCode;
- if (!Object.hasOwn(axes, axisId)) {
- axes[axisId] = {
- id: axisId,
- type: "linear",
- position: Object.keys(axes).length < 1 ? "left" : 'right',
- ticks: {
- callback: function (value) {
- if (anonymous) {
- value = "0";
+ window.axios
+ .get(url)
+ .then((response) => {
+ let all = response.data;
+ let options = { ...defaultChartOptions };
+ let today = new Date();
+ let firstScale = ""; // used for today marker.
+ let drawTodayIndex = "";
+ let data = {
+ datasets: [],
+ labels: [],
+ };
+ let axes = {};
+ // collect all Y axes from the data.
+ for (let i = 0; i < all.length; i++) {
+ if (Object.hasOwn(all, i)) {
+ let current = all[i];
+ // take the labels from index 0.
+ if (0 === i) {
+ for (let j in current.entries) {
+ if (Object.hasOwn(current.entries, j)) {
+ let date = new Date(j);
+ if (drawTodayMarker && isSameDay(date, today)) {
+ console.log("Today is ", j, date);
+ drawTodayIndex = j;
}
- return formatMoney(value, currencyCode);
+ data.labels.push(
+ format(
+ date,
+ i18next.t("config.month_and_day_fns"),
+ ),
+ );
}
}
+ firstScale = "y" + current.currency_code;
}
// add the dataset.
let dataset = {
@@ -162,78 +144,120 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker) {
},
},
};
+ // add the dataset.
+ let dataset = {
+ label: current.label,
+ currency_code: current.currency_code,
+ data: [],
+ yAxisID: "y" + current.currency_code,
+ };
+ for (let j in current.entries) {
+ if (Object.hasOwn(current.entries, j)) {
+ dataset.data.push(current.entries[j]);
+ }
+ }
+ data.datasets.push(dataset);
+
+ let currencyCode = current.currency_code;
+ let axisId = "y" + currencyCode;
+ if (!Object.hasOwn(axes, axisId)) {
+ axes[axisId] = {
+ id: axisId,
+ type: "linear",
+ position:
+ Object.keys(axes).length < 1
+ ? "left"
+ : "right",
+ ticks: {
+ callback: function (value) {
+ if (anonymous) {
+ value = "0";
+ }
+ return formatMoney(value, currencyCode);
+ },
+ },
+ };
+ }
}
}
}
- }
- delete options.scales.y;
- options.scales = {...options.scales, ...axes};
+ delete options.scales.y;
+ options.scales = { ...options.scales, ...axes };
- let labelCallback = function (tooltipItem) {
- "use strict";
- let index = tooltipItem.dataIndex;
- let amount = tooltipItem.dataset.data[index];
+ let labelCallback = function (tooltipItem) {
+ "use strict";
+ let index = tooltipItem.dataIndex;
+ let amount = tooltipItem.dataset.data[index];
- let string = formatMoney(amount, tooltipItem.dataset.currency_code);
- if (anonymous) {
- string = formatMoney("0", tooltipItem.dataset.currency_code);
- }
- return tooltipItem.dataset.label + ": " + string;
- };
+ let string = formatMoney(
+ amount,
+ tooltipItem.dataset.currency_code,
+ );
+ if (anonymous) {
+ string = formatMoney(
+ "0",
+ tooltipItem.dataset.currency_code,
+ );
+ }
+ return tooltipItem.dataset.label + ": " + string;
+ };
- options.plugins.tooltip.callbacks.label = labelCallback;
+ options.plugins.tooltip.callbacks.label = labelCallback;
- if (
- typeof data === "undefined" ||
- 0 === data.length ||
- (typeof data === "object" &&
- typeof data.labels === "object" &&
- 0 === data.labels.length)
- ) {
- let el = document.getElementById(holder).parentElement;
- el.innerHTML = "";
- el.classList.add("general-chart-error");
- el.innerText = i18next.t("firefly.no_data_for_chart");
- return;
- }
+ if (
+ typeof data === "undefined" ||
+ 0 === data.length ||
+ (typeof data === "object" &&
+ typeof data.labels === "object" &&
+ 0 === data.labels.length)
+ ) {
+ let el = document.getElementById(holder).parentElement;
+ el.innerHTML = "";
+ el.classList.add("general-chart-error");
+ el.innerText = i18next.t("firefly.no_data_for_chart");
+ return;
+ }
- // TODO colorize data?
- // if (colorData) {
- // data = colorizeData(data);
- // }
- if (drawTodayMarker && '' !== drawTodayIndex) {
- let markDate = format(new Date(drawTodayIndex), i18next.t('config.month_and_day_fns'));
- // draw line using annotation plugin.
- options.plugins.annotation = {
- annotations: {
- line1: {
- type: 'line',
- xScaleID: 'x',
- yScaleID: firstScale,
- xMin: markDate,
- xMax: markDate,
- display: true,
- borderColor: 'rgb(255, 0, 0)',
- borderWidth: 1,
- label: {
- content: i18next.t('firefly.today'),
- enabled: true,
+ // TODO colorize data?
+ // if (colorData) {
+ // data = colorizeData(data);
+ // }
+ if (drawTodayMarker && "" !== drawTodayIndex) {
+ let markDate = format(
+ new Date(drawTodayIndex),
+ i18next.t("config.month_and_day_fns"),
+ );
+ // draw line using annotation plugin.
+ options.plugins.annotation = {
+ annotations: {
+ line1: {
+ type: "line",
+ xScaleID: "x",
+ yScaleID: firstScale,
+ xMin: markDate,
+ xMax: markDate,
display: true,
- position: 'center'
- }
- }
- }
- };
- }
- console.log(options);
- // lineChart
- const ctx = document.getElementById(holder).getContext("2d");
- new Chart(ctx, {
- type: "line",
- data: data,
- options: options,
- });
- })
+ borderColor: "rgb(255, 0, 0)",
+ borderWidth: 1,
+ label: {
+ content: i18next.t("firefly.today"),
+ enabled: true,
+ display: true,
+ position: "center",
+ },
+ },
+ },
+ };
+ }
+ console.log(options);
+ // lineChart
+ const ctx = document.getElementById(holder).getContext("2d");
+ new Chart(ctx, {
+ type: "line",
+ data: data,
+ options: options,
+ });
+ })
.catch((error) => {
let el = document.getElementById(holder).parentElement;
el.innerHTML = "";
@@ -270,7 +294,7 @@ function drawSingleCurrencyLineChart(url, holder, anonymous) {
return label + ": " + string;
};
- let options = {...defaultChartOptions};
+ let options = { ...defaultChartOptions };
options.scales.y.ticks.callback = yAxisCallback;
options.plugins.tooltip.callbacks.label = labelCallback;
@@ -310,10 +334,11 @@ function drawSingleCurrencyLineChart(url, holder, anonymous) {
});
}
-
// https://stackoverflow.com/questions/43855166/how-to-tell-if-two-dates-are-in-the-same-day-or-in-the-same-hour
function isSameDay(d1, d2) {
- return d1.getFullYear() === d2.getFullYear() &&
+ return (
+ d1.getFullYear() === d2.getFullYear() &&
d1.getMonth() === d2.getMonth() &&
- d1.getDate() === d2.getDate();
+ d1.getDate() === d2.getDate()
+ );
}