Skip to content

Commit

Permalink
Removed debugging, added comments
Browse files Browse the repository at this point in the history
Signed-off-by: snipe <[email protected]>
  • Loading branch information
snipe committed Feb 17, 2022
1 parent 7f6b8cc commit 67fe53e
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,23 +627,16 @@ public function postAlerts(Request $request)

// Be careful - this could be a negative number
$audit_diff_months = ((int)$request->input('audit_interval') - (int)($setting->audit_interval));

\Log::debug('We need to update audit dates. Interval is changing from '.$setting->audit_interval.' to '.$request->input('audit_interval'));
\Log::debug('Audit difference: '.$audit_diff_months);


// Grab all of the assets that have an existing next_audit_date
$assets = Asset::whereNotNull('next_audit_date')->get();

// Update all of the assets' next_audit_date values
foreach ($assets as $asset) {

if ($asset->next_audit_date != '') {

$old_next_audit = new \DateTime($asset->next_audit_date);
\Log::debug('Old audit date: '.$old_next_audit->format('Y-m-d'));
\Log::debug('Adding '.$audit_diff_months.' months');

$asset->next_audit_date = $old_next_audit->modify($audit_diff_months.' month')->format('Y-m-d');

\Log::debug('New audit date: '.$asset->next_audit_date->format('Y-m-d'));
$asset->forceSave();
}

Expand Down

0 comments on commit 67fe53e

Please sign in to comment.