Merge pull request 'ranjith-dev' (#1504) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #1504
This commit was merged in pull request #1504.
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Console\Commands;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProductionTemp;
|
||||
use App\Models\AlertMailRule;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Services\SftpFileService;
|
||||
use Filament\Facades\Filament;
|
||||
@@ -562,20 +563,28 @@ class ProcessSftpFiles extends Command
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Send error logs through email
|
||||
if (!empty($logMessages)) {
|
||||
|
||||
$alertRule = AlertMailRule::where('module', 'FtpLogs')->where('rule_name', 'FtpLogsMail')->first();
|
||||
|
||||
if ($alertRule && !empty($alertRule->email)) {
|
||||
|
||||
$emailContent = implode(PHP_EOL, $logMessages);
|
||||
|
||||
Mail::raw('Please find attached machine error logs.', function ($message) use ($emailContent) {
|
||||
$toEmails = array_filter(array_map('trim', explode(',', $alertRule->email)));
|
||||
|
||||
$message->to(env('ERROR_LOG_MAIL'))
|
||||
Mail::raw('Please find attached machine error logs.', function ($message) use ($emailContent, $toEmails) {
|
||||
|
||||
$message->to($toEmails)
|
||||
->subject('Machine Error Logs')
|
||||
->attachData($emailContent, 'machine_errors.txt', [
|
||||
'mime' => 'text/plain',
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('Production TXT file processing completed.');
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class Scheduler extends Command
|
||||
|
||||
$this->call('approval:trigger-mails');
|
||||
$this->call('approval:laser-stop');
|
||||
// $this->call('sftp:process-files');
|
||||
$this->call('sftp:process-files');
|
||||
|
||||
// --- Production Rules ---
|
||||
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||
|
||||
Reference in New Issue
Block a user