|
@@ -313,10 +313,11 @@ class Test extends Model {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @param string $to_address
|
|
* @param string $to_address
|
|
|
|
|
+ * @param bool $include_previous_test
|
|
|
* @return bool
|
|
* @return bool
|
|
|
* @throws Exception
|
|
* @throws Exception
|
|
|
*/
|
|
*/
|
|
|
- public function sendResultEmail(string $to_address): bool {
|
|
|
|
|
|
|
+ public function sendResultEmail(string $to_address, bool $include_previous_test): bool {
|
|
|
|
|
|
|
|
$location = $this->getLocation();
|
|
$location = $this->getLocation();
|
|
|
$project = $this->getProject();
|
|
$project = $this->getProject();
|
|
@@ -367,14 +368,17 @@ class Test extends Model {
|
|
|
|
|
|
|
|
// Previous test
|
|
// Previous test
|
|
|
$previous_pdf_path = $previous_pdf_name = null;
|
|
$previous_pdf_path = $previous_pdf_name = null;
|
|
|
- $previous_test = $this->getPreviousTest();
|
|
|
|
|
- if($previous_test && $previous_test->hasPDF()) {
|
|
|
|
|
- $builder->addParagraph("The previous test result has also been attached for your reference.");
|
|
|
|
|
|
|
|
|
|
- $previous_dt = new DateTime($previous_test->dts_start, new DateTimeZone("UTC"));
|
|
|
|
|
|
|
+ if($include_previous_test) {
|
|
|
|
|
+ $previous_test = $this->getPreviousTest();
|
|
|
|
|
+ if($previous_test && $previous_test->hasPDF()) {
|
|
|
|
|
+ $builder->addParagraph("The previous test result has also been attached for your reference.");
|
|
|
|
|
|
|
|
- $previous_pdf_path = $previous_test->getPDFPath();
|
|
|
|
|
- $previous_pdf_name = implode(" - ", array_filter([$location->internal_id, $previous_dt->format("jS M Y")])) . ".pdf";
|
|
|
|
|
|
|
+ $previous_dt = new DateTime($previous_test->dts_start, new DateTimeZone("UTC"));
|
|
|
|
|
+
|
|
|
|
|
+ $previous_pdf_path = $previous_test->getPDFPath();
|
|
|
|
|
+ $previous_pdf_name = implode(" - ", array_filter([$location->internal_id, $previous_dt->format("jS M Y")])) . ".pdf";
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$content = $builder->build();
|
|
$content = $builder->build();
|