Skip to content

A free open source IT asset/license management system

cc emails are notified when asset is accepted

Godfrey M2252c80a250e
diff --git a/app/Models/CheckoutAcceptance.php b/app/Models/CheckoutAcceptance.php
index cbdbcd3cbb..da5025c5c7 100644
--- a/app/Models/CheckoutAcceptance.php
+++ b/app/Models/CheckoutAcceptance.php
@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;
use TCPDF;
-
+use Illuminate\Support\Facades\Log;
class CheckoutAcceptance extends Model
{
use HasFactory, Notifiable, SoftDeletes;
@@ -30,12 +30,25 @@ class CheckoutAcceptance extends Model
*/
public function routeNotificationForMail()
{
- // At this point the endpoint is the same for everything.
- // In the future this may want to be adapted for individual notifications.
- $recipients_string = explode(',', Setting::getSettings()->alert_email);
- $recipients = array_map('trim', $recipients_string);
+ $settings = Setting::getSettings();
+
+ $recipients = [];
- return array_filter($recipients);
+ if (!empty($settings->alert_email)) {
+ $recipients = array_merge(
+ $recipients,
+ array_map('trim', explode(',', $settings->alert_email))
+ );
+ }
+
+ if (!empty($settings->admin_cc_email)) {
+ $recipients = array_merge(
+ $recipients,
+ array_map('trim', explode(',', $settings->admin_cc_email))
+ );
+ }
+
+ return array_values(array_unique(array_filter($recipients)));
}
public function getCheckoutableItemTypeAttribute(): string
diff --git a/app/Notifications/AcceptanceItemAcceptedNotification.php b/app/Notifications/AcceptanceItemAcceptedNotification.php
index dc879fa2a1..794ddcc8d8 100644
--- a/app/Notifications/AcceptanceItemAcceptedNotification.php
+++ b/app/Notifications/AcceptanceItemAcceptedNotification.php
@@ -65,7 +65,9 @@ class AcceptanceItemAcceptedNotification extends Notification implements ShouldQ
public function shouldSend($notifiable, $channel)
{
- return Setting::getSettings()->alerts_enabled && !empty(Setting::getSettings()->alert_email);
+ $settings = Setting::getSettings();
+
+ return $settings->alerts_enabled && (!empty($settings->alert_email) || !empty($settings->cc_email));
}
/**