Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added #14230: Add option to deactivate expected checkin notifications for users #14497

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
12 changes: 7 additions & 5 deletions app/Console/Commands/SendExpectedCheckinAlerts.php
Expand Up @@ -49,11 +49,13 @@ public function handle()
$this->info($whenNotify.' is deadline');
$this->info($assets->count().' assets');

foreach ($assets as $asset) {
if ($asset->assigned && $asset->checkedOutToUser()) {
Log::info('Sending ExpectedCheckinNotification to ' . $asset->assigned->email);
$asset->assigned->notify((new ExpectedCheckinNotification($asset)));
}
if (1 == $settings->checkin_notification_user) {
foreach ($assets as $asset) {
if ($asset->assigned && $asset->checkedOutToUser()) {
Log::info('Sending ExpectedCheckinNotification to ' . $asset->assigned->email);
$asset->assigned->notify((new ExpectedCheckinNotification($asset)));
}
}
}

if (($assets) && ($assets->count() > 0) && ($settings->alert_email != '')) {
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/SettingsController.php
Expand Up @@ -351,6 +351,7 @@ public function postSettings(Request $request)
$setting->email_format = $request->input('email_format');
$setting->username_format = $request->input('username_format');
$setting->require_accept_signature = $request->input('require_accept_signature');
$setting->checkin_notification_user = $request->input('checkin_notification_user');
$setting->show_assigned_assets = $request->input('show_assigned_assets', '0');
if (! config('app.lock_passwords')) {
$setting->login_note = $request->input('login_note');
Expand Down
@@ -0,0 +1,31 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CheckinNotificationUser extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function ($table) {
$table->boolean('checkin_notification_user')->default(0);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function ($table) {
$table->dropColumn('checkin_notification_user');
});
}
}
2 changes: 2 additions & 0 deletions resources/lang/en-US/admin/settings/general.php
Expand Up @@ -363,5 +363,7 @@
'database_driver' => 'Database Driver',
'bs_table_storage' => 'Table Storage',
'timezone' => 'Timezone',
'checkin_notification_user' => 'Checkin Notification for User',
'checkin_notification_user_help' => 'Send an E-Mail to the User when an asset check-in is expected or overdue.',

];
15 changes: 15 additions & 0 deletions resources/views/settings/general.blade.php
Expand Up @@ -113,6 +113,21 @@
</div>
</div>

<!-- Checkin Notification for User -->
<div class="form-group {{ $errors->has('checkin_notification_user') ? 'error' : '' }}">
<div class="col-md-3">
{{ Form::label('checkin_notification_user', trans('admin/settings/general.checkin_notification_user')) }}
</div>
<div class="col-md-9">
<label class="form-control">
{{ Form::checkbox('checkin_notification_user', '1', Request::old('checkin_notification_user', $setting->checkin_notification_user)) }}
{{ trans('general.yes') }}
</label>
{!! $errors->first('checkin_notification_user', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
<p class="help-block">{{ trans('admin/settings/general.checkin_notification_user_help') }}</p>
</div>
</div>

<!-- Load images in emails -->
<div class="form-group {{ $errors->has('show_images_in_email') ? 'error' : '' }}">
<div class="col-md-3">
Expand Down