Merge remote-tracking branch 'origin/develop'
This commit is contained in:
@@ -42,7 +42,7 @@ class SendExpirationAlerts extends Command
|
||||
public function handle()
|
||||
{
|
||||
$settings = Setting::getSettings();
|
||||
$threshold = $settings->alert_interval;
|
||||
$alert_interval = $settings->alert_interval;
|
||||
|
||||
if (($settings->alert_email != '') && ($settings->alerts_enabled == 1)) {
|
||||
|
||||
@@ -51,18 +51,18 @@ class SendExpirationAlerts extends Command
|
||||
->map(fn($item) => trim($item)) // Trim each email
|
||||
->all();
|
||||
// Expiring Assets
|
||||
$assets = Asset::getExpiringWarrantee($threshold);
|
||||
$assets = Asset::getExpiringWarrantee($alert_interval);
|
||||
|
||||
if ($assets->count() > 0) {
|
||||
$this->info(trans_choice('mail.assets_warrantee_alert', $assets->count(), ['count' => $assets->count(), 'threshold' => $threshold]));
|
||||
Mail::to($recipients)->send(new ExpiringAssetsMail($assets, $threshold));
|
||||
$this->info(trans_choice('mail.assets_warrantee_alert', $assets->count(), ['count' => $assets->count(), 'threshold' => $alert_interval]));
|
||||
Mail::to($recipients)->send(new ExpiringAssetsMail($assets, $alert_interval));
|
||||
}
|
||||
|
||||
// Expiring licenses
|
||||
$licenses = License::getExpiringLicenses($threshold);
|
||||
$licenses = License::getExpiringLicenses($alert_interval);
|
||||
if ($licenses->count() > 0) {
|
||||
$this->info(trans_choice('mail.license_expiring_alert', $licenses->count(), ['count' => $licenses->count(), 'threshold' => $threshold]));
|
||||
Mail::to($recipients)->send(new ExpiringLicenseMail($licenses, $threshold));
|
||||
$this->info(trans_choice('mail.license_expiring_alert', $licenses->count(), ['count' => $licenses->count(), 'threshold' => $alert_interval]));
|
||||
Mail::to($recipients)->send(new ExpiringLicenseMail($licenses, $alert_interval));
|
||||
}
|
||||
} else {
|
||||
if ($settings->alert_email == '') {
|
||||
|
||||
@@ -850,8 +850,8 @@ class SettingsController extends Controller
|
||||
$setting->ldap_fname_field = $request->input('ldap_fname_field');
|
||||
$setting->ldap_auth_filter_query = $request->input('ldap_auth_filter_query');
|
||||
$setting->ldap_version = $request->input('ldap_version', 3);
|
||||
$setting->ldap_active_flag = $request->input('ldap_active_flag');
|
||||
$setting->ldap_invert_active_flag = $request->input('ldap_invert_active_flag');
|
||||
$setting->ldap_active_flag = $request->input('ldap_active_flag', 0);
|
||||
$setting->ldap_invert_active_flag = $request->input('ldap_invert_active_flag', 0);
|
||||
$setting->ldap_emp_num = $request->input('ldap_emp_num');
|
||||
$setting->ldap_email = $request->input('ldap_email');
|
||||
$setting->ldap_manager = $request->input('ldap_manager');
|
||||
|
||||
@@ -785,7 +785,7 @@ class Asset extends Depreciable
|
||||
->whereNotNull('warranty_months')
|
||||
->whereNotNull('purchase_date')
|
||||
->whereNull('deleted_at')
|
||||
->whereRaw('DATE_ADD(`purchase_date`,INTERVAL `warranty_months` MONTH) <= DATE(NOW() + INTERVAL '
|
||||
->whereRaw('DATE_ADD(`purchase_date`, INTERVAL `warranty_months` MONTH) <= DATE_ADD(NOW(), INTERVAL '
|
||||
. $days
|
||||
. ' DAY) AND DATE_ADD(`purchase_date`, INTERVAL `warranty_months` MONTH) > NOW()')
|
||||
->orderByRaw('DATE_ADD(`purchase_date`,INTERVAL `warranty_months` MONTH)')
|
||||
|
||||
@@ -12,7 +12,7 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->boolean('ldap_invert_active_flag')->default(false);
|
||||
$table->boolean('ldap_invert_active_flag')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,9 @@
|
||||
<!-- LDAP Client-Side TLS key -->
|
||||
<div class="form-group {{ $errors->has('ldap_client_tls_key') ? 'error' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('ldap_client_tls_key', trans('admin/settings/general.ldap_client_tls_key')) }}
|
||||
<label for="ldap_client_tls_key">
|
||||
{{ trans('admin/settings/general.ldap_client_tls_key') }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<x-input.textarea
|
||||
@@ -557,27 +559,34 @@
|
||||
<!-- LDAP invert active flag -->
|
||||
<div class="form-group">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('ldap_invert_active_flag', trans('admin/settings/general.ldap_invert_active_flag')) }}
|
||||
<label for="ldap_invert_active_flag">
|
||||
{{ trans('admin/settings/general.ldap_invert_active_flag') }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<label class="form-control">
|
||||
<input type="checkbox" name="ldap_invert_active_flag" value="1" id="ldap_invert_active_flag" @checked(old('ldap_invert_active_flag', $setting->ldap_invert_active_flag)) />
|
||||
<p class="help-block">{!! trans('admin/settings/general.ldap_invert_active_flag_help') !!}</p>
|
||||
{{ trans('general.yes') }}
|
||||
</label>
|
||||
@error('ldap_invert_active_flag')
|
||||
<span class="alert-msg">
|
||||
<span class="alert-msg">
|
||||
<x-icon type="x" />
|
||||
{{ $message }}
|
||||
</span>
|
||||
@enderror
|
||||
|
||||
<p class="help-block">
|
||||
{!! trans('admin/settings/general.ldap_invert_active_flag_help') !!}
|
||||
</p>
|
||||
|
||||
@if (config('app.lock_passwords')===true)
|
||||
<p class="text-warning">
|
||||
<x-icon type="locked" />
|
||||
{{ trans('general.feature_disabled') }}
|
||||
{!! trans('general.feature_disabled') !!}
|
||||
</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- LDAP emp number -->
|
||||
|
||||
@@ -26,20 +26,21 @@ class ExpiringAlertsNotificationTest extends TestCase
|
||||
$alert_email = Setting::first()->alert_email;
|
||||
|
||||
$expiringAsset = Asset::factory()->create([
|
||||
'purchase_date' => now()->subMonths(11)->format('Y-m-d'),
|
||||
'purchase_date' => now()->subDays(350)->format('Y-m-d'),
|
||||
'warranty_months' => 12,
|
||||
'archived' => 0,
|
||||
'deleted_at' => null,
|
||||
]);
|
||||
|
||||
$expiredAsset = Asset::factory()->create([
|
||||
'purchase_date' => now()->subMonths(13)->format('Y-m-d'),
|
||||
'purchase_date' => now()->subDays(370)->format('Y-m-d'),
|
||||
'warranty_months' => 12,
|
||||
'archived' => 0,
|
||||
'deleted_at' => null,
|
||||
]);
|
||||
|
||||
$notExpiringAsset = Asset::factory()->create([
|
||||
'purchase_date' => now()->subMonths(10)->format('Y-m-d'),
|
||||
'purchase_date' => now()->subDays(330)->format('Y-m-d'),
|
||||
'warranty_months' => 12,
|
||||
'archived' => 0,
|
||||
'deleted_at' => null,
|
||||
|
||||
@@ -28,6 +28,7 @@ class LdapSettingsTest extends TestCase
|
||||
'ldap_basedn' => 'uid=',
|
||||
'ldap_fname_field' => 'SomeFirstnameField',
|
||||
'ldap_server' => 'ldaps://ldap.example.com',
|
||||
'ldap_invert_active_flag' => 0,
|
||||
]))
|
||||
->assertStatus(302)
|
||||
->assertValid('ldap_enabled')
|
||||
|
||||
Reference in New Issue
Block a user