Просмотр исходного кода

Change PDF name in attachment.

Alan Lam 8 лет назад
Родитель
Сommit
378d4528bd
1 измененных файлов с 5 добавлено и 6 удалено
  1. 5 6
      engine/test.php

+ 5 - 6
engine/test.php

@@ -122,12 +122,7 @@ class Test extends Model {
 
 
 		$location = $this->getLocation();
 		$location = $this->getLocation();
 
 
-		$pdf_path = $this->getDirectory() . "/pdf.pdf";
-
 		// Content
 		// Content
-		$name = htmlspecialchars($this->first_name);
-		$link = htmlspecialchars(PROTOCOL . "://" . DOMAIN . "/verify-email/" . $this->verify_token);
-
 		$pass_text = strtoupper($this->getPassText());
 		$pass_text = strtoupper($this->getPassText());
 		$stage = $this->challenge_stage;
 		$stage = $this->challenge_stage;
 
 
@@ -137,6 +132,10 @@ class Test extends Model {
 		$unix_start = strtotime($this->dts_start . " UTC");
 		$unix_start = strtotime($this->dts_start . " UTC");
 		$date_time = date("d/m/Y H:i", $unix_start);
 		$date_time = date("d/m/Y H:i", $unix_start);
 
 
+		// Attachments
+		$pdf_path = $this->getDirectory() . "/pdf.pdf";
+		$pdf_name = implode(" - ", array_filter([$location->internal_id, date("jS M Y")]));
+
 		// Build
 		// Build
 		$builder = new EmailBuilder;
 		$builder = new EmailBuilder;
 		$builder->addLeadParagraph("Congratulations!<br />A test has been completed at your location.");
 		$builder->addLeadParagraph("Congratulations!<br />A test has been completed at your location.");
@@ -148,7 +147,7 @@ class Test extends Model {
 		$mail->setHtmlContent($content);
 		$mail->setHtmlContent($content);
 		$mail->setFrom(EMAIL_CONTACT, EMAIL_FROM_NAME);
 		$mail->setFrom(EMAIL_CONTACT, EMAIL_FROM_NAME);
 		$mail->addAddress($to_address);
 		$mail->addAddress($to_address);
-		$mail->addAttachment($pdf_path);
+		$mail->addAttachment($pdf_path, $pdf_name);
 
 
 		$mail->setSubject("$pass_text - $stage - Check Policy visit to: $location_string $date_time");
 		$mail->setSubject("$pass_text - $stage - Check Policy visit to: $location_string $date_time");