Skip to content

Call-in notification handling does not replace $patientName placeholder #521

@mschoettle

Description

@mschoettle

The call-in notification template had (temporarily removed in opalmedapps/opal-db-management#751) the placeholder $patientName which does not get replaced when building the notification to be sent to caregivers:

$language = strtoupper($detail['language']);
$message = self::buildMessageForRoomNotification($room["room_".$language], $messageLabels["Name_".$language ], $messageLabels["Description_".$language]);
$dynamicKeys = [];
// Special case for replacing the $institution wildcard
if (str_contains($message["mdesc"], '$institution')) {
$dynamicKeys['$institution'] = $detail['institution_acronym'];
}
// prepare array for replacements
$patterns = array();
$replacements = array();
$indice = 0;
foreach($dynamicKeys as $key=>$val) {
$patterns[$indice] = $key;
$replacements[$indice] = $val;
$indice +=1;
}

Probably doing something like this should work:

// Special case for replacing the $patientName wildcard
if (str_contains($messageTemplate, '$patientName')) {
$firstName = $patient['FirstName'];
// Add $patientName as a wildcard for replacement
$dynamicKeys['$patientName'] = $firstName;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions