diff --git a/application/Preordernotification/Preordernotification.php b/application/Preordernotification/Preordernotification.php index 0852aadc9..14ee14757 100644 --- a/application/Preordernotification/Preordernotification.php +++ b/application/Preordernotification/Preordernotification.php @@ -20,8 +20,11 @@ class Preordernotification extends mfBaseModel { public function sendToPreorder(Preorder $preorder, $email_to = false) { $subject = $this->subject; - $body = $this->replaceBodyVariables($this->body_html, $preorder); // TODO: Variable replacement - + $body = ""; + $body .= $this->replaceBodyVariables($this->body_html, $preorder); // TODO: Variable replacement + $body .= ""; + $body .= "\n"; // explicitlyadd new line, or some mail clients wont show attachment + // TODO: Extract text part //var_dump($body);exit; diff --git a/application/Preordernotification/PreordernotificationController.php b/application/Preordernotification/PreordernotificationController.php index ffeafc505..77fdecf99 100644 --- a/application/Preordernotification/PreordernotificationController.php +++ b/application/Preordernotification/PreordernotificationController.php @@ -441,10 +441,22 @@ class PreordernotificationController extends mfBaseController { if($r->send_testmail && $r->testmail_to) { $preorder = PreorderModel::getFirstActive($preorder_filter); + + if($this->attach_borderpoint) { + $i = 1; + while(!$preorder->adb_hausnummer->gps_lat && !$preorder->adb_hausnummer->gps_long) { + $this->log->debug(__METHOD__.": round $i"); + $preorder = PreorderModel::searchActive($preorder_filter, ["start" => $i, "count" => 1]); + if(!$preorder) break; + $i++; + } + } + if(!$preorder) { $this->layout()->setFlash("Testmail konnte nicht versendet werden. Keine Empfänger gefunden", "warn"); $this->redirect("Preordernotification", "edit", ['id' => $new_id]); } + $notification->sendToPreorder($preorder, $r->testmail_to); $this->layout()->setFlash("Test Email erfolgreich versendet", "success"); $this->redirect("Preordernotification", "edit", ['id' => $new_id]);