@@ -76,8 +76,9 @@ public function onCheckedOut($event)
7676 * 4. If the admin CC email is set, even if the item being checked out doesn't have an email address (location, etc)
7777 */
7878
79- if ($ event ->checkoutable ->requireAcceptance () || $ event ->checkoutable ->getEula () ||
80- $ this ->checkoutableShouldSendEmail ($ event )) {
79+ if ($ event ->checkoutable ->requireAcceptance () /* does category require acceptance? */ ||
80+ $ event ->checkoutable ->getEula () /* is there *some* kind of EULA? */ ||
81+ $ this ->checkoutableShouldSendEmail ($ event ) /* does the category have 'checkin_email' [sic] set? */ ) {
8182
8283
8384 // Send a checkout email to the admin CC addresses, even if the target has no email
@@ -171,30 +172,28 @@ public function onCheckedIn($event)
171172 $ notifiable = $ this ->getNotifiableUsers ($ event );
172173
173174 // Send email notifications
174- try {
175- /**
176- * Send an email if any of the following conditions are met:
177- * 1. The asset requires acceptance
178- * 2. The item has a EULA
179- * 3. The item should send an email at check-in/check-out
180- * 4. If the admin CC email is set, even if the item being checked in doesn't have an email address (location, etc)
181- */
175+ if ($ this ->checkoutableShouldSendEmail ($ event )) {
176+ try {
177+ /**
178+ * Send a check-in n email *only* if the item should send an email at check-in/check-out
179+ */
182180
183- // Send a checkout email to the admin's CC addresses, even if the target has no email
184- if (!empty ($ ccEmails )) {
185- Mail::to ($ ccEmails )->send ($ mailable );
186- Log::info ('Checkin Mail sent to CC addresses ' );
187- }
181+ // Send a checkout email to the admin's CC addresses, even if the target has no email
182+ if (!empty ($ ccEmails )) {
183+ Mail::to ($ ccEmails )->send ($ mailable );
184+ Log::info ('Checkin Mail sent to CC addresses ' );
185+ }
188186
189- // Send a checkout email to the target if it has an email
190- if (!empty ($ notifiable ->email )) {
191- Mail::to ($ notifiable )->send ($ mailable );
192- Log::info ('Checkin Mail sent to checkout target ' );
187+ // Send a checkout email to the target if it has an email
188+ if (!empty ($ notifiable ->email )) {
189+ Mail::to ($ notifiable )->send ($ mailable );
190+ Log::info ('Checkin Mail sent to checkout target ' );
191+ }
192+ } catch (ClientException $ e ) {
193+ Log::debug ("Exception caught during checkin email: " . $ e ->getMessage ());
194+ } catch (Exception $ e ) {
195+ Log::debug ("Exception caught during checkin email: " . $ e ->getMessage ());
193196 }
194- } catch (ClientException $ e ) {
195- Log::debug ("Exception caught during checkin email: " . $ e ->getMessage ());
196- } catch (Exception $ e ) {
197- Log::debug ("Exception caught during checkin email: " . $ e ->getMessage ());
198197 }
199198
200199 // Send Webhook notification
0 commit comments