mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-02-22 19:36:59 +00:00
Compare commits
14 Commits
develop-20
...
develop-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25eab80ec3 | ||
|
|
c27e9873b2 | ||
|
|
84f4f63104 | ||
|
|
02d37998f9 | ||
|
|
39c72a60e1 | ||
|
|
1980f73694 | ||
|
|
d135186149 | ||
|
|
3e36287374 | ||
|
|
37c4db2ce9 | ||
|
|
8e6ff3ceaf | ||
|
|
6e0e32dc6c | ||
|
|
b0e21dd553 | ||
|
|
88291c5f63 | ||
|
|
a87e10f734 |
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
@@ -13,6 +13,8 @@ If it feels necessary to open an issue first, please do so, before you open a PR
|
||||
See also: https://docs.firefly-iii.org/explanation/support/#contributing-code
|
||||
|
||||
-->
|
||||
|
||||
@JC5
|
||||
|
||||
This PR fixes issue # (if relevant).
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ Over time, many people have contributed to Firefly III. Their efforts are not al
|
||||
Please find below all the people who contributed to the Firefly III code. Their names are mentioned in the year of their first contribution.
|
||||
|
||||
## 2026
|
||||
- Khoa Nguyen
|
||||
- Nick Huang
|
||||
- mateuszkulapl
|
||||
- Gianluca Martino
|
||||
|
||||
@@ -92,7 +92,7 @@ class UpdateRequest extends FormRequest
|
||||
'description' => 'min:1|max:32768|nullable',
|
||||
'rule_group_id' => 'belongsToUser:rule_groups',
|
||||
'rule_group_title' => 'nullable|min:1|max:255|belongsToUser:rule_groups,title',
|
||||
'trigger' => 'in:store-journal,update-journal.manual-activation',
|
||||
'trigger' => 'in:store-journal,update-journal,manual-activation',
|
||||
'triggers.*.type' => 'required|in:'.implode(',', $validTriggers),
|
||||
'triggers.*.value' => 'required_if:actions.*.type,'.$contextTriggers.'|min:1|ruleTriggerValue|max:1024',
|
||||
'triggers.*.stop_processing' => [new IsBoolean()],
|
||||
|
||||
@@ -103,10 +103,10 @@ class CategoryController extends Controller
|
||||
*/
|
||||
public function frontPage(): JsonResponse
|
||||
{
|
||||
$start = session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$start = session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties();
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty($this->convertToPrimary);
|
||||
@@ -115,9 +115,11 @@ class CategoryController extends Controller
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
|
||||
$frontpageGenerator = new FrontpageChartGenerator($start, $end);
|
||||
$chartData = $frontpageGenerator->generate();
|
||||
$data = $this->generator->multiSet($chartData);
|
||||
$frontpageGenerator = new FrontpageChartGenerator($start, $end);
|
||||
$frontpageGenerator->convertToPrimary = $this->convertToPrimary;
|
||||
|
||||
$chartData = $frontpageGenerator->generate();
|
||||
$data = $this->generator->multiSet($chartData);
|
||||
$cache->store($data);
|
||||
|
||||
return response()->json($data);
|
||||
|
||||
@@ -147,6 +147,7 @@ class ReportController extends Controller
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($accounts);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty($this->convertToPrimary);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
@@ -177,17 +178,32 @@ class ReportController extends Controller
|
||||
foreach ($journals as $journal) {
|
||||
$period = $journal['date']->format($format);
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$currencySymbol = (string) $journal['currency_symbol'];
|
||||
$currencyCode = (string) $journal['currency_code'];
|
||||
$currencyName = (string) $journal['currency_name'];
|
||||
$currencyDecimalPlaces = (int) $journal['currency_decimal_places'];
|
||||
$amount = (string) $journal['amount'];
|
||||
|
||||
if ($this->convertToPrimary && null !== $this->primaryCurrency && $journal['currency_id'] !== $this->primaryCurrency->id) {
|
||||
$currencyId = $this->primaryCurrency->id;
|
||||
$currencySymbol = $this->primaryCurrency->symbol;
|
||||
$currencyCode = $this->primaryCurrency->code;
|
||||
$currencyName = $this->primaryCurrency->name;
|
||||
$currencyDecimalPlaces = $this->primaryCurrency->decimal_places;
|
||||
$amount = $journal['foreign_currency_id'] === $this->primaryCurrency->id ? $journal['foreign_amount'] : $journal['pc_amount'];
|
||||
}
|
||||
|
||||
$data[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_name' => $journal['currency_name'],
|
||||
'currency_decimal_places' => (int) $journal['currency_decimal_places'],
|
||||
'currency_symbol' => $currencySymbol,
|
||||
'currency_code' => $currencyCode,
|
||||
'currency_name' => $currencyName,
|
||||
'currency_decimal_places' => $currencyDecimalPlaces,
|
||||
];
|
||||
$data[$currencyId][$period] ??= ['period' => $period, 'spent' => '0', 'earned' => '0'];
|
||||
// in our outgoing?
|
||||
$key = 'spent';
|
||||
$amount = Steam::positive($journal['amount']);
|
||||
$amount = Steam::positive($amount);
|
||||
|
||||
// deposit = incoming
|
||||
// transfer or reconcile or opening balance, and these accounts are the destination.
|
||||
|
||||
@@ -81,7 +81,7 @@ class SendsTestNotification
|
||||
return;
|
||||
}
|
||||
Log::debug(sprintf('Will send %s as a notification.', $class));
|
||||
NotificationSender::send($event->user, new $class());
|
||||
NotificationSender::send($event->{$type}, new $class());
|
||||
Log::debug(sprintf('If you see no errors above this line, test notification was sent over channel "%s"', $event->channel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,8 @@ class GitHubUpdateRequest implements UpdateRequestInterface
|
||||
|
||||
private function filterReleases(array $releases): array
|
||||
{
|
||||
$return = [];
|
||||
$return = [];
|
||||
$weekAgo = now()->subWeek();
|
||||
|
||||
/** @var array $release */
|
||||
foreach ($releases as $release) {
|
||||
@@ -119,6 +120,12 @@ class GitHubUpdateRequest implements UpdateRequestInterface
|
||||
|
||||
continue;
|
||||
}
|
||||
// new version must be at least a week old, unless it is a develop release.
|
||||
if ($release['published_at']->gt($weekAgo) && !str_contains($release['version'], 'develop')) {
|
||||
Log::debug(sprintf('Skip too new version "%s"', $release['version']));
|
||||
|
||||
continue;
|
||||
}
|
||||
// if channel is stable, and version is "alpha", continue.
|
||||
// if channel is stable, and version is "beta", continue.
|
||||
// if channel is beta, and version is "alpha", continue.
|
||||
|
||||
@@ -1,252 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* UpdateRequest.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\FireflyIIIOrg\Update;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Events\Security\System\SystemFoundNewVersionOnline;
|
||||
use FireflyIII\Support\System\IsOldVersion;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use JsonException;
|
||||
|
||||
use function Safe\json_decode;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
*/
|
||||
class UpdateRequest implements UpdateRequestInterface
|
||||
{
|
||||
use IsOldVersion;
|
||||
|
||||
public function getUpdateInformation(string $channel): array
|
||||
{
|
||||
Log::debug(sprintf('Now in getUpdateInformation(%s)', $channel));
|
||||
$information = ['level' => 'error', 'message' => (string) trans('firefly.unknown_error')];
|
||||
|
||||
// try to get array from update server:
|
||||
$updateInfo = $this->contactServer($channel);
|
||||
if ('error' === $updateInfo['level']) {
|
||||
Log::error('Update information contains an error.');
|
||||
Log::error($updateInfo['message']);
|
||||
$information['message'] = $updateInfo['message'];
|
||||
|
||||
return $information;
|
||||
}
|
||||
|
||||
// if no error, parse the result and return
|
||||
return $this->parseResult($updateInfo);
|
||||
}
|
||||
|
||||
private function contactServer(string $channel): array
|
||||
{
|
||||
Log::debug(sprintf('Now in contactServer(%s)', $channel));
|
||||
// always fall back to current version:
|
||||
$return = [
|
||||
'version' => config('firefly.version'),
|
||||
'date' => today(config('app.timezone'))->startOfDay(),
|
||||
'level' => 'error',
|
||||
'message' => (string) trans('firefly.unknown_error'),
|
||||
];
|
||||
|
||||
$url = config('firefly.update_endpoint');
|
||||
Log::debug(sprintf('Going to call %s', $url));
|
||||
|
||||
try {
|
||||
$client = new Client();
|
||||
$options = ['headers' => ['User-Agent' => sprintf('FireflyIII/%s/%s', config('firefly.version'), $channel)], 'timeout' => 3.1415];
|
||||
$res = $client->request('GET', $url, $options);
|
||||
} catch (GuzzleException $e) {
|
||||
Log::error('Ran into Guzzle error.');
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
$return['message'] = sprintf('Guzzle: %s', strip_tags($e->getMessage()));
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (200 !== $res->getStatusCode()) {
|
||||
Log::error(sprintf('Response status from server is %d.', $res->getStatusCode()));
|
||||
Log::error((string) $res->getBody());
|
||||
$return['message'] = sprintf('Error: %d', $res->getStatusCode());
|
||||
|
||||
return $return;
|
||||
}
|
||||
$body = (string) $res->getBody();
|
||||
|
||||
try {
|
||||
$json = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException) {
|
||||
Log::error('Body is not valid JSON');
|
||||
Log::error($body);
|
||||
$return['message'] = 'Invalid JSON :(';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (!array_key_exists($channel, $json['firefly_iii'])) {
|
||||
Log::error(sprintf('No valid update channel "%s"', $channel));
|
||||
Log::error($body);
|
||||
$return['message'] = sprintf('Unknown update channel "%s" :(', $channel);
|
||||
}
|
||||
|
||||
// parse response a bit. No message yet.
|
||||
$response = $json['firefly_iii'][$channel];
|
||||
$date = Carbon::createFromFormat('Y-m-d', $response['date']);
|
||||
if (!$date instanceof Carbon) {
|
||||
$date = today(config('app.timezone'));
|
||||
}
|
||||
$return['version'] = $response['version'];
|
||||
$return['level'] = 'success';
|
||||
$return['date'] = $date->startOfDay();
|
||||
|
||||
Log::info('Response from update server', $response);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO make shorter
|
||||
*/
|
||||
private function parseResult(array $information): array
|
||||
{
|
||||
Log::debug('Now in parseResult()', $information);
|
||||
$current = (string) config('firefly.version');
|
||||
$latest = (string) $information['version'];
|
||||
|
||||
// strip the 'v' from the version if it's there.
|
||||
if (str_starts_with($latest, 'v')) {
|
||||
$latest = substr($latest, 1);
|
||||
}
|
||||
if (str_starts_with($current, 'develop')) {
|
||||
return $this->parseResultDevelop($current, $latest);
|
||||
}
|
||||
|
||||
$compare = version_compare($latest, $current);
|
||||
|
||||
Log::debug(sprintf('Current version is "%s", latest is "%s", result is: %d', $current, $latest, $compare));
|
||||
|
||||
// -1: you're running a newer version:
|
||||
if (-1 === $compare) {
|
||||
return $this->runsNewerVersion($current, $latest);
|
||||
}
|
||||
// running the current version:
|
||||
if (0 === $compare) {
|
||||
return $this->runsSameVersion($current);
|
||||
}
|
||||
|
||||
// a newer version is available!
|
||||
/** @var Carbon $released */
|
||||
$released = $information['date'];
|
||||
$isBeta = $information['is_beta'] ?? false;
|
||||
$isAlpha = $information['is_alpha'] ?? false;
|
||||
|
||||
// it's new but alpha:
|
||||
if (true === $isAlpha) {
|
||||
return $this->releasedNewAlpha($current, $latest, $released);
|
||||
}
|
||||
|
||||
if (true === $isBeta) {
|
||||
return $this->releasedNewBeta($current, $latest, $released);
|
||||
}
|
||||
|
||||
return $this->releasedNewVersion($current, $latest, $released);
|
||||
}
|
||||
|
||||
private function parseResultDevelop(string $current, string $latest): array
|
||||
{
|
||||
Log::debug(sprintf('User is running develop version "%s"', $current));
|
||||
$compare = $this->compareDevelopVersions($current, $latest);
|
||||
$return = [];
|
||||
|
||||
if (-1 === $compare) {
|
||||
$return['level'] = 'info';
|
||||
$return['message'] = (string) trans('firefly.update_current_dev_older', ['version' => $current, 'new_version' => $latest]);
|
||||
|
||||
return $return;
|
||||
}
|
||||
$return['level'] = 'info';
|
||||
$return['message'] = (string) trans('firefly.update_current_dev_newer', ['version' => $current, 'new_version' => $latest]);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function releasedNewAlpha(string $current, string $latest, Carbon $date): array
|
||||
{
|
||||
Log::debug('New release is also a alpha!');
|
||||
$message = (string) trans('firefly.update_new_version_alert', [
|
||||
'your_version' => $current,
|
||||
'new_version' => $latest,
|
||||
'date' => $date->isoFormat((string) trans('config.month_and_day_js')),
|
||||
]);
|
||||
|
||||
return ['level' => 'success', 'message' => sprintf('%s %s', $message, trans('firefly.update_version_alpha'))];
|
||||
}
|
||||
|
||||
private function releasedNewBeta(string $current, string $latest, Carbon $date): array
|
||||
{
|
||||
Log::debug('New release is also a beta!');
|
||||
$message = (string) trans('firefly.update_new_version_alert', [
|
||||
'your_version' => $current,
|
||||
'new_version' => $latest,
|
||||
'date' => $date->isoFormat((string) trans('config.month_and_day_js')),
|
||||
]);
|
||||
|
||||
return ['level' => 'success', 'message' => sprintf('%s %s', $message, trans('firefly.update_version_beta'))];
|
||||
}
|
||||
|
||||
private function releasedNewVersion(string $current, string $latest, Carbon $date): array
|
||||
{
|
||||
Log::debug('New release is old enough.');
|
||||
$message = (string) trans('firefly.update_new_version_alert', [
|
||||
'your_version' => $current,
|
||||
'new_version' => $latest,
|
||||
'date' => $date->isoFormat((string) trans('config.month_and_day_js')),
|
||||
]);
|
||||
Log::debug('New release is here!', [$message]);
|
||||
event(new SystemFoundNewVersionOnline($message));
|
||||
|
||||
return ['level' => 'success', 'message' => $message];
|
||||
}
|
||||
|
||||
private function runsNewerVersion(string $current, string $latest): array
|
||||
{
|
||||
$return = [
|
||||
'level' => 'info',
|
||||
'message' => (string) trans('firefly.update_newer_version_alert', ['your_version' => $current, 'new_version' => $latest]),
|
||||
];
|
||||
Log::debug('User is running a newer version', $return);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function runsSameVersion(string $current): array
|
||||
{
|
||||
$return = ['level' => 'info', 'message' => (string) trans('firefly.update_current_version_alert', ['version' => $current])];
|
||||
Log::debug('User is the current version.', $return);
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,12 @@ class ExportDataGenerator
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->accounts = new Collection();
|
||||
|
||||
@@ -143,7 +143,6 @@ class AvailableBudgetCalculator
|
||||
$availableBudget = $this->abRepository->find($this->currency, $start, $end);
|
||||
$availableBudgets = $this->abRepository->findInRange($this->currency, $start, $end);
|
||||
|
||||
Log::debug(sprintf('Found #%d', $availableBudget->id));
|
||||
foreach ($availableBudgets as $item) {
|
||||
Log::debug(sprintf(
|
||||
'findInRange found available budget #%d (%s - %s), will update it.',
|
||||
|
||||
11
changelog.md
11
changelog.md
@@ -8,12 +8,23 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
> [!IMPORTANT]
|
||||
> This release is the same as 6.4.23, but only works on PHP 8.5 and higher. To continue using the latest version of Firefly III, you must upgrade to (at least) PHP 8.5.0, or switch to the Docker containers. Read more about Firefly III's release and support schedule in [`releases.md`](releases.md).
|
||||
|
||||
And yes, despite my goal not to change things, some very clever users (that's you!) found some interesting bugs that will not make it back to 6.4.x.
|
||||
|
||||
### Added
|
||||
- Support for PHP 8.5
|
||||
|
||||
### Changed
|
||||
- #11776
|
||||
- The update check now contacts GitHub directly.
|
||||
|
||||
### Removed
|
||||
- Support for PHP 8.4 and earlier
|
||||
|
||||
### Fixed
|
||||
- #11685
|
||||
- #11778
|
||||
- Test notification was broken for system owners.
|
||||
|
||||
## v6.4.23 - 2026-02-20
|
||||
|
||||
> [!WARNING]
|
||||
|
||||
@@ -79,7 +79,7 @@ return [
|
||||
// see cer.php for exchange rates feature flag.
|
||||
],
|
||||
'version' => 'develop/2026-02-21',
|
||||
'build_time' => 1771653141,
|
||||
'build_time' => 1771686731,
|
||||
'api_version' => '2.1.0', // field is no longer used.
|
||||
'db_version' => 28, // field is no longer used.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user