mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 22:07:29 -08:00
email comes through, no picture and html markup appear though.
This commit is contained in:
parent
9f06a0e441
commit
3ab2521cb0
|
@ -338,4 +338,5 @@ class AcceptanceController extends Controller
|
|||
return redirect()->to('account/accept')->with('success', $return_msg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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())
|
||||
<center><img src="{{ $item->getImageUrl() }}" alt="Asset" style="max-width: 570px;"></center>
|
||||
@endif
|
||||
@if (($snipeSettings->show_images_in_email =='1') && $item->getImageUrl())
|
||||
<center><img src="{{ $item->getImageUrl() }}" alt="Asset" style="max-width: 570px;"></center>
|
||||
@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
|
|
@ -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 () {
|
||||
|
||||
|
|
Loading…
Reference in a new issue