mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-05 19:07:30 -08:00
fix user checkout license category email check
This commit is contained in:
parent
02ba13be26
commit
1061df8c8b
|
@ -77,7 +77,7 @@ class CheckoutableListener
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
|
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
|
||||||
(method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) {
|
$this->checkoutableShouldSendEmail($event)) {
|
||||||
Log::info('Sending checkout email, Locale: ' . ($event->checkedOutTo->locale ?? 'default'));
|
Log::info('Sending checkout email, Locale: ' . ($event->checkedOutTo->locale ?? 'default'));
|
||||||
if (!empty($notifiable)) {
|
if (!empty($notifiable)) {
|
||||||
Mail::to($notifiable)->cc($ccEmails)->send($mailable);
|
Mail::to($notifiable)->cc($ccEmails)->send($mailable);
|
||||||
|
@ -146,7 +146,6 @@ class CheckoutableListener
|
||||||
$ccEmails = array_filter($adminCcEmailsArray);
|
$ccEmails = array_filter($adminCcEmailsArray);
|
||||||
$mailable = $this->getCheckinMailType($event);
|
$mailable = $this->getCheckinMailType($event);
|
||||||
$notifiable = $this->getNotifiables($event);
|
$notifiable = $this->getNotifiables($event);
|
||||||
|
|
||||||
if (!$event->checkedOutTo->locale){
|
if (!$event->checkedOutTo->locale){
|
||||||
$mailable->locale($event->checkedOutTo->locale);
|
$mailable->locale($event->checkedOutTo->locale);
|
||||||
}
|
}
|
||||||
|
@ -159,7 +158,7 @@ class CheckoutableListener
|
||||||
* 3. The item should send an email at check-in/check-out
|
* 3. The item should send an email at check-in/check-out
|
||||||
*/
|
*/
|
||||||
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
|
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
|
||||||
(method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) {
|
$this->checkoutableShouldSendEmail($event)) {
|
||||||
Log::info('Sending checkin email, Locale: ' . ($event->checkedOutTo->locale ?? 'default'));
|
Log::info('Sending checkin email, Locale: ' . ($event->checkedOutTo->locale ?? 'default'));
|
||||||
if (!empty($notifiable)) {
|
if (!empty($notifiable)) {
|
||||||
Mail::to($notifiable)->cc($ccEmails)->send($mailable);
|
Mail::to($notifiable)->cc($ccEmails)->send($mailable);
|
||||||
|
@ -338,4 +337,12 @@ class CheckoutableListener
|
||||||
{
|
{
|
||||||
return Setting::getSettings() && Setting::getSettings()->webhook_endpoint;
|
return Setting::getSettings() && Setting::getSettings()->webhook_endpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function checkoutableShouldSendEmail($event): bool
|
||||||
|
{
|
||||||
|
if($event->checkoutable instanceof LicenseSeat){
|
||||||
|
return $event->checkoutable->license->checkin_email();
|
||||||
|
}
|
||||||
|
return (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue