Compare commits

...

15 Commits

Author SHA1 Message Date
github-actions[bot]
d5bf80a0cb Merge pull request #11498 from firefly-iii/release-1768068342
🤖 Automatically merge the PR into the develop branch.
2026-01-10 19:05:49 +01:00
JC5
ef1c64096d 🤖 Auto commit for release 'develop' on 2026-01-10 2026-01-10 19:05:42 +01:00
James Cole
ef35eaffb4 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2026-01-10 18:28:21 +01:00
James Cole
869ee7c735 Add info 2026-01-10 18:28:10 +01:00
James Cole
6c534f01eb Catch null pointer. 2026-01-10 18:26:58 +01:00
github-actions[bot]
3a9d89b53d Merge pull request #11497 from firefly-iii/release-1768064652
🤖 Automatically merge the PR into the develop branch.
2026-01-10 18:04:21 +01:00
JC5
badff64cfd 🤖 Auto commit for release 'develop' on 2026-01-10 2026-01-10 18:04:12 +01:00
James Cole
abacfa212e Throw a 410. Don't report it. 2026-01-10 18:00:18 +01:00
github-actions[bot]
add2e859c4 Merge pull request #11496 from firefly-iii/release-1768064331
🤖 Automatically merge the PR into the develop branch.
2026-01-10 17:58:57 +01:00
JC5
92f6421fc4 🤖 Auto commit for release 'develop' on 2026-01-10 2026-01-10 17:58:51 +01:00
James Cole
f350c19ec1 Add some debug info. 2026-01-10 17:52:45 +01:00
James Cole
8170804d74 No error, just 404. 2026-01-10 17:50:54 +01:00
James Cole
4400f6217d Add debug logging. 2026-01-10 17:50:47 +01:00
James Cole
e223cea74e Add more feedback. 2026-01-10 17:42:51 +01:00
James Cole
2f62e11338 Add some info on the user's input. 2026-01-10 17:38:03 +01:00
7 changed files with 80 additions and 23 deletions

View File

@@ -44,6 +44,8 @@ use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
use League\Fractal\Resource\Item;
use Symfony\Component\HttpKernel\Exception\GoneHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
* Class StoreController
@@ -82,7 +84,7 @@ class StoreController extends Controller
*
* Store a new transaction.
*
* @throws FireflyException|ValidationException
* @throws FireflyException|GoneHttpException|ValidationException
*/
public function store(StoreRequest $request): JsonResponse
{
@@ -133,7 +135,7 @@ class StoreController extends Controller
$selectedGroup = $collector->getGroups()->first();
if (null === $selectedGroup) {
throw new FireflyException('200032: Cannot find transaction. Possibly, a rule deleted this transaction after its creation.');
throw HttpException::fromStatusCode(410, '200032: Cannot find transaction. Possibly, a rule deleted this transaction after its creation.');
}
// enrich

View File

@@ -198,15 +198,29 @@ class ApplyRules extends Command
$accountRepository = app(AccountRepositoryInterface::class);
$accountRepository->setUser($this->getUser());
foreach ($accountList as $accountId) {
$accountId = (int) $accountId;
$account = $accountRepository->find($accountId);
if (null !== $account && in_array($account->accountType->type, $this->acceptedAccounts, true)) {
$finalList->push($account);
$accountId = (int)$accountId;
if (0 === $accountId) {
$this->friendlyWarning('You provided an account with ID 0 (zero). It will be ignored.');
continue;
}
$account = $accountRepository->find($accountId);
if (null === $account) {
$this->friendlyWarning(sprintf('There is no account with ID #%d, it cannot be added.', $accountId));
continue;
}
$type = $account->accountType->type;
if (!in_array($account->accountType->type, $this->acceptedAccounts, true)) {
$this->friendlyWarning(sprintf('Account "%s" with ID #%d is of type "%s" and cannot be added.', $account->name, $accountId, $type));
continue;
}
$finalList->push($account);
}
if (0 === $finalList->count()) {
$this->friendlyError('Please make sure all accounts in --accounts are asset accounts or liabilities.');
$this->friendlyError('There are no accounts in the selection. Please make sure all accounts in --accounts are asset accounts or liabilities.');
return false;
}
@@ -225,13 +239,27 @@ class ApplyRules extends Command
$ruleGroupList = explode(',', $ruleGroupString);
foreach ($ruleGroupList as $ruleGroupId) {
$ruleGroup = $this->ruleGroupRepository->find((int) $ruleGroupId);
if (true === $ruleGroup->active) {
$this->ruleGroupSelection[] = $ruleGroup->id;
$ruleGroupId = (int)$ruleGroupId;
if (0 === $ruleGroupId) {
$this->friendlyWarning('You added a rule group with ID 0 (zero). It will be skipped.');
continue;
}
$ruleGroup = $this->ruleGroupRepository->find($ruleGroupId);
if (null === $ruleGroup) {
$this->friendlyWarning(sprintf('There is no rule group with ID #%d, this ID will be ignored.', $ruleGroupId));
continue;
}
if (false === $ruleGroup->active) {
$this->friendlyWarning(sprintf('Will ignore inactive rule group #%d ("%s")', $ruleGroup->id, $ruleGroup->title));
$this->friendlyWarning(sprintf('Rule group with ID #%d is not active, so this ID will be ignored.', $ruleGroupId));
continue;
}
$this->ruleGroupSelection[] = $ruleGroupId;
}
return true;
@@ -247,10 +275,24 @@ class ApplyRules extends Command
$ruleList = explode(',', $ruleString);
foreach ($ruleList as $ruleId) {
$rule = $this->ruleRepository->find((int) $ruleId);
if ($rule instanceof Rule && true === $rule->active) {
$this->ruleSelection[] = $rule->id;
$ruleId = (int)$ruleId;
if (0 === $ruleId) {
$this->friendlyWarning('You added a rule with ID 0 (zero). It will be skipped.');
continue;
}
$rule = $this->ruleRepository->find($ruleId);
if (null === $rule) {
$this->friendlyWarning(sprintf('There is no rule with ID #%d, this ID will be ignored.', $ruleId));
continue;
}
if (false === $rule->active) {
$this->friendlyWarning(sprintf('Rule with ID #%d is not active, so this ID will be ignored.', $ruleId));
continue;
}
$this->ruleSelection[] = $ruleId;
}
return true;
@@ -304,10 +346,12 @@ class ApplyRules extends Command
private function getRulesToApply(): Collection
{
Log::debug('getRulesToApply()');
$rulesToApply = new Collection();
/** @var RuleGroup $group */
foreach ($this->groups as $group) {
Log::debug(sprintf('Scanning rule group #%d', $group->id));
$rules = $this->ruleGroupRepository->getActiveStoreRules($group);
/** @var Rule $rule */
@@ -318,16 +362,20 @@ class ApplyRules extends Command
Log::debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title));
$rulesToApply->push($rule);
}
if (!$test) {
Log::debug(sprintf('Will not include rule #%d', $rule->id));
}
}
}
Log::debug(sprintf('Found %d rules to apply.', $rulesToApply->count()));
return $rulesToApply;
}
private function includeRule(Rule $rule, RuleGroup $group): bool
{
return in_array($group->id, $this->ruleGroupSelection, true)
|| in_array($rule->id, $this->ruleSelection, true)
return in_array((int)$group->id, $this->ruleGroupSelection, true)
|| in_array((int)$rule->id, $this->ruleSelection, true)
|| $this->allRules;
}
}

View File

@@ -45,6 +45,7 @@ use Override;
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\GoneHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -71,6 +72,7 @@ class Handler extends ExceptionHandler
AuthenticationException::class,
LaravelValidationException::class,
NotFoundHttpException::class,
GoneHttpException::class,
OAuthServerException::class,
LaravelOAuthException::class,
TokenMismatchException::class,

View File

@@ -70,8 +70,12 @@ class UpdatedGroupEventHandler
foreach ($event->transactionGroup->transactionJournals as $journal) {
$source = $journal->transactions()->where('amount', '<', '0')->first();
$dest = $journal->transactions()->where('amount', '>', '0')->first();
$repository->deleteStatisticsForModel($source->account, $journal->date);
$repository->deleteStatisticsForModel($dest->account, $journal->date);
if (null !== $source) {
$repository->deleteStatisticsForModel($source->account, $journal->date);
}
if (null !== $dest) {
$repository->deleteStatisticsForModel($dest->account, $journal->date);
}
$categories = $journal->categories;
$tags = $journal->tags;

View File

@@ -720,6 +720,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface
->transactionJournals()
->whereNotNull('bill_id')
->where('transaction_type_id', '!=', $withdrawal->id)
->update(['bill_id' => null]);
->update(['bill_id' => null])
;
}
}

View File

@@ -79,7 +79,7 @@ return [
// see cer.php for exchange rates feature flag.
],
'version' => 'develop/2026-01-10',
'build_time' => 1768053746,
'build_time' => 1768068238,
'api_version' => '2.1.0', // field is no longer used.
'db_version' => 28, // field is no longer used.

6
package-lock.json generated
View File

@@ -3218,9 +3218,9 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "25.0.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.5.tgz",
"integrity": "sha512-FuLxeLuSVOqHPxSN1fkcD8DLU21gAP7nCKqGRJ/FglbCUBs0NYN6TpHcdmyLeh8C0KwGIaZQJSv+OYG+KZz+Gw==",
"version": "25.0.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.6.tgz",
"integrity": "sha512-NNu0sjyNxpoiW3YuVFfNz7mxSQ+S4X2G28uqg2s+CzoqoQjLPsWSbsFFyztIAqt2vb8kfEAsJNepMGPTxFDx3Q==",
"dev": true,
"license": "MIT",
"dependencies": {