diff --git a/app/Http/Controllers/Account/AcceptanceController.php b/app/Http/Controllers/Account/AcceptanceController.php
index e29fa7c63b..278d7e2081 100644
--- a/app/Http/Controllers/Account/AcceptanceController.php
+++ b/app/Http/Controllers/Account/AcceptanceController.php
@@ -338,4 +338,5 @@ class AcceptanceController extends Controller
return redirect()->to('account/accept')->with('success', $return_msg);
}
+
}
diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php
index 4d21fd6c10..cfadad5ae9 100644
--- a/app/Listeners/CheckoutableListener.php
+++ b/app/Listeners/CheckoutableListener.php
@@ -51,8 +51,8 @@ class CheckoutableListener
$event->checkoutable,
$event->checkedOutTo,
$event->checkedOutBy,
+ $event->note,
$acceptance,
- $event->note
));
// Send email notifications
@@ -61,18 +61,18 @@ class CheckoutableListener
$mailable->locale($event->checkedOutTo->locale);
}
Mail::to($notifiable)->send($mailable);
- \Log::info('Sending email, Locale: ' .($event->checkedOutTo->locale ?? 'default'));
+ Log::info('Sending email, Locale: ' .($event->checkedOutTo->locale ?? 'default'));
// Send Webhook notification
- if ($this->shouldSendWebhookNotification()) {
- // Slack doesn't include the URL in its messaging format, so this is needed to hit the endpoint
- if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general') {
- Notification::route('slack', Setting::getSettings()->webhook_endpoint)
- ->notify($this->getCheckoutNotification($event, $acceptance));
- } else {
- Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
- ->notify($this->getCheckoutNotification($event, $acceptance));
- }
- }
+// if ($this->shouldSendWebhookNotification()) {
+// // Slack doesn't include the URL in its messaging format, so this is needed to hit the endpoint
+// if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general') {
+// Notification::route('slack', Setting::getSettings()->webhook_endpoint)
+// ->notify($this->getCheckoutNotification($event, $acceptance));
+// } 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());
} catch (Exception $e) {
@@ -113,7 +113,6 @@ class CheckoutableListener
$event->checkedOutTo,
$event->checkedOutBy,
$event->note,
- null,
));
// Send email notifications
diff --git a/app/Notifications/CheckoutAssetNotification.php b/app/Notifications/CheckoutAssetNotification.php
index e61d49bf5c..4337749f49 100644
--- a/app/Notifications/CheckoutAssetNotification.php
+++ b/app/Notifications/CheckoutAssetNotification.php
@@ -32,28 +32,7 @@ class CheckoutAssetNotification extends Notification
*/
public function __construct(Asset $asset, $checkedOutTo, User $checkedOutBy, $acceptance, $note)
{
- $this->item = $asset;
- $this->admin = $checkedOutBy;
- $this->note = $note;
- $this->target = $checkedOutTo;
- $this->acceptance = $acceptance;
-
- $this->settings = Setting::getSettings();
-
- $this->last_checkout = '';
- $this->expected_checkin = '';
-
- if ($this->item->last_checkout) {
- $this->last_checkout = Helper::getFormattedDateObject($this->item->last_checkout, 'date',
- false);
- }
-
- if ($this->item->expected_checkin) {
- $this->expected_checkin = Helper::getFormattedDateObject($this->item->expected_checkin, 'date',
- false);
- }
}
-
/**
* Get the notification's delivery channels.
*
diff --git a/resources/views/notifications/markdown/checkout-asset.blade.php b/resources/views/notifications/markdown/checkout-asset.blade.php
index 9b5fc26dc2..5b4c811dd7 100644
--- a/resources/views/notifications/markdown/checkout-asset.blade.php
+++ b/resources/views/notifications/markdown/checkout-asset.blade.php
@@ -1,76 +1,76 @@
@component('mail::message')
-# {{ trans('mail.hello') }} {{ $target->present()->fullName() }},
+ # {{ trans('mail.hello') }} {{ $target->present()->fullName() }},
-{{ trans('mail.new_item_checked') }}
+ {{ trans('mail.new_item_checked') }}
-@if (($snipeSettings->show_images_in_email =='1') && $item->getImageUrl())
-
-@endif
+ @if (($snipeSettings->show_images_in_email =='1') && $item->getImageUrl())
+
+ @endif
-@component('mail::table')
-| | |
-| ------------- | ------------- |
-@if ((isset($item->name)) && ($item->name!=''))
-| **{{ trans('mail.asset_name') }}** | {{ $item->name }} |
-@endif
-@if (($item->name!=$item->asset_tag))
-| **{{ trans('mail.asset_tag') }}** | {{ $item->asset_tag }} |
-@endif
-@if (isset($item->manufacturer))
-| **{{ trans('general.manufacturer') }}** | {{ $item->manufacturer->name }} |
-@endif
-@if (isset($item->model))
-| **{{ trans('general.asset_model') }}** | {{ $item->model->name }} |
-@endif
-@if ((isset($item->model->model_number)) && ($item->model->name!=$item->model->model_number))
-| **{{ trans('general.model_no') }}** | {{ $item->model->model_number }} |
-@endif
-@if (isset($item->serial))
-| **{{ trans('mail.serial') }}** | {{ $item->serial }} |
-@endif
-@if (isset($last_checkout))
-| **{{ trans('mail.checkout_date') }}** | {{ $last_checkout }} |
-@endif
-@if (isset($status))
-| **{{ trans('general.status') }}** | {{ $status }} |
-@endif
-@if ((isset($expected_checkin)) && ($expected_checkin!=''))
-| **{{ trans('mail.expecting_checkin_date') }}** | {{ $expected_checkin }} |
-@endif
-@foreach($fields as $field)
-@if (($item->{ $field->db_column_name() }!='') && ($field->show_in_email) && ($field->field_encrypted=='0'))
-| **{{ $field->name }}** | {{ $item->{ $field->db_column_name() } }} |
-@endif
-@endforeach
-@if ($admin)
-| **{{ trans('general.administrator') }}** | {{ $admin->present()->fullName() }} |
-@endif
-@if ($note)
-| **{{ trans('mail.additional_notes') }}** | {{ $note }} |
-@endif
-@endcomponent
+ @component('mail::table')
+ | | |
+ | ------------- | ------------- |
+ @if ((isset($item->name)) && ($item->name!=''))
+ | **{{ trans('mail.asset_name') }}** | {{ $item->name }} |
+ @endif
+ @if (($item->name!=$item->asset_tag))
+ | **{{ trans('mail.asset_tag') }}** | {{ $item->asset_tag }} |
+ @endif
+ @if (isset($item->manufacturer))
+ | **{{ trans('general.manufacturer') }}** | {{ $item->manufacturer->name }} |
+ @endif
+ @if (isset($item->model))
+ | **{{ trans('general.asset_model') }}** | {{ $item->model->name }} |
+ @endif
+ @if ((isset($item->model->model_number)) && ($item->model->name!=$item->model->model_number))
+ | **{{ trans('general.model_no') }}** | {{ $item->model->model_number }} |
+ @endif
+ @if (isset($item->serial))
+ | **{{ trans('mail.serial') }}** | {{ $item->serial }} |
+ @endif
+ @if (isset($last_checkout))
+ | **{{ trans('mail.checkout_date') }}** | {{ $last_checkout }} |
+ @endif
+ @if (isset($status))
+ | **{{ trans('general.status') }}** | {{ $status }} |
+ @endif
+ @if ((isset($expected_checkin)) && ($expected_checkin!=''))
+ | **{{ trans('mail.expecting_checkin_date') }}** | {{ $expected_checkin }} |
+ @endif
+ @foreach($fields as $field)
+ @if (($item->{ $field->db_column_name() }!='') && ($field->show_in_email) && ($field->field_encrypted=='0'))
+ | **{{ $field->name }}** | {{ $item->{ $field->db_column_name() } }} |
+ @endif
+ @endforeach
+ @if ($admin)
+ | **{{ trans('general.administrator') }}** | {{ $admin->present()->fullName() }} |
+ @endif
+ @if ($note)
+ | **{{ trans('mail.additional_notes') }}** | {{ $note }} |
+ @endif
+ @endcomponent
-@if (($req_accept == 1) && ($eula!=''))
-{{ trans('mail.read_the_terms_and_click') }}
-@elseif (($req_accept == 1) && ($eula==''))
-{{ trans('mail.click_on_the_link_asset') }}
-@elseif (($req_accept == 0) && ($eula!=''))
-{{ trans('mail.read_the_terms') }}
-@endif
+ @if (($req_accept == 1) && ($eula!=''))
+ {{ trans('mail.read_the_terms_and_click') }}
+ @elseif (($req_accept == 1) && ($eula==''))
+ {{ trans('mail.click_on_the_link_asset') }}
+ @elseif (($req_accept == 0) && ($eula!=''))
+ {{ trans('mail.read_the_terms') }}
+ @endif
-@if ($eula)
-@component('mail::panel')
-{!! $eula !!}
-@endcomponent
-@endif
+ @if ($eula)
+ @component('mail::panel')
+ {!! $eula !!}
+ @endcomponent
+ @endif
-@if ($req_accept == 1)
-**[✔ {{ trans('mail.i_have_read') }}]({{ $accept_url }})**
-@endif
+ @if ($req_accept == 1)
+ **[✔ {{ trans('mail.i_have_read') }}]({{ $accept_url }})**
+ @endif
-{{ trans('mail.best_regards') }}
+ {{ trans('mail.best_regards') }}
-{{ $snipeSettings->site_name }}
+ {{ $snipeSettings->site_name }}
-@endcomponent
+@endcomponent
\ No newline at end of file
diff --git a/routes/web.php b/routes/web.php
index 60b74476c7..7bed89acf7 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -24,6 +24,8 @@ use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\Auth\ForgotPasswordController;
use App\Http\Controllers\Auth\ResetPasswordController;
use App\Livewire\Importer;
+use App\Models\Asset;
+use App\Models\User;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;
@@ -53,6 +55,26 @@ Route::group(['middleware' => 'auth'], function () {
/*
* Locations
*/
+ Route::get('/test-email', function() {
+ $item = Asset::find(1); // Load some test data
+ $admin = User::find(1);
+ $target = User::find(2);
+ $acceptance = null; // Simulate acceptance data
+ $note = 'Test note';
+
+ $fields = [];
+ if (($item->model) && ($item->model->fieldset)) {
+ $fields = $item->model->fieldset->fields;
+ }
+
+ return new \App\Mail\CheckoutAssetMail(
+ $item,
+ $admin,
+ $target,
+ $acceptance,
+ $note);
+ });
+
Route::group(['prefix' => 'locations', 'middleware' => ['auth']], function () {