Skip to content

A free open source IT asset/license management system

merged in develop

Godfrey Mb26cae372cad
diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php
index bdd5de443e..1b3005ce26 100644
--- a/app/Helpers/Helper.php
+++ b/app/Helpers/Helper.php
@@ -717,7 +717,7 @@ class Helper
* @since [v7.0.14]
* @return array
*/
- public static function deprecationCheck(){
+ public static function deprecationCheck() : array {
// The check and message that the user is still using the deprecated version
$deprecations = [
'ms_teams_deprecated' => array(
diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php
index 7d8b5c1c9d..b9b176f16f 100644
--- a/app/Listeners/CheckoutableListener.php
+++ b/app/Listeners/CheckoutableListener.php
@@ -30,6 +30,7 @@ use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Notification;
use Exception;
use Illuminate\Support\Facades\Log;
+use Osama\LaravelTeamsNotification\TeamsNotification;
class CheckoutableListener
{
@@ -80,11 +81,16 @@ class CheckoutableListener
Log::info('Sending email, Locale: ' . ($event->checkedOutTo->locale ?? 'default'));
}
}
-
// Send Webhook notification
if ($this->shouldSendWebhookNotification()) {
- Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
- ->notify($this->getCheckoutNotification($event, $acceptance));
+ if (Setting::getSettings()->webhook_selected === 'microsoft') {
+ $message = $this->getCheckoutNotification($event)->toMicrosoftTeams();
+ $notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint);
+ $notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams
+ } else {
+ Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
+ ->notify($this->getCheckoutNotification($event, $acceptance));
+ }
}
} catch (ClientException $e) {
Log::debug("Exception caught during checkout notification: " . $e->getMessage());
diff --git a/app/Livewire/SlackSettingsForm.php b/app/Livewire/SlackSettingsForm.php
index 39f965f87a..64196b5dd9 100644
--- a/app/Livewire/SlackSettingsForm.php
+++ b/app/Livewire/SlackSettingsForm.php
@@ -64,7 +64,7 @@ class SlackSettingsForm extends Component
"name" => trans('admin/settings/general.ms_teams'),
"icon" => "fa-brands fa-microsoft",
"placeholder" => "https://abcd.webhook.office.com/webhookb2/XXXXXXX",
- "link" => "https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=dotnet#create-incoming-webhooks-1",
+ "link" => "https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498",
"test" => "msTeamTestWebhook"
),
];