mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 09:52:20 +00:00
🤖 Auto commit for release 'develop' on 2025-08-09
This commit is contained in:
@@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Events\Model\Bill;
|
namespace FireflyIII\Events\Model\Bill;
|
||||||
|
|
||||||
use FireflyIII\Events\Event;
|
use FireflyIII\Events\Event;
|
||||||
use FireflyIII\Models\Bill;
|
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class BillEventHandler
|
|||||||
$pref = Preferences::getForUser($bill->user, $key, false);
|
$pref = Preferences::getForUser($bill->user, $key, false);
|
||||||
if (true === $pref->data) {
|
if (true === $pref->data) {
|
||||||
Log::debug(sprintf('User #%d has already been warned about overdue subscription #%d.', $bill->user->id, $bill->id));
|
Log::debug(sprintf('User #%d has already been warned about overdue subscription #%d.', $bill->user->id, $bill->id));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$toBeWarned[] = $item;
|
$toBeWarned[] = $item;
|
||||||
@@ -65,11 +66,13 @@ class BillEventHandler
|
|||||||
$sendNotification = Preferences::getForUser($user, 'notification_bill_reminder', true)->data;
|
$sendNotification = Preferences::getForUser($user, 'notification_bill_reminder', true)->data;
|
||||||
if (false === $sendNotification) {
|
if (false === $sendNotification) {
|
||||||
Log::debug('User has disabled bill reminders.');
|
Log::debug('User has disabled bill reminders.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log::debug(sprintf('Will warning about %d overdue subscription(s).', count($toBeWarned)));
|
Log::debug(sprintf('Will warning about %d overdue subscription(s).', count($toBeWarned)));
|
||||||
if (0 === count($toBeWarned)) {
|
if (0 === count($toBeWarned)) {
|
||||||
Log::debug('No overdue subscriptions to warn about.');
|
Log::debug('No overdue subscriptions to warn about.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
foreach ($toBeWarned as $item) {
|
foreach ($toBeWarned as $item) {
|
||||||
@@ -79,6 +82,7 @@ class BillEventHandler
|
|||||||
Preferences::setForUser($bill->user, $key, true);
|
Preferences::setForUser($bill->user, $key, true);
|
||||||
}
|
}
|
||||||
Log::warning('should hit this ONCE');
|
Log::warning('should hit this ONCE');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Notification::send($user, new SubscriptionsOverdueReminder($overdue));
|
Notification::send($user, new SubscriptionsOverdueReminder($overdue));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ class WarnAboutBills implements ShouldQueue
|
|||||||
foreach (User::all() as $user) {
|
foreach (User::all() as $user) {
|
||||||
$bills = $user->bills()->where('active', true)->get();
|
$bills = $user->bills()->where('active', true)->get();
|
||||||
$overdue = [];
|
$overdue = [];
|
||||||
|
|
||||||
/** @var Bill $bill */
|
/** @var Bill $bill */
|
||||||
foreach ($bills as $bill) {
|
foreach ($bills as $bill) {
|
||||||
Log::debug(sprintf('Now checking bill #%d ("%s")', $bill->id, $bill->name));
|
Log::debug(sprintf('Now checking bill #%d ("%s")', $bill->id, $bill->name));
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ class SubscriptionsOverdueReminder extends Notification
|
|||||||
{
|
{
|
||||||
use Queueable;
|
use Queueable;
|
||||||
|
|
||||||
public function __construct(private array $overdue)
|
public function __construct(private array $overdue) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
|
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
|
||||||
@@ -46,13 +44,17 @@ class SubscriptionsOverdueReminder extends Notification
|
|||||||
$current['pay_dates'] = array_map(
|
$current['pay_dates'] = array_map(
|
||||||
static function (string $date): string {
|
static function (string $date): string {
|
||||||
return new Carbon($date)->isoFormat((string)trans('config.month_and_day_moment_js'));
|
return new Carbon($date)->isoFormat((string)trans('config.month_and_day_moment_js'));
|
||||||
}, $item['dates']['pay_dates']);
|
},
|
||||||
|
$item['dates']['pay_dates']
|
||||||
|
);
|
||||||
$info[] = $current;
|
$info[] = $current;
|
||||||
$count++;
|
++$count;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MailMessage()
|
return new MailMessage()
|
||||||
->markdown('emails.subscriptions-overdue-warning', ['info' => $info, 'count' => $count])
|
->markdown('emails.subscriptions-overdue-warning', ['info' => $info, 'count' => $count])
|
||||||
->subject($this->getSubject());
|
->subject($this->getSubject())
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSubject(): string
|
private function getSubject(): string
|
||||||
@@ -60,6 +62,7 @@ class SubscriptionsOverdueReminder extends Notification
|
|||||||
if (count($this->overdue) > 1) {
|
if (count($this->overdue) > 1) {
|
||||||
return (string)trans('email.subscriptions_overdue_subject_multi', ['count' => count($this->overdue)]);
|
return (string)trans('email.subscriptions_overdue_subject_multi', ['count' => count($this->overdue)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string)trans('email.subscriptions_overdue_subject_single');
|
return (string)trans('email.subscriptions_overdue_subject_single');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +83,8 @@ class SubscriptionsOverdueReminder extends Notification
|
|||||||
public function toPushover(User $notifiable): PushoverMessage
|
public function toPushover(User $notifiable): PushoverMessage
|
||||||
{
|
{
|
||||||
return PushoverMessage::create((string)trans('email.bill_warning_please_action'))
|
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(static function ($attachment) use ($bill, $url): void {
|
||||||
$attachment->title((string)trans('firefly.visit_bill', ['name' => $bill->name]), $url);
|
$attachment->title((string)trans('firefly.visit_bill', ['name' => $bill->name]), $url);
|
||||||
})
|
})
|
||||||
->content($this->getSubject());
|
->content($this->getSubject())
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ return [
|
|||||||
// see cer.php for exchange rates feature flag.
|
// see cer.php for exchange rates feature flag.
|
||||||
],
|
],
|
||||||
'version' => 'develop/2025-08-09',
|
'version' => 'develop/2025-08-09',
|
||||||
'build_time' => 1754719342,
|
'build_time' => 1754721409,
|
||||||
'api_version' => '2.1.0', // field is no longer used.
|
'api_version' => '2.1.0', // field is no longer used.
|
||||||
'db_version' => 26,
|
'db_version' => 26,
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user