A free open source IT asset/license management system
Fixed some more Notifications, but I don't think we're done yet
Brady Wetheringtond850f86a242d
diff --git a/app/Notifications/AcceptanceItemAcceptedNotification.php b/app/Notifications/AcceptanceItemAcceptedNotification.phpindex b6127e985c..1712361876 100644--- a/app/Notifications/AcceptanceItemAcceptedNotification.php+++ b/app/Notifications/AcceptanceItemAcceptedNotification.php@@ -10,11 +10,23 @@ use Illuminate\Notifications\Messages\MailMessage;use Illuminate\Notifications\Notification;use Symfony\Component\Mime\Email;-#[AllowDynamicProperties]class AcceptanceItemAcceptedNotification extends Notification implements ShouldQueue{use Queueable;+ public $item_tag;+ public $item_name;+ public $item_model;+ public $item_serial;+ public $item_status;+ public $accepted_date;+ public $assigned_to;+ public $company_name;+ public $file;+ public $qty;+ public $note;+ public $custom_fields;+/*** Create a new notification instance.*@@ -30,7 +42,6 @@ class AcceptanceItemAcceptedNotification extends Notification implements ShouldQ$this->accepted_date = $params['accepted_date'];$this->assigned_to = $params['assigned_to'];$this->company_name = $params['company_name'];- $this->settings = Setting::getSettings();$this->file = $params['file'] ?? null;$this->qty = $params['qty'] ?? null;$this->note = $params['note'] ?? null;@@ -55,7 +66,7 @@ class AcceptanceItemAcceptedNotification extends Notification implements ShouldQpublic function shouldSend($notifiable, $channel){- return $this->settings->alerts_enabled && ! empty($this->settings->alert_email);+ return Setting::getSettings()->alerts_enabled && !empty(Setting::getSettings()->alert_email);}/**diff --git a/app/Notifications/RequestAssetCancelation.php b/app/Notifications/RequestAssetCancelation.phpindex 9239d4049b..a980179108 100644--- a/app/Notifications/RequestAssetCancelation.php+++ b/app/Notifications/RequestAssetCancelation.php@@ -11,10 +11,15 @@ use Illuminate\Notifications\Notification;use Illuminate\Support\Facades\Log;use Symfony\Component\Mime\Email;-#[AllowDynamicProperties]class RequestAssetCancelation extends Notification implements ShouldQueue{- private $params;+ public $target;+ public $item;+ public $note;+ public $last_checkout;+ public $item_quantity;+ public $expected_checkin;+ public $requested_date;/*** Create a new notification instance.@@ -29,7 +34,6 @@ class RequestAssetCancelation extends Notification implements ShouldQueue$this->expected_checkin = '';$this->requested_date = Helper::getFormattedDateObject($params['requested_date'], 'datetime',false);- $this->settings = Setting::getSettings();if (array_key_exists('note', $params)) {$this->note = $params['note'];@@ -72,8 +76,8 @@ class RequestAssetCancelation extends Notification implements ShouldQueue$item = $this->item;$note = $this->note;$qty = $this->item_quantity;- $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';- $channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';+ $botname = (Setting::getSettings()->webhook_botname) ? Setting::getSettings()->webhook_botname : 'Snipe-Bot';+ $channel = (Setting::getSettings()->webhook_channel) ? Setting::getSettings()->webhook_channel : '';$fields = ['QTY' => $qty,diff --git a/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php b/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.phpindex 882a7c8aa7..fd1d15a011 100644--- a/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php+++ b/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php@@ -49,7 +49,6 @@ class AccessoryAcceptanceTest extends TestCasepublic function test_can_decline_accessory_checkout(){- $this->settings->disableAlertEmail(); //FIXME - it tries to send an email without having enough information, because the mailer is broken for queueing$assignee = User::factory()->create();$accessory = Accessory::factory()->create();diff --git a/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php b/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.phpindex 5c2c3ef4b7..e8df082bc9 100644--- a/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php+++ b/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php@@ -186,7 +186,6 @@ class AssetAcceptanceTest extends TestCasepublic function test_action_logged_when_declining_asset(){- $this->settings->disableAlertEmail(); //FIXME - it tries to send an email without having enough information, because the mailer is broken for queueing$checkoutAcceptance = CheckoutAcceptance::factory()->pending()->create();$this->actingAs($checkoutAcceptance->assignedTo)diff --git a/tests/Feature/CheckoutAcceptances/Ui/ConsumableAcceptanceTest.php b/tests/Feature/CheckoutAcceptances/Ui/ConsumableAcceptanceTest.phpindex 62fa6e40db..9c7c0724b5 100644--- a/tests/Feature/CheckoutAcceptances/Ui/ConsumableAcceptanceTest.php+++ b/tests/Feature/CheckoutAcceptances/Ui/ConsumableAcceptanceTest.php@@ -44,8 +44,6 @@ class ConsumableAcceptanceTest extends TestCasepublic function test_can_decline_consumable_checkout(){- $this->settings->disableAlertEmail(); //FIXME - it tries to send an email without having enough information, because the mailer is broken for queueing-$assignee = User::factory()->create();$consumable = Consumable::factory()->create();