mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-23 12:44:12 -08:00
Patch for 5965 - multiple email recipients no longer working (#6238)
This commit is contained in:
parent
b69b5fdf84
commit
ffbee77f6f
|
@ -57,12 +57,12 @@ class SendExpectedCheckinAlerts extends Command
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Send a rollup to the admin, if settings dictate
|
||||
$recipient = new \App\Models\Recipients\AlertRecipient();
|
||||
|
||||
if (($assets) && ($assets->count() > 0) && ($settings->alert_email!='')) {
|
||||
$recipient->notify(new ExpectedCheckinAdminNotification($assets));
|
||||
if (($assets) && ($assets->count() > 0) && ($settings->alert_email != '')) {
|
||||
// Send a rollup to the admin, if settings dictate
|
||||
$recipients = collect(explode(',', $settings->alert_email))->map(function ($item, $key) {
|
||||
return new \App\Models\Recipients\AlertRecipient($item);
|
||||
});
|
||||
\Notification::send($recipients, new ExpectedCheckinAdminNotification($assets));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,26 +50,27 @@ class SendExpirationAlerts extends Command
|
|||
$threshold = $settings->alert_interval;
|
||||
|
||||
|
||||
// Expiring Assets
|
||||
$assets = Asset::getExpiringWarrantee(Setting::getSettings()->alert_interval);
|
||||
$this->info(trans_choice('mail.assets_warrantee_alert', $assets->count(), ['count'=>$assets->count(), 'threshold' => $threshold]));
|
||||
if (($settings->alert_email != '') && ($settings->alerts_enabled == 1)) {
|
||||
|
||||
// Expiring licenses
|
||||
$licenses = License::getExpiringLicenses($threshold);
|
||||
|
||||
$this->info(trans_choice('mail.license_expiring_alert', $licenses->count(), ['count'=>$licenses->count(), 'threshold' => $threshold]));
|
||||
|
||||
$recipient = new \App\Models\Recipients\AlertRecipient();
|
||||
|
||||
if ((Setting::getSettings()->alert_email!='') && ($settings->alerts_enabled==1)) {
|
||||
// Send a rollup to the admin, if settings dictate
|
||||
$recipients = collect(explode(',', $settings->alert_email))->map(function ($item, $key) {
|
||||
return new \App\Models\Recipients\AlertRecipient($item);
|
||||
});
|
||||
|
||||
// Expiring Assets
|
||||
$assets = Asset::getExpiringWarrantee(Setting::getSettings()->alert_interval);
|
||||
if ($assets->count() > 0) {
|
||||
// Send a rollup to the admin, if settings dictate
|
||||
$recipient->notify(new ExpiringAssetsNotification($assets, $threshold));
|
||||
$this->info(trans_choice('mail.assets_warrantee_alert', $assets->count(),
|
||||
['count' => $assets->count(), 'threshold' => $threshold]));
|
||||
}
|
||||
|
||||
// Expiring licenses
|
||||
$licenses = License::getExpiringLicenses($threshold);
|
||||
|
||||
|
||||
if ($licenses->count() > 0) {
|
||||
$recipient->notify(new ExpiringLicenseNotification($licenses, $threshold));
|
||||
$this->info(trans_choice('mail.license_expiring_alert', $licenses->count(), ['count' => $licenses->count(), 'threshold' => $threshold]));
|
||||
\Notification::send($recipients, new ExpiringLicenseNotification($licenses, $threshold));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,13 +50,14 @@ class SendInventoryAlerts extends Command
|
|||
$items = Helper::checkLowInventory();
|
||||
|
||||
// Send a rollup to the admin, if settings dictate
|
||||
$recipient = new \App\Models\Recipients\AlertRecipient();
|
||||
|
||||
if (($items) && (count($items) > 0) && ($settings->alert_email!='')) {
|
||||
|
||||
$this->info( trans_choice('mail.low_inventory_alert',count($items)) );
|
||||
|
||||
$recipient->notify(new InventoryAlert($items, $settings->alert_threshold));
|
||||
if (($items) && (count($items) > 0)) {
|
||||
$this->info(trans_choice('mail.low_inventory_alert', count($items)));
|
||||
// Send a rollup to the admin, if settings dictate
|
||||
$recipients = collect(explode(',', $settings->alert_email))->map(function ($item, $key) {
|
||||
return new \App\Models\Recipients\AlertRecipient($item);
|
||||
});
|
||||
\Notification::send($recipients, new InventoryAlert($items, $settings->alert_threshold));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
@ -5,10 +5,9 @@ use App\Models\Setting;
|
|||
|
||||
class AlertRecipient extends Recipient{
|
||||
|
||||
public function __construct()
|
||||
public function __construct(string $email)
|
||||
{
|
||||
$settings = Setting::getSettings();
|
||||
$this->email = $settings->alert_email;
|
||||
$this->email = trim($email);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue