mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Removed debugging, added comments
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
7f6b8cc43d
commit
67fe53e32a
|
@ -627,23 +627,16 @@ 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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue