|
|
@@ -149,9 +149,12 @@ class Test extends Model {
|
|
|
|
|
|
public function sendResultEmail($to_address) {
|
|
|
|
|
|
- // Subject Format: {pass-text} - {stage-number} - Check Policy visit to: {internal-id} : {name} : {city} ({dd/mm/yyyy} {hh:mm})
|
|
|
-
|
|
|
$location = $this->getLocation();
|
|
|
+ $project = $this->getProject();
|
|
|
+ $template = $project->getTemplate();
|
|
|
+
|
|
|
+ $subject_format_file_path = $template->getProcessingFilePath("result_email_subject_format.txt");
|
|
|
+ $subject_format = file_get_contents($subject_format_file_path);
|
|
|
|
|
|
// Content
|
|
|
$pass_text = strtoupper($this->getPassText());
|
|
|
@@ -163,6 +166,20 @@ class Test extends Model {
|
|
|
$unix_start = strtotime($this->dts_start . " UTC");
|
|
|
$date_time = date("d/m/Y H:i", $unix_start);
|
|
|
|
|
|
+ // Subject
|
|
|
+ $search_replace = [
|
|
|
+ "{pass}" => $pass_text,
|
|
|
+ "{stage}" => $stage,
|
|
|
+ "{location}" => $location_string,
|
|
|
+ "{date-time}" => $date_time,
|
|
|
+ ];
|
|
|
+
|
|
|
+ $subject = str_replace(
|
|
|
+ array_keys($search_replace),
|
|
|
+ array_values($search_replace),
|
|
|
+ $subject_format
|
|
|
+ );
|
|
|
+
|
|
|
// Attachments
|
|
|
$pdf_path = $this->getDirectory() . "/pdf.pdf";
|
|
|
$pdf_name = implode(" - ", array_filter([$location->internal_id, date("jS M Y")])) . ".pdf";
|
|
|
@@ -180,7 +197,7 @@ class Test extends Model {
|
|
|
$mail->addAddress($to_address);
|
|
|
$mail->addAttachment($pdf_path, $pdf_name);
|
|
|
|
|
|
- $mail->setSubject("$pass_text - $stage - Check Policy visit to: $location_string $date_time");
|
|
|
+ $mail->setSubject($subject);
|
|
|
|
|
|
$mail->send();
|
|
|
}
|