From d8ffa695d6f094fc945e841af47c10345d3c0bc8 Mon Sep 17 00:00:00 2001 From: priyavrat7 Date: Tue, 23 Jun 2026 00:17:36 -0400 Subject: [PATCH 1/3] Fix DoB page loading for EDC-only participants Prevent DateTime::createFromFormat() from being called with a null DoB value by introducing a null-safe date formatting helper. The DoB tab now loads correctly when a participant has an EDC but no recorded date of birth. --- modules/candidate_parameters/ajax/getData.php | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/candidate_parameters/ajax/getData.php b/modules/candidate_parameters/ajax/getData.php index 65dead0bc0..2878fb5dfe 100644 --- a/modules/candidate_parameters/ajax/getData.php +++ b/modules/candidate_parameters/ajax/getData.php @@ -563,8 +563,7 @@ function getDOBFields(): array $dobFormat = $config->getSetting('dobFormat'); $dobProcessedFormat = implode("-", str_split($dobFormat, 1)); - $dobDate = DateTime::createFromFormat('Y-m-d', $dob); - $formattedDate = $dobDate ? $dobDate->format($dobProcessedFormat) : null; + $formattedDate = formatCandidateDate($dob, $dobProcessedFormat); $result = [ 'pscid' => $pscid, @@ -704,3 +703,28 @@ function getDiagnosisEvolutionFields(): array return $result; } +/** + * Format a candidate date for display. + * + * Returns null when the date is null or invalid. + * + * @param string|null $date Database date in Y-m-d format + * @param string $format Display format + * + * @return string|null + */ +function formatCandidateDate(?string $date, string $format): ?string +{ + if (empty($date)) { + return null; + } + + $dateTime = DateTime::createFromFormat('Y-m-d', $date); + + if ($dateTime === false) { + return null; + } + + return $dateTime->format($format); +} + From f9c097001d76d1490a20889cdd35402f06cb0087 Mon Sep 17 00:00:00 2001 From: priyavrat7 Date: Tue, 23 Jun 2026 10:28:15 -0400 Subject: [PATCH 2/3] Fixed checkstatic error --- modules/candidate_parameters/ajax/getData.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/candidate_parameters/ajax/getData.php b/modules/candidate_parameters/ajax/getData.php index 2878fb5dfe..9fd18f090d 100644 --- a/modules/candidate_parameters/ajax/getData.php +++ b/modules/candidate_parameters/ajax/getData.php @@ -563,7 +563,7 @@ function getDOBFields(): array $dobFormat = $config->getSetting('dobFormat'); $dobProcessedFormat = implode("-", str_split($dobFormat, 1)); - $formattedDate = formatCandidateDate($dob, $dobProcessedFormat); + $formattedDate = formatCandidateDate($dob, $dobProcessedFormat); $result = [ 'pscid' => $pscid, From 50a9b33563e10ec4a80a575c4d325c6a931ba33d Mon Sep 17 00:00:00 2001 From: priyavrat7 Date: Tue, 23 Jun 2026 12:44:40 -0400 Subject: [PATCH 3/3] Fix DoD page as well now to load for EDC-only participants Prevent DateTime::createFromFormat() from being called(similar issue like DoB) with a null DoB value by introducing a null-safe date formatting helper. The DoD tab now loads correctly when a participant has an EDC but no recorded date of birth. --- modules/candidate_parameters/ajax/getData.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/candidate_parameters/ajax/getData.php b/modules/candidate_parameters/ajax/getData.php index 9fd18f090d..0269d6e4bc 100644 --- a/modules/candidate_parameters/ajax/getData.php +++ b/modules/candidate_parameters/ajax/getData.php @@ -609,9 +609,10 @@ function getDODFields(): array $dobFormat = $config->getSetting('dobFormat'); $dobProcessedFormat = implode("-", str_split($dobFormat, 1)); - $dobDate = DateTime::createFromFormat('Y-m-d', $candidateData['DoB']); - $dob = $dobDate ? $dobDate->format($dobProcessedFormat) : null; - + $dob = formatCandidateDate( + $candidateData['DoB'] ?? null, + $dobProcessedFormat + ); $result = [ 'pscid' => $candidateData['PSCID'], 'candID' => $candID->__toString(),