Skip to content

Firefly III: a personal finances manager

🤖 Auto commit for release 'develop' on 2025-08-09

JC5da8e78c28d39
diff --git a/app/Events/Model/Bill/WarnUserAboutOverdueSubscriptions.php b/app/Events/Model/Bill/WarnUserAboutOverdueSubscriptions.php
index d7a4248778..0e84a849dd 100644
--- a/app/Events/Model/Bill/WarnUserAboutOverdueSubscriptions.php
+++ b/app/Events/Model/Bill/WarnUserAboutOverdueSubscriptions.php
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace FireflyIII\Events\Model\Bill;
use FireflyIII\Events\Event;
-use FireflyIII\Models\Bill;
use FireflyIII\User;
use Illuminate\Queue\SerializesModels;
diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.php
index 37210c1f9a..48cabb95e8 100644
--- a/app/Handlers/Events/BillEventHandler.php
+++ b/app/Handlers/Events/BillEventHandler.php
@@ -43,17 +43,18 @@ class BillEventHandler
{
Log::debug(sprintf('Now in %s', __METHOD__));
// make sure user does not get the warning twice.
- $overdue = $event->overdue;
- $user = $event->user;
- $toBeWarned = [];
+ $overdue = $event->overdue;
+ $user = $event->user;
+ $toBeWarned = [];
Log::debug(sprintf('%d bills to warn about.', count($overdue)));
foreach ($overdue as $item) {
/** @var Bill $bill */
- $bill = $item['bill'];
- $key = sprintf('bill_overdue_%s_%s', $bill->id, substr(hash('sha256', json_encode($item['dates']['pay_dates'], JSON_THROW_ON_ERROR)), 0, 10));
- $pref = Preferences::getForUser($bill->user, $key, false);
+ $bill = $item['bill'];
+ $key = sprintf('bill_overdue_%s_%s', $bill->id, substr(hash('sha256', json_encode($item['dates']['pay_dates'], JSON_THROW_ON_ERROR)), 0, 10));
+ $pref = Preferences::getForUser($bill->user, $key, false);
if (true === $pref->data) {
Log::debug(sprintf('User #%d has already been warned about overdue subscription #%d.', $bill->user->id, $bill->id));
+
continue;
}
$toBeWarned[] = $item;
@@ -65,11 +66,13 @@ class BillEventHandler
$sendNotification = Preferences::getForUser($user, 'notification_bill_reminder', true)->data;
if (false === $sendNotification) {
Log::debug('User has disabled bill reminders.');
+
return;
}
Log::debug(sprintf('Will warning about %d overdue subscription(s).', count($toBeWarned)));
if (0 === count($toBeWarned)) {
Log::debug('No overdue subscriptions to warn about.');
+
return;
}
foreach ($toBeWarned as $item) {
@@ -79,6 +82,7 @@ class BillEventHandler
Preferences::setForUser($bill->user, $key, true);
}
Log::warning('should hit this ONCE');
+
try {
Notification::send($user, new SubscriptionsOverdueReminder($overdue));
} catch (Exception $e) {
diff --git a/app/Jobs/WarnAboutBills.php b/app/Jobs/WarnAboutBills.php
index 20c6fd090e..155454790e 100644
--- a/app/Jobs/WarnAboutBills.php
+++ b/app/Jobs/WarnAboutBills.php
@@ -56,12 +56,12 @@ class WarnAboutBills implements ShouldQueue
*/
public function __construct(?Carbon $date)
{
- $newDate = new Carbon();
+ $newDate = new Carbon();
$newDate->startOfDay();
- $this->date = $newDate;
+ $this->date = $newDate;
if ($date instanceof Carbon) {
- $newDate = clone $date;
+ $newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
}
@@ -80,6 +80,7 @@ class WarnAboutBills implements ShouldQueue
foreach (User::all() as $user) {
$bills = $user->bills()->where('active', true)->get();
$overdue = [];
+
/** @var Bill $bill */
foreach ($bills as $bill) {
Log::debug(sprintf('Now checking bill #%d ("%s")', $bill->id, $bill->name));
@@ -150,7 +151,7 @@ class WarnAboutBills implements ShouldQueue
public function setDate(Carbon $date): void
{
- $newDate = clone $date;
+ $newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
}
@@ -170,7 +171,7 @@ class WarnAboutBills implements ShouldQueue
$enrichment->setUser($bill->user);
$enrichment->setStart($start);
$enrichment->setEnd($end);
- $single = $enrichment->enrichSingle($bill);
+ $single = $enrichment->enrichSingle($bill);
return [
'pay_dates' => $single->meta['pay_dates'] ?? [],
@@ -180,7 +181,7 @@ class WarnAboutBills implements ShouldQueue
private function needsOverdueAlert(array $dates): bool
{
- $count = count($dates['pay_dates']) - count($dates['paid_dates']);
+ $count = count($dates['pay_dates']) - count($dates['paid_dates']);
if (0 === $count || 0 === count($dates['pay_dates'])) {
return false;
}
@@ -188,7 +189,7 @@ class WarnAboutBills implements ShouldQueue
$earliest = new Carbon($dates['pay_dates'][0]);
$earliest->startOfDay();
Log::debug(sprintf('Earliest expected pay date is %s', $earliest->toAtomString()));
- $diff = $earliest->diffInDays($this->date);
+ $diff = $earliest->diffInDays($this->date);
Log::debug(sprintf('Difference in days is %s', $diff));
if ($diff < 2) {
return false;
diff --git a/app/Notifications/User/SubscriptionsOverdueReminder.php b/app/Notifications/User/SubscriptionsOverdueReminder.php
index 5684e5ef28..4df8ccf7df 100644
--- a/app/Notifications/User/SubscriptionsOverdueReminder.php
+++ b/app/Notifications/User/SubscriptionsOverdueReminder.php
@@ -18,9 +18,7 @@ class SubscriptionsOverdueReminder extends Notification
{
use Queueable;
- public function __construct(private array $overdue)
- {
- }
+ public function __construct(private array $overdue) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
@@ -37,7 +35,7 @@ class SubscriptionsOverdueReminder extends Notification
public function toMail(User $notifiable): MailMessage
{
// format the data
- $info = [];
+ $info = [];
$count = 0;
foreach ($this->overdue as $item) {
$current = [
@@ -46,13 +44,17 @@ class SubscriptionsOverdueReminder extends Notification
$current['pay_dates'] = array_map(
static function (string $date): string {
return new Carbon($date)->isoFormat((string)trans('config.month_and_day_moment_js'));
- }, $item['dates']['pay_dates']);
+ },
+ $item['dates']['pay_dates']
+ );
$info[] = $current;
- $count++;
+ ++$count;
}
+
return new MailMessage()
- ->markdown('emails.subscriptions-overdue-warning', ['info' => $info,'count' => $count])
- ->subject($this->getSubject());
+ ->markdown('emails.subscriptions-overdue-warning', ['info' => $info, 'count' => $count])
+ ->subject($this->getSubject())
+ ;
}
private function getSubject(): string
@@ -60,6 +62,7 @@ class SubscriptionsOverdueReminder extends Notification
if (count($this->overdue) > 1) {
return (string)trans('email.subscriptions_overdue_subject_multi', ['count' => count($this->overdue)]);
}
+
return (string)trans('email.subscriptions_overdue_subject_single');
}
@@ -80,7 +83,8 @@ class SubscriptionsOverdueReminder extends Notification
public function toPushover(User $notifiable): PushoverMessage
{
return PushoverMessage::create((string)trans('email.bill_warning_please_action'))
- ->title($this->getSubject());
+ ->title($this->getSubject())
+ ;
}
/**
@@ -96,7 +100,8 @@ class SubscriptionsOverdueReminder extends Notification
->attachment(static function ($attachment) use ($bill, $url): void {
$attachment->title((string)trans('firefly.visit_bill', ['name' => $bill->name]), $url);
})
- ->content($this->getSubject());
+ ->content($this->getSubject())
+ ;
}
/**
diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php
index ede84b5ea4..1b7e75dfe2 100644
--- a/app/Providers/EventServiceProvider.php
+++ b/app/Providers/EventServiceProvider.php
@@ -115,92 +115,92 @@ class EventServiceProvider extends ServiceProvider
protected $listen
= [
// is a User related event.
- RegisteredUser::class => [
+ RegisteredUser::class => [
'FireflyIII\Handlers\Events\UserEventHandler@sendRegistrationMail',
'FireflyIII\Handlers\Events\UserEventHandler@sendAdminRegistrationNotification',
'FireflyIII\Handlers\Events\UserEventHandler@attachUserRole',
'FireflyIII\Handlers\Events\UserEventHandler@createGroupMembership',
'FireflyIII\Handlers\Events\UserEventHandler@createExchangeRates',
],
- UserAttemptedLogin::class => [
+ UserAttemptedLogin::class => [
'FireflyIII\Handlers\Events\UserEventHandler@sendLoginAttemptNotification',
],
// is a User related event.
- Login::class => [
+ Login::class => [
'FireflyIII\Handlers\Events\UserEventHandler@checkSingleUserIsAdmin',
'FireflyIII\Handlers\Events\UserEventHandler@demoUserBackToEnglish',
],
- ActuallyLoggedIn::class => [
+ ActuallyLoggedIn::class => [
'FireflyIII\Handlers\Events\UserEventHandler@storeUserIPAddress',
],
- DetectedNewIPAddress::class => [
+ DetectedNewIPAddress::class => [
'FireflyIII\Handlers\Events\UserEventHandler@notifyNewIPAddress',
],
- RequestedVersionCheckStatus::class => [
+ RequestedVersionCheckStatus::class => [
'FireflyIII\Handlers\Events\VersionCheckEventHandler@checkForUpdates',
],
- RequestedReportOnJournals::class => [
+ RequestedReportOnJournals::class => [
'FireflyIII\Handlers\Events\AutomationHandler@reportJournals',
],
// is a User related event.
- RequestedNewPassword::class => [
+ RequestedNewPassword::class => [
'FireflyIII\Handlers\Events\UserEventHandler@sendNewPassword',
],
- UserTestNotificationChannel::class => [
+ UserTestNotificationChannel::class => [
'FireflyIII\Handlers\Events\UserEventHandler@sendTestNotification',
],
// is a User related event.
- UserChangedEmail::class => [
+ UserChangedEmail::class => [
'FireflyIII\Handlers\Events\UserEventHandler@sendEmailChangeConfirmMail',
'FireflyIII\Handlers\Events\UserEventHandler@sendEmailChangeUndoMail',
],
// admin related
- OwnerTestNotificationChannel::class => [
+ OwnerTestNotificationChannel::class => [
'FireflyIII\Handlers\Events\AdminEventHandler@sendTestNotification',
],
- NewVersionAvailable::class => [
+ NewVersionAvailable::class => [
'FireflyIII\Handlers\Events\AdminEventHandler@sendNewVersion',
],
- InvitationCreated::class => [
+ InvitationCreated::class => [
'FireflyIII\Handlers\Events\AdminEventHandler@sendInvitationNotification',
'FireflyIII\Handlers\Events\UserEventHandler@sendRegistrationInvite',
],
- UnknownUserAttemptedLogin::class => [
+ UnknownUserAttemptedLogin::class => [
'FireflyIII\Handlers\Events\AdminEventHandler@sendLoginAttemptNotification',
],
// is a Transaction Journal related event.
- StoredTransactionGroup::class => [
+ StoredTransactionGroup::class => [
'FireflyIII\Handlers\Events\StoredGroupEventHandler@runAllHandlers',
],
// is a Transaction Journal related event.
- UpdatedTransactionGroup::class => [
+ UpdatedTransactionGroup::class => [
'FireflyIII\Handlers\Events\UpdatedGroupEventHandler@runAllHandlers',
],
- DestroyedTransactionGroup::class => [
+ DestroyedTransactionGroup::class => [
'FireflyIII\Handlers\Events\DestroyedGroupEventHandler@runAllHandlers',
],
// API related events:
- AccessTokenCreated::class => [
+ AccessTokenCreated::class => [
'FireflyIII\Handlers\Events\APIEventHandler@accessTokenCreated',
],
// Webhook related event:
- RequestedSendWebhookMessages::class => [
+ RequestedSendWebhookMessages::class => [
'FireflyIII\Handlers\Events\WebhookEventHandler@sendWebhookMessages',
],
// account related events:
- StoredAccount::class => [
+ StoredAccount::class => [
'FireflyIII\Handlers\Events\StoredAccountEventHandler@recalculateCredit',
],
- UpdatedAccount::class => [
+ UpdatedAccount::class => [
'FireflyIII\Handlers\Events\UpdatedAccountEventHandler@recalculateCredit',
],
// bill related events:
- WarnUserAboutBill::class => [
+ WarnUserAboutBill::class => [
'FireflyIII\Handlers\Events\BillEventHandler@warnAboutBill',
],
WarnUserAboutOverdueSubscriptions::class => [
@@ -208,60 +208,60 @@ class EventServiceProvider extends ServiceProvider
],
// audit log events:
- TriggeredAuditLog::class => [
+ TriggeredAuditLog::class => [
'FireflyIII\Handlers\Events\AuditEventHandler@storeAuditEvent',
],
// piggy bank related events:
- ChangedAmount::class => [
+ ChangedAmount::class => [
'FireflyIII\Handlers\Events\Model\PiggyBankEventHandler@changePiggyAmount',
],
- ChangedName::class => [
+ ChangedName::class => [
'FireflyIII\Handlers\Events\Model\PiggyBankEventHandler@changedPiggyBankName',
],
// budget related events: CRUD budget limit
- Created::class => [
+ Created::class => [
'FireflyIII\Handlers\Events\Model\BudgetLimitHandler@created',
],
- Updated::class => [
+ Updated::class => [
'FireflyIII\Handlers\Events\Model\BudgetLimitHandler@updated',
],
- Deleted::class => [
+ Deleted::class => [
'FireflyIII\Handlers\Events\Model\BudgetLimitHandler@deleted',
],
// rule actions
- RuleActionFailedOnArray::class => [
+ RuleActionFailedOnArray::class => [
'FireflyIII\Handlers\Events\Model\RuleHandler@ruleActionFailedOnArray',
],
- RuleActionFailedOnObject::class => [
+ RuleActionFailedOnObject::class => [
'FireflyIII\Handlers\Events\Model\RuleHandler@ruleActionFailedOnObject',
],
// security related
- EnabledMFA::class => [
+ EnabledMFA::class => [
'FireflyIII\Handlers\Events\Security\MFAHandler@sendMFAEnabledMail',
],
- DisabledMFA::class => [
+ DisabledMFA::class => [
'FireflyIII\Handlers\Events\Security\MFAHandler@sendMFADisabledMail',
],
- MFANewBackupCodes::class => [
+ MFANewBackupCodes::class => [
'FireflyIII\Handlers\Events\Security\MFAHandler@sendNewMFABackupCodesMail',
],
- MFAUsedBackupCode::class => [
+ MFAUsedBackupCode::class => [
'FireflyIII\Handlers\Events\Security\MFAHandler@sendUsedBackupCodeMail',
],
- MFABackupFewLeft::class => [
+ MFABackupFewLeft::class => [
'FireflyIII\Handlers\Events\Security\MFAHandler@sendBackupFewLeftMail',
],
- MFABackupNoLeft::class => [
+ MFABackupNoLeft::class => [
'FireflyIII\Handlers\Events\Security\MFAHandler@sendBackupNoLeftMail',
],
- MFAManyFailedAttempts::class => [
+ MFAManyFailedAttempts::class => [
'FireflyIII\Handlers\Events\Security\MFAHandler@sendMFAFailedAttemptsMail',
],
// preferences
- UserGroupChangedPrimaryCurrency::class => [
+ UserGroupChangedPrimaryCurrency::class => [
'FireflyIII\Handlers\Events\PreferencesEventHandler@resetPrimaryCurrencyAmounts',
],
];
diff --git a/config/firefly.php b/config/firefly.php
index 0ce7722011..da7181a633 100644
--- a/config/firefly.php
+++ b/config/firefly.php
@@ -79,7 +79,7 @@ return [
// see cer.php for exchange rates feature flag.
],
'version' => 'develop/2025-08-09',
- 'build_time' => 1754719342,
+ 'build_time' => 1754721409,
'api_version' => '2.1.0', // field is no longer used.
'db_version' => 26,