Removed debugging, added comments

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-02-17 14:50:07 -08:00
parent 7f6b8cc43d
commit 67fe53e32a

View file

@ -628,22 +628,15 @@ class SettingsController extends Controller
// 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();
}