mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
88e1d8a8cf
|
@ -434,8 +434,12 @@ class LdapSync extends Command
|
|||
$item['note'] = $item['createorupdate'];
|
||||
$item['status'] = 'success';
|
||||
if ($item['createorupdate'] === 'created' && $ldap_default_group) {
|
||||
$user->groups()->attach($ldap_default_group);
|
||||
// Check if the relationship already exists
|
||||
if (!$user->groups()->where('group_id', $ldap_default_group)->exists()) {
|
||||
$user->groups()->attach($ldap_default_group);
|
||||
}
|
||||
}
|
||||
|
||||
//updates assets location based on user's location
|
||||
if ($user->wasChanged('location_id')) {
|
||||
foreach ($user->assets as $asset) {
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mail\SendUpcomingAuditMail;
|
||||
use App\Models\Asset;
|
||||
use App\Models\Recipients\AlertRecipient;
|
||||
use App\Models\Setting;
|
||||
use App\Notifications\SendUpcomingAuditNotification;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class SendUpcomingAuditReport extends Command
|
||||
{
|
||||
|
@ -48,19 +47,19 @@ class SendUpcomingAuditReport extends Command
|
|||
$today = Carbon::now();
|
||||
$interval_date = $today->copy()->addDays($interval);
|
||||
|
||||
$assets = Asset::whereNull('deleted_at')->DueOrOverdueForAudit($settings)->orderBy('assets.next_audit_date', 'desc')->get();
|
||||
$this->info($assets->count().' assets must be audited in on or before '.$interval_date.' is deadline');
|
||||
$assets = Asset::whereNull('deleted_at')->dueOrOverdueForAudit($settings)->orderBy('assets.next_audit_date', 'desc')->get();
|
||||
$this->info($assets->count() . ' assets must be audited in on or before ' . $interval_date . ' is deadline');
|
||||
|
||||
|
||||
if (($assets) && ($assets->count() > 0) && ($settings->alert_email != '')) {
|
||||
if ((count($assets) !== 0) && ($assets->count() > 0) && ($settings->alert_email != '')) {
|
||||
// Send a rollup to the admin, if settings dictate
|
||||
$recipients = collect(explode(',', $settings->alert_email))->map(function ($item) {
|
||||
return new AlertRecipient($item);
|
||||
});
|
||||
$recipients = collect(explode(',', $settings->alert_email))
|
||||
->map(fn($item) => trim($item))
|
||||
->all();
|
||||
|
||||
$this->info('Sending Admin SendUpcomingAuditNotification to: '.$settings->alert_email);
|
||||
\Notification::send($recipients, new SendUpcomingAuditNotification($assets, $settings->audit_warning_days));
|
||||
|
||||
$this->info('Sending Admin SendUpcomingAuditNotification to: ' . $settings->alert_email);
|
||||
Mail::to($recipients)->send(new SendUpcomingAuditMail($assets, $settings->audit_warning_days));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace App\Console;
|
|||
use App\Console\Commands\ImportLocations;
|
||||
use App\Console\Commands\ReEncodeCustomFieldNames;
|
||||
use App\Console\Commands\RestoreDeletedUsers;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
|
@ -18,12 +19,14 @@ class Kernel extends ConsoleKernel
|
|||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('snipeit:inventory-alerts')->daily();
|
||||
$schedule->command('snipeit:expiring-alerts')->daily();
|
||||
$schedule->command('snipeit:expected-checkin')->daily();
|
||||
if(Setting::getSettings()->alerts_enabled === 1) {
|
||||
$schedule->command('snipeit:inventory-alerts')->daily();
|
||||
$schedule->command('snipeit:expiring-alerts')->daily();
|
||||
$schedule->command('snipeit:expected-checkin')->daily();
|
||||
$schedule->command('snipeit:upcoming-audits')->daily();
|
||||
}
|
||||
$schedule->command('snipeit:backup')->weekly();
|
||||
$schedule->command('backup:clean')->daily();
|
||||
$schedule->command('snipeit:upcoming-audits')->daily();
|
||||
$schedule->command('auth:clear-resets')->everyFifteenMinutes();
|
||||
$schedule->command('saml:clear_expired_nonces')->weekly();
|
||||
}
|
||||
|
|
|
@ -198,10 +198,9 @@ class UsersController extends Controller
|
|||
$userPermissions = Helper::selectedPermissionsArray($permissions, $user->permissions);
|
||||
$permissions = $this->filterDisplayable($permissions);
|
||||
|
||||
return view('users/edit', compact('user', 'groups', 'userGroups', 'permissions', 'userPermissions'));
|
||||
return view('users/edit', compact('user', 'groups', 'userGroups', 'permissions', 'userPermissions'))->with('item', $user);
|
||||
}
|
||||
|
||||
return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', compact('id')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -456,10 +455,10 @@ class UsersController extends Controller
|
|||
->with('user', $user)
|
||||
->with('groups', Group::pluck('name', 'id'))
|
||||
->with('userGroups', $userGroups)
|
||||
->with('clone_user', $user_to_clone);
|
||||
->with('clone_user', $user_to_clone)
|
||||
->with('item', $user);
|
||||
}
|
||||
|
||||
return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', compact('id')));
|
||||
|
||||
}
|
||||
|
||||
|
|
65
app/Mail/SendUpcomingAuditMail.php
Normal file
65
app/Mail/SendUpcomingAuditMail.php
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SendUpcomingAuditMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($params, $threshold)
|
||||
{
|
||||
$this->assets = $params;
|
||||
$this->threshold = $threshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
$from = new Address(config('mail.from.address'), config('mail.from.name'));
|
||||
|
||||
return new Envelope(
|
||||
from: $from,
|
||||
subject: trans_choice('mail.upcoming-audits', $this->assets->count(), ['count' => $this->assets->count(), 'threshold' => $this->threshold]),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
|
||||
|
||||
return new Content(
|
||||
|
||||
markdown: 'notifications.markdown.upcoming-audits',
|
||||
with: [
|
||||
'assets' => $this->assets,
|
||||
'threshold' => $this->threshold,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
|
@ -13,4 +13,8 @@ return [
|
|||
'no_depreciations_warning' => '<strong>Warning: </strong>
|
||||
You do not currently have any depreciations set up.
|
||||
Please set up at least one depreciation to view the depreciation report.',
|
||||
'depreciation_method' => 'Depreciation Method',
|
||||
'linear_depreciation' => 'Linear (Default)',
|
||||
'half_1' => 'Half-year convention, always applied',
|
||||
'half_2' => 'Half-year convention, applied with condition',
|
||||
];
|
||||
|
|
|
@ -42,6 +42,7 @@ return [
|
|||
'confirm_purge' => 'Confirm Purge',
|
||||
'confirm_purge_help' => 'Enter the text "DELETE" in the box below to purge your deleted records. This action cannot be undone and will PERMANENTLY delete all soft-deleted items and users. (You should make a backup first, just to be safe.)',
|
||||
'custom_css' => 'Custom CSS',
|
||||
'custom_css_placeholder' => 'Add your custom CSS',
|
||||
'custom_css_help' => 'Enter any custom CSS overrides you would like to use. Do not include the <style></style> tags.',
|
||||
'custom_forgot_pass_url' => 'Custom Password Reset URL',
|
||||
'custom_forgot_pass_url_help' => 'This replaces the built-in forgotten password URL on the login screen, useful to direct people to internal or hosted LDAP password reset functionality. It will effectively disable local user forgotten password functionality.',
|
||||
|
@ -69,6 +70,7 @@ return [
|
|||
'favicon_size' => 'Favicons should be square images, 16x16 pixels.',
|
||||
'footer_text' => 'Additional Footer Text ',
|
||||
'footer_text_help' => 'This text will appear in the right-side footer. Links are allowed using <a href="https://help.github.com/articles/github-flavored-markdown/">Github flavored markdown</a>. Line breaks, headers, images, etc may result in unpredictable results.',
|
||||
'footer_text_placeholder' => 'Optional footer text',
|
||||
'general_settings' => 'General Settings',
|
||||
'general_settings_help' => 'Default EULA and more',
|
||||
'generate_backup' => 'Generate Backup',
|
||||
|
@ -134,6 +136,7 @@ return [
|
|||
'login_user_agent' => 'User Agent',
|
||||
'login_help' => 'List of attempted logins',
|
||||
'login_note' => 'Login Note',
|
||||
'login_note_placeholder' => "If you do not have a login or have found a device belonging to this company, please call technical support at 888-555-1212. Thank you.",
|
||||
'login_note_help' => 'Optionally include a few sentences on your login screen, for example to assist people who have found a lost or stolen device. This field accepts <a href="https://help.github.com/articles/github-flavored-markdown/">Github flavored markdown</a>',
|
||||
'login_remote_user_text' => 'Remote User login options',
|
||||
'login_remote_user_enabled_text' => 'Enable Login with Remote User Header',
|
||||
|
@ -347,6 +350,8 @@ return [
|
|||
'setup_migration_create_user' => 'Next: Create User',
|
||||
'ldap_settings_link' => 'LDAP Settings Page',
|
||||
'slack_test' => 'Test <i class="fab fa-slack"></i> Integration',
|
||||
'status_label_name' => 'Status Label Name',
|
||||
'super_admin_only' => 'Super Admin Only',
|
||||
'label2_enable' => 'New Label Engine',
|
||||
'label2_enable_help' => 'Switch to the new label engine. <b>Note: You will need to save this setting before setting others.</b>',
|
||||
'label2_template' => 'Template',
|
||||
|
@ -380,6 +385,7 @@ return [
|
|||
'database_driver' => 'Database Driver',
|
||||
'bs_table_storage' => 'Table Storage',
|
||||
'timezone' => 'Timezone',
|
||||
'test_mail' => 'Test Mail',
|
||||
'profile_edit' => 'Edit Profile',
|
||||
'profile_edit_help' => 'Allow users to edit their own profiles.',
|
||||
'default_avatar' => 'Upload custom default avatar',
|
||||
|
@ -389,6 +395,15 @@ return [
|
|||
'due_checkin_days' => 'Due For Checkin Warning',
|
||||
'due_checkin_days_help' => 'How many days before the expected checkin of an asset should it be listed in the "Due for checkin" page?',
|
||||
'no_groups' => 'No groups have been created yet. Visit <code>Admin Settings > Permission Groups</code> to add one.',
|
||||
'text' => 'Text',
|
||||
|
||||
|
||||
'logo_option_types' => [
|
||||
'text' => 'Text',
|
||||
'logo' => 'Logo',
|
||||
'logo_and_text' => 'Logo and Text',
|
||||
],
|
||||
|
||||
|
||||
|
||||
/* Keywords for settings overview help */
|
||||
|
|
|
@ -599,5 +599,6 @@ return [
|
|||
'generic_model_not_found' => 'That :model was not found or you do not have permission to access it',
|
||||
'deleted_models' => 'Deleted Asset Models',
|
||||
'deleted_users' => 'Deleted Users',
|
||||
'cost_each' => ':amount each',
|
||||
|
||||
];
|
||||
|
|
|
@ -1211,7 +1211,7 @@
|
|||
<a href="{{ route('components.show', $component->id) }}">{{ $component->name }}</a>
|
||||
</td>
|
||||
<td>{{ $component->pivot->assigned_qty }}</td>
|
||||
<td>{{ Helper::formatCurrencyOutput($component->purchase_cost) }} each</td>
|
||||
<td>{{ trans('general.cost_each', ['amount' => Helper::formatCurrencyOutput($component->purchase_cost)]) }} </td>
|
||||
<td>{{ $component->serial }}</td>
|
||||
<td>
|
||||
<a href="{{ route('components.checkin.show', $component->pivot->id) }}" class="btn btn-sm bg-purple hidden-print" data-tooltip="true">{{ trans('general.checkin') }}</a>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="form-group {{ $errors->has('email') ? ' has-error' : '' }}">
|
||||
<label for="email" class="col-md-3 col-xs-12 control-label">{{ trans('admin/suppliers/table.email') }}</label>
|
||||
<div class="col-md-8 col-xs-12">
|
||||
<input type="text" name="email" id="email" value="{{ old('email', ($item->email ?? $user->email)) }}" class="form-control" maxlength="191" style="width:100%; display:flex;">
|
||||
<input type="text" name="email" id="email" value="{{ old('email', $item->email) }}" class="form-control" maxlength="191" style="width:100%; display:flex;">
|
||||
{!! $errors->first('email', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -68,7 +68,9 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@php
|
||||
$optionTypes = trans('admin/settings/general.logo_option_types');
|
||||
@endphp
|
||||
|
||||
<!-- Branding -->
|
||||
<div class="form-group {{ $errors->has('brand') ? 'error' : '' }}">
|
||||
|
@ -76,8 +78,13 @@
|
|||
<label for="brand">{{ trans('admin/settings/general.web_brand') }}</label>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
{!! Form::select('brand', array('1'=>'Text','2'=>'Logo','3'=>'Logo + Text'), old('brand', $setting->brand), array('class' => 'form-control select2', 'style'=>'width: 150px ;')) !!}
|
||||
{!! $errors->first('brand', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||
<select name="brand" id="brand" class="form-control select2 minimumResultsForSearch" style="width: 150px;">
|
||||
@foreach($optionTypes as $value => $label)
|
||||
<option value="{{ $value }}" {{ old('brand', $setting->brand) == $value ? 'selected' : '' }}>
|
||||
{{ $label }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -272,10 +279,10 @@
|
|||
</div>
|
||||
<div class="col-md-9">
|
||||
@if (config('app.lock_passwords')===true)
|
||||
{!! Form::select('support_footer', array('on'=>'Enabled','off'=>'Disabled','admin'=>'Superadmin Only'), old('support_footer', $setting->support_footer), ['class' => 'form-control select2 disabled', 'style'=>'width: 150px ;', 'disabled' => 'disabled']) !!}
|
||||
{!! Form::select('support_footer', array('on'=>trans('admin/settings/general.enabled'),'off'=>trans('admin/settings/general.two_factor_disabled'),'admin'=>trans('admin/settings/general.super_admin_only')), old('support_footer', $setting->support_footer), ['class' => 'form-control select2 disabled', 'style'=>'width: 150px ;', 'disabled' => 'disabled']) !!}
|
||||
<p class="text-warning"><i class="fas fa-lock"></i> {{ trans('general.feature_disabled') }}</p>
|
||||
@else
|
||||
{!! Form::select('support_footer', array('on'=>'Enabled','off'=>'Disabled','admin'=>'Superadmin Only'), old('support_footer', $setting->support_footer), array('class' => 'form-control select2', 'style'=>'width: 150px ;')) !!}
|
||||
{!! Form::select('support_footer', array('on'=>trans('admin/settings/general.enabled'),'off'=>trans('admin/settings/general.two_factor_disabled'),'admin'=>trans('admin/settings/general.super_admin_only')), old('support_footer', $setting->support_footer), array('class' => 'form-control select2', 'style'=>'width: 150px ;')) !!}
|
||||
@endif
|
||||
|
||||
|
||||
|
@ -291,10 +298,10 @@
|
|||
</div>
|
||||
<div class="col-md-9">
|
||||
@if (config('app.lock_passwords')===true)
|
||||
{!! Form::select('version_footer', array('on'=>'Enabled','off'=>'Disabled','admin'=>'Superadmin Only'), old('version_footer', $setting->version_footer), ['class' => 'form-control select2 disabled', 'style'=>'width: 150px ;', 'disabled' => 'disabled']) !!}
|
||||
{!! Form::select('version_footer', array('on'=>trans('admin/settings/general.enabled'),'off'=>trans('admin/settings/general.two_factor_disabled'),'admin'=>trans('admin/settings/general.super_admin_only')), old('version_footer', $setting->version_footer), ['class' => 'form-control select2 disabled', 'style'=>'width: 150px ;', 'disabled' => 'disabled']) !!}
|
||||
<p class="text-warning"><i class="fas fa-lock"></i> {{ trans('general.feature_disabled') }}</p>
|
||||
@else
|
||||
{!! Form::select('version_footer', array('on'=>'Enabled','off'=>'Disabled','admin'=>'Superadmin Only'), old('version_footer', $setting->version_footer), array('class' => 'form-control select2', 'style'=>'width: 150px ;')) !!}
|
||||
{!! Form::select('version_footer', array('on'=>trans('admin/settings/general.enabled'),'off'=>trans('admin/settings/general.two_factor_disabled'),'admin'=>trans('admin/settings/general.super_admin_only')), old('version_footer', $setting->version_footer), array('class' => 'form-control select2', 'style'=>'width: 150px ;')) !!}
|
||||
@endif
|
||||
|
||||
<p class="help-block">{{ trans('admin/settings/general.version_footer_help') }}</p>
|
||||
|
|
|
@ -245,11 +245,11 @@
|
|||
<div class="col-md-9">
|
||||
@if (config('app.lock_passwords'))
|
||||
|
||||
<textarea class="form-control disabled" name="login_note" placeholder="If you do not have a login or have found a device belonging to this company, please call technical support at 888-555-1212. Thank you." rows="2" aria-label="login_note" readonly>{{ old('login_note', $setting->login_note) }}</textarea>
|
||||
<textarea class="form-control disabled" name="login_note" placeholder="{{trans('admin/settings/general.login_note_placeholder')}}" rows="2" aria-label="login_note" readonly>{{ old('login_note', $setting->login_note) }}</textarea>
|
||||
{!! $errors->first('login_note', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||
<p class="text-warning"><i class="fas fa-lock"></i> {{ trans('general.feature_disabled') }}</p>
|
||||
@else
|
||||
<textarea class="form-control" name="login_note" aria-label="login_note" placeholder="If you do not have a login or have found a device belonging to this company, please call technical support at 888-555-1212. Thank you." rows="2">{{ old('login_note', $setting->login_note) }}</textarea>
|
||||
<textarea class="form-control" name="login_note" aria-label="login_note" placeholder="{{trans('admin/settings/general.login_note_placeholder')}}" rows="2">{{ old('login_note', $setting->login_note) }}</textarea>
|
||||
{!! $errors->first('login_note', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||
@endif
|
||||
<p class="help-block">{!! trans('admin/settings/general.login_note_help') !!}</p>
|
||||
|
@ -259,7 +259,7 @@
|
|||
<!-- Mail test -->
|
||||
<div class="form-group">
|
||||
<div class="col-md-3">
|
||||
<label for="login_note">Test Mail</label>
|
||||
<label for="login_note">{{trans('admin/settings/general.test_mail')}}</label>
|
||||
</div>
|
||||
<div class="col-md-9" id="mailtestrow">
|
||||
<a class="btn btn-default btn-sm pull-left" id="mailtest" style="margin-right: 10px;">
|
||||
|
@ -374,13 +374,13 @@
|
|||
<!-- Depreciation method -->
|
||||
<div class="form-group {{ $errors->has('depreciation_method') ? 'error' : '' }}">
|
||||
<div class="col-md-3">
|
||||
<label for="depreciation_method">{{ trans('Depreciation method') }}</label>
|
||||
<label for="depreciation_method">{{ trans('admin/depreciations/general.depreciation_method') }}</label>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
{{ Form::select('depreciation_method', array(
|
||||
'default' => 'Linear (default)',
|
||||
'half_1' => 'Half-year convention, always applied',
|
||||
'half_2' => 'Half-year convention, applied with condition',
|
||||
'default' => trans('admin/depreciations/general.linear_depreciation'),
|
||||
'half_1' => trans('admin/depreciations/general.half_1'),
|
||||
'half_2' => trans('admin/depreciations/general.half_2'),
|
||||
), old('username_format', $setting->depreciation_method), ['class' =>'select2', 'style' => 'width: 80%']) }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Tests\Feature\Notifications\Email;
|
|||
|
||||
use App\Mail\ExpiringAssetsMail;
|
||||
use App\Mail\ExpiringLicenseMail;
|
||||
use App\Mail\SendUpcomingAuditMail;
|
||||
use App\Models\Asset;
|
||||
use App\Models\License;
|
||||
use App\Models\Setting;
|
||||
|
@ -88,4 +89,38 @@ class ExpiringAlertsNotificationTest extends TestCase
|
|||
return $mail->licenses->contains($expiredLicense) || $mail->licenses->contains($notExpiringLicense);
|
||||
});
|
||||
}
|
||||
|
||||
public function testAuditWarningThresholdEmailNotification()
|
||||
{
|
||||
$this->markIncompleteIfSqlite();
|
||||
Mail::fake();
|
||||
$this->settings->enableAlertEmail('admin@example.com');
|
||||
$this->settings->setAuditWarningDays(15);
|
||||
|
||||
$alert_email = Setting::first()->alert_email;
|
||||
|
||||
$upcomingAuditableAsset = Asset::factory()->create([
|
||||
'next_audit_date' => now()->addDays(14)->format('Y-m-d'),
|
||||
'deleted_at' => null,
|
||||
]);
|
||||
|
||||
$overDueForAuditableAsset = Asset::factory()->create([
|
||||
'next_audit_date' => now()->subDays(1)->format('Y-m-d'),
|
||||
'deleted_at' => null,
|
||||
]);
|
||||
|
||||
$notAuditableAsset = Asset::factory()->create([
|
||||
'next_audit_date' => now()->addDays(30)->format('Y-m-d'),
|
||||
'deleted_at' => null,
|
||||
]);
|
||||
|
||||
$this->artisan('snipeit:upcoming-audits')->assertExitCode(0);
|
||||
|
||||
Mail::assertSent(SendUpcomingAuditMail::class, function($mail) use ($alert_email, $upcomingAuditableAsset, $overDueForAuditableAsset) {
|
||||
return $mail->hasTo($alert_email) && ($mail->assets->contains($upcomingAuditableAsset) && $mail->assets->contains($overDueForAuditableAsset));
|
||||
});
|
||||
Mail::assertNotSent(SendUpcomingAuditMail::class, function($mail) use ($alert_email, $notAuditableAsset) {
|
||||
return $mail->hasTo($alert_email) && $mail->assets->contains($notAuditableAsset);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -32,6 +32,12 @@ class Settings
|
|||
'alert_threshold' => $days,
|
||||
]);
|
||||
}
|
||||
public function setAuditWarningDays(int $days): Settings
|
||||
{
|
||||
return $this->update([
|
||||
'audit_warning_days' => $days,
|
||||
]);
|
||||
}
|
||||
public function disableAlertEmail(): Settings
|
||||
{
|
||||
return $this->update([
|
||||
|
|
|
@ -261,7 +261,7 @@ if ($env_bad !='') {
|
|||
|
||||
if(!$skip_php_checks){
|
||||
echo "\n\e[95m--------------------------------------------------------\n";
|
||||
echo "STEP 2: Checking PHP requirements: (Required PHP >=". $php_min_works. " - <".$php_max_wontwork.") \e[39m\n";
|
||||
echo "STEP 2: Checking PHP requirements: (Required PHP >=". $php_min_works. " - <".$php_max_wontwork.")\n";
|
||||
echo "--------------------------------------------------------\e[39m\n\n";
|
||||
|
||||
if ((version_compare(phpversion(), $php_min_works, '>=')) && (version_compare(phpversion(), $php_max_wontwork, '<'))) {
|
||||
|
@ -540,7 +540,7 @@ echo "--------------------------------------------------------\e[39m\n\n";
|
|||
exec('php artisan down', $down_results, $return_code);
|
||||
echo '-- ' . implode("\n", $down_results) . "\n";
|
||||
if ($return_code > 0) {
|
||||
die("Something went wrong with downing your site. This can't be good. Please investigate the error. Aborting!n\n");
|
||||
die("Something went wrong with downing your site. This can't be good. Please investigate the error. Aborting!\n\n");
|
||||
}
|
||||
unset($return_code);
|
||||
|
||||
|
|
Loading…
Reference in a new issue