-
+
|
diff --git a/Layout/default/Emailtemplates/customer/cancel_notification.php b/Layout/default/Emailtemplates/customer/cancel_notification.php
new file mode 100644
index 000000000..bb108baea
--- /dev/null
+++ b/Layout/default/Emailtemplates/customer/cancel_notification.php
@@ -0,0 +1,22 @@
+setReturnValue([
+ 'subject' => "Ihre Kündigung",
+ 'from_email' => "office@xinon.at",
+ 'from_email_name' => "XINON Kundenservice"
+]);
+?>
+Sehr geehrter Kunde,
+
+im Anhang finden Sie Ihre Kündigungsbestätigung.
+Wir bedanken uns für Ihr Vertrauen und wünschen Ihnen alles Gute für die Zukunft.
+
+Mit besten Grüßen,
+
+Ihr XINON Team
+--
+XINON GmbH
+
+p: +43 3115 40 800
+f: +43 3115 40 800 10
+a: Fladnitz im Raabtal 150, 8322 Studenzen, AUSTRIA
+w: www.xinon.at e: office@xinon.at
diff --git a/Layout/default/Emailtemplates/customer/new_order.php b/Layout/default/Emailtemplates/customer/new_order.php
index 9e90df0fe..519225ee8 100644
--- a/Layout/default/Emailtemplates/customer/new_order.php
+++ b/Layout/default/Emailtemplates/customer/new_order.php
@@ -5,7 +5,6 @@
'from_email_name' => "XINON Kundenservice"
]);
?>
-
Sehr geehrte Damen und Herren,
im Anhang finden Sie weitere Informationen zur Ihrer Breitbandbestellung, sowie Ihren persönlichen Service-PIN.
diff --git a/Layout/default/Emailtemplates/invoice/invoice-email.php b/Layout/default/Emailtemplates/invoice/invoice-email.php
index f01634305..8b4eee441 100644
--- a/Layout/default/Emailtemplates/invoice/invoice-email.php
+++ b/Layout/default/Emailtemplates/invoice/invoice-email.php
@@ -8,7 +8,6 @@ $this->setReturnValue([
'from_email_name' => "XINON GmbH - Verrechnung"
]);
?>
-
Sehr geehrte Damen und Herren,
Im Anhang erhalten Sie Ihre aktuelle =($invoice->total < 0) ? "Gutschrift" : "Rechnung"?>.
diff --git a/Layout/default/Emailtemplates/order/fileupload/voicenumber_porting.php b/Layout/default/Emailtemplates/order/fileupload/voicenumber_porting.php
index 38ce7a130..b11524e2d 100644
--- a/Layout/default/Emailtemplates/order/fileupload/voicenumber_porting.php
+++ b/Layout/default/Emailtemplates/order/fileupload/voicenumber_porting.php
@@ -12,8 +12,6 @@ $this->setReturnValue([
]);
?>
-
-
project: portierung
type: Portierung
status: Neu
diff --git a/application/Contract/Contract.php b/application/Contract/Contract.php
index a0bf9f933..235e2382e 100644
--- a/application/Contract/Contract.php
+++ b/application/Contract/Contract.php
@@ -30,6 +30,7 @@ class Contract extends mfBaseModel {
private $relocationTo;
private $vatgroup;
private $vatrate;
+ private $voicenumbers;
private $finisher;
private $canceler;
private $creator;
@@ -203,6 +204,12 @@ class Contract extends mfBaseModel {
}
+ public function getVoicenumbers() {
+ $voicenumber = $this->getConfigValue("voicenumberblock_voicenumber");
+ $numbers = json_decode($voicenumber->json);
+ return $numbers;
+ }
+
public function getConfigValue($itemname) {
$configvalues = $this->getProperty("configvalues");
if(!$configvalues) return null;
@@ -224,6 +231,54 @@ class Contract extends mfBaseModel {
return true;
}
+ public function sendCancelNotification($linked_contracts = []) {
+ $pdf_vars = [
+ "contract" => $this,
+ "linked_contracts" => $linked_contracts,
+ "owner" => $this->getProperty("owner")
+ ];
+ $pdf = new PdfForm("Emailtemplates/attachments/cancel_notification.pdf", $pdf_vars);
+ //$pdf->download();
+ //exit;
+ $pdfpath = $pdf->render();
+ $tvalue = $pdf->getReturnedValues();
+ $pdfname = $tvalue["filename"];
+
+ // send email to customer
+ $tpl = new Layout();
+ $tpl->setTemplate("Emailtemplates/customer/cancel_notification");
+
+ foreach($pdf_vars as $name => $val) {
+ $tpl->set($name, $val);
+ }
+
+ $body = $tpl->render();
+ $values = $tpl->getReturnedValue();
+
+ $subject = $values['subject'];
+ $from = $values['from_email'];
+ $from_name = $values['from_email_name'];
+ $to = $this->owner->email;
+
+ if(!$subject || !$from || !$from_name || !$to) {
+ $this->log->warn("Service PIN Email not sent. (subject: '$subject', from: '$from_name', from_email: '$from', to: '$to')");
+ } else {
+ $email = new Emailnotification();
+ $email->setSubject($subject);
+ $email->setBody($body);
+ $email->setFrom($from, $from_name);
+ $email->setTo($to);
+ $email->setHeader("X-".MFAPPNAME."-Cid", $this->id);
+ $email->addAttachment($pdfpath, null, $pdfname, "application/pdf");
+ $email->send();
+
+ $email->setTo("office@xinon.at");
+ $email->send();
+
+ $this->log->info(__METHOD__.": Sending Cancel Notication for ".$this->owner_id." to $to");
+ }
+ }
+
public function getProperty($name) {
if($this->$name == null) {
@@ -336,6 +391,12 @@ class Contract extends mfBaseModel {
$this->vatrate = $vatrate;
return $this->vatrate;
}
+
+ if($name == "voicenumbers") {
+ $numbers = $this->getVoicenumbers();
+ $this->voicenumbers = $numbers;
+ return $this->voicenumbers;
+ }
if($name == "journals") {
$this->journals = array_reverse(ContractjournalModel::search(["contract_id" => $this->id]));
diff --git a/application/Contract/ContractController.php b/application/Contract/ContractController.php
index e789f89ae..37b772fe9 100644
--- a/application/Contract/ContractController.php
+++ b/application/Contract/ContractController.php
@@ -195,6 +195,7 @@ class ContractController extends mfBaseController
$this->redirect("Contract", "cancel", ["contract_id" => $contract->id]);
}
+ $linked_contracts = [];
if(is_array($r->links)) {
foreach($r->links as $link_id => $action) {
if($action == "cancel") {
@@ -205,6 +206,8 @@ class ContractController extends mfBaseController
continue;
}
+ $linked_contracts[] = $link_contract;
+
$link_contract->cancel_date = $cancel_date->getTimestamp();
if(!$link_contract->save()) {
$this->layout()->setFlash("Fehler beim Speichern von verlinktem Vertrag", "warning");
@@ -213,11 +216,38 @@ class ContractController extends mfBaseController
}
}
+
+
+
+
$this->layout()->setFlash("Kündigung gespeichert", "success");
$this->redirect("Contract", "view", ["contract_id" => $contract->id]);
}
+ protected function sendCancelNotification() {
+ $contract_id = $this->request->contract_id;
+ $contract = new Contract($contract_id);
+
+ $linked_contracts = [];
+ foreach($contract->links as $link) {
+ if($link->origin_contract_id == $contract_id) {
+ $link_contract = $link->contract;
+ } else {
+ $link_contract = $link->origin;
+ }
+ if($link_contract->owner_id != $contract->owner_id) continue;
+ $linked_contracts[] = $link_contract;
+ }
+
+ $contract->sendCancelNotification($linked_contracts);
+
+ $this->layout()->setFlash("gesendet", "success");
+ $this->redirect("Contract", "view", ["contract_id" => $contract_id]);
+
+
+ }
+
protected function productchangeAction()
{
$this->layout()->setTemplate("Contract/ProductchangeForm");
diff --git a/application/Order/Order.php b/application/Order/Order.php
index 41105b8dd..f922ad2c3 100644
--- a/application/Order/Order.php
+++ b/application/Order/Order.php
@@ -145,7 +145,7 @@ class Order extends mfBaseModel {
$to = $owner->email;
if(!$subject || !$from || !$from_name || !$to) {
- $this->log->warn("Service PIN Email not sent. (subject: '$subject', from: '$from', from_email: '$from_email', to: '$to')");
+ $this->log->warn("Service PIN Email not sent. (subject: '$subject', from: '$from_email', from_email: '$from', to: '$to')");
} else {
$email = new Emailnotification();
$email->setSubject($subject);
|