fix gitlab tests

This commit is contained in:
root
2026-06-09 02:32:58 -04:00
parent 20a0b6c4e5
commit 6def9993da
1489 changed files with 10449 additions and 11356 deletions
@@ -51,7 +51,7 @@ class CommunicationFamilyService
}
$names = array_map(static function ($row) {
return trim(($row['firstname'] ?? '').' '.($row['lastname'] ?? ''));
return trim(($row['firstname'] ?? '') . ' ' . ($row['lastname'] ?? ''));
}, $rows);
return implode(' & ', $names);
@@ -9,7 +9,7 @@ class CommunicationLogService
{
public function log(array $payload): void
{
if (! Schema::hasTable('communication_logs')) {
if (!Schema::hasTable('communication_logs')) {
return;
}
@@ -5,9 +5,7 @@ namespace App\Services\Communication;
class CommunicationPreviewService
{
private CommunicationTemplateService $templates;
private CommunicationStudentService $students;
private CommunicationFamilyService $families;
public function __construct(
@@ -28,7 +26,7 @@ class CommunicationPreviewService
string $teacherName
): array {
$template = $this->templates->findTemplateByKey($templateKey);
if (! $template) {
if (!$template) {
return [
'ok' => false,
'status' => 404,
@@ -37,7 +35,7 @@ class CommunicationPreviewService
}
$student = $this->students->getStudentBasic($studentId);
if (! $student) {
if (!$student) {
return [
'ok' => false,
'status' => 404,
@@ -48,7 +46,7 @@ class CommunicationPreviewService
$salutation = $this->families->guardianSalutation($familyId);
$autoVars = [
'student_fullname' => trim(($student['firstname'] ?? '').' '.($student['lastname'] ?? '')),
'student_fullname' => trim(($student['firstname'] ?? '') . ' ' . ($student['lastname'] ?? '')),
'student_grade' => $student['grade'] ?? '',
'parent_salutation' => $salutation,
'date' => $this->formatLocalDate('Y-m-d'),
@@ -72,7 +70,6 @@ class CommunicationPreviewService
{
return (string) preg_replace_callback('/\\{\\{\\s*([a-zA-Z0-9_\\.]+)\\s*\\}\\}/', function ($m) use ($vars) {
$key = $m[1];
return htmlspecialchars((string) ($vars[$key] ?? ''), ENT_QUOTES, 'UTF-8');
}, $template);
}
@@ -82,7 +79,6 @@ class CommunicationPreviewService
if (function_exists('local_date') && function_exists('utc_now')) {
return (string) local_date(utc_now(), $format);
}
return now()->format($format);
}
}
@@ -7,7 +7,6 @@ use App\Services\EmailService;
class CommunicationSendService
{
private EmailService $mailer;
private CommunicationLogService $logService;
public function __construct(EmailService $mailer, CommunicationLogService $logService)
@@ -62,7 +61,7 @@ class CommunicationSendService
$sendOk = false;
}
if (! $sendOk && $error === null) {
if (!$sendOk && $error === null) {
$error = 'Mailer returned false';
}
@@ -91,7 +90,6 @@ class CommunicationSendService
private function normalizeEmails(array $values): array
{
$out = array_values(array_unique(array_filter(array_map('strval', $values))));
return array_values(array_filter($out, static function ($email) {
return $email !== '';
}));
@@ -33,13 +33,13 @@ class CommunicationStudentService
->orderBy('sc.id', 'desc')
->first();
if (! $row) {
if (!$row) {
return null;
}
$row = (array) $row;
$grade = $row['registration_grade'] ?? '';
if (! $grade && ! empty($row['class_section_name'])) {
if (!$grade && !empty($row['class_section_name'])) {
$grade = $row['class_section_name'];
}
@@ -17,7 +17,6 @@ class CommunicationTemplateService
->get()
->map(function ($row) use ($keyColumn, $bodyColumn) {
$row = (array) $row;
return [
'template_key' => (string) ($row[$keyColumn] ?? ''),
'subject' => (string) ($row['subject'] ?? ''),
@@ -36,7 +35,7 @@ class CommunicationTemplateService
->where('is_active', 1)
->first();
if (! $row) {
if (!$row) {
return null;
}
@@ -53,7 +52,6 @@ class CommunicationTemplateService
{
$keyColumn = Schema::hasColumn('email_templates', 'template_key') ? 'template_key' : 'code';
$bodyColumn = Schema::hasColumn('email_templates', 'body') ? 'body' : 'body_html';
return [$keyColumn, $bodyColumn];
}
}