[FIX] E2E testing - fix router, EmailService, frontend data mapping
Critical fixes discovered during end-to-end testing:
Router (index.php):
- Rewrote route resolution engine to properly handle /{id}/subAction patterns
- All routes like GET /assessments/{id}/questions, POST /incidents/{id}/early-warning,
GET /organizations/{id}/members now resolve correctly
- Routes with kebab-case sub-actions (early-warning, ai-analyze) now convert to camelCase
- Controller methods receive correct arguments via spread operator
EmailService.php:
- Fix PHP parse error: ?? operator cannot be used inside string interpolation {}
- Extract incident_code to variable before interpolation (3 occurrences)
assessment.html:
- Fix data structure handling: API returns categories with nested questions array
- Fix field names: question_code (not question_id), response_value (not compliance_level)
- Fix answer enum values: not_implemented/partial/implemented (not Italian)
- Fix question text field: question_text (not text/question/title)
- Show NIS2 article and ISO 27001 control references
- Fix response restoration from existing answers
dashboard.html:
- Fix data mapping from overview API response structure
- risks.total instead of open_risks, policies array instead of approved_policies
- Calculate training completion percentage from training object
- Load deadlines/activity from dedicated endpoints (not included in overview)
onboarding.html:
- Fix field name mismatches: annual_turnover_eur, contact_email, contact_phone,
full_name, phone (matching OnboardingController expected params)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -123,7 +123,8 @@ class EmailService
|
||||
</p>
|
||||
HTML;
|
||||
|
||||
$subject = "[URGENTE] Early Warning Incidente {$incident['incident_code'] ?? ''} - {$organization['name']}";
|
||||
$incidentCode = $incident['incident_code'] ?? '';
|
||||
$subject = "[URGENTE] Early Warning Incidente {$incidentCode} - {$organization['name']}";
|
||||
|
||||
foreach ($recipients as $email) {
|
||||
$this->send($email, $subject, $html);
|
||||
@@ -187,7 +188,8 @@ class EmailService
|
||||
</p>
|
||||
HTML;
|
||||
|
||||
$subject = "[NIS2] Notifica Incidente 72h {$incident['incident_code'] ?? ''} - {$organization['name']}";
|
||||
$incidentCode = $incident['incident_code'] ?? '';
|
||||
$subject = "[NIS2] Notifica Incidente 72h {$incidentCode} - {$organization['name']}";
|
||||
|
||||
foreach ($recipients as $email) {
|
||||
$this->send($email, $subject, $html);
|
||||
@@ -250,7 +252,8 @@ class EmailService
|
||||
</p>
|
||||
HTML;
|
||||
|
||||
$subject = "[NIS2] Report Finale Incidente {$incident['incident_code'] ?? ''} - {$organization['name']}";
|
||||
$incidentCode = $incident['incident_code'] ?? '';
|
||||
$subject = "[NIS2] Report Finale Incidente {$incidentCode} - {$organization['name']}";
|
||||
|
||||
foreach ($recipients as $email) {
|
||||
$this->send($email, $subject, $html);
|
||||
|
||||
Reference in New Issue
Block a user