Moved user email nulling until after the save

This commit is contained in:
snipe 2020-08-14 15:25:07 -07:00
parent 0291323502
commit 134e8e6fb9
No known key found for this signature in database
GPG key ID: 10BFFDA3ED34B5AC

View file

@ -72,14 +72,15 @@ class CheckinLicensesFromAllUsers extends Command
foreach ($licenseSeats as $seat) { foreach ($licenseSeats as $seat) {
$this->info($seat->user->username .' has a license seat for '.$license->name); $this->info($seat->user->username .' has a license seat for '.$license->name);
if (!$notify) {
$seat->user->email = null;
}
$seat->assigned_to = null; $seat->assigned_to = null;
if ($seat->save()) { if ($seat->save()) {
// Override the email address so we don't notify on checkin
if (!$notify) {
$seat->user->email = null;
}
// Log the checkin // Log the checkin
$seat->logCheckin($seat->user, 'Checked in via cli tool'); $seat->logCheckin($seat->user, 'Checked in via cli tool');
} }