diff --git a/Layout/default/Address/View.php b/Layout/default/Address/View.php index fddef87d5..199ca265c 100644 --- a/Layout/default/Address/View.php +++ b/Layout/default/Address/View.php @@ -99,7 +99,17 @@ -

Verrechnungsdatenlinks) && is_array($address->links["billing"]) && count($address->links["billing"])) ? " (Achtung: Seperate Rechnungsadresse vorhanden)" : ""?>

+ +

+ Verrechnungsdaten + links_to) && is_array($address->links_to["billing"]) && count($address->links_to["billing"])): ?> + (Achtung: Seperate Rechnungsadresse vorhanden) + linked_as) && is_array($address->linked_as["billing"]) && count($address->linked_as["billing"])): ?> + (Ist aktive Rechnungsadresse) + + +

+ UID uid?> @@ -243,7 +253,19 @@ contracts) && count($address->contracts)): ?> diff --git a/Layout/default/Contract/CancelForm.php b/Layout/default/Contract/CancelForm.php index 85764a9a8..e6cbc91f3 100644 --- a/Layout/default/Contract/CancelForm.php +++ b/Layout/default/Contract/CancelForm.php @@ -73,7 +73,7 @@
- +
">
diff --git a/Layout/default/Contract/View.php b/Layout/default/Contract/View.php index 0783d4064..9f104222f 100644 --- a/Layout/default/Contract/View.php +++ b/Layout/default/Contract/View.php @@ -24,6 +24,7 @@
diff --git a/Layout/default/Emailtemplates/attachments/cancel_notification.pdf.php b/Layout/default/Emailtemplates/attachments/cancel_notification.pdf.php new file mode 100644 index 000000000..e8a13fe43 --- /dev/null +++ b/Layout/default/Emailtemplates/attachments/cancel_notification.pdf.php @@ -0,0 +1,113 @@ +setReturnValue([ + 'filename' => "xinon-kuendigungsbestaetigung-".$owner->customer_number.".pdf" +]); +?> + + + + + Kündigungsbestätigung + + + + + + + + +
+   +
+ +
+ +
+ + +
+ + +
+ company): ?> + company)?>
+ + getFullName()): ?> + getFullName()?>
+ + street?>
+ zip?> city?> +
+ +
+ +
+
+
Studenzen,
+
+
+

Kündigungsbetätigung

+
+ +
+

Ihre Kundennummer: customer_number?>

+ +
+ + + +
+

Sehr geehrter Kunde,

+
+

wir haben Ihre Kündigung erhalten und bedauern es, dass Sie unsere Services nicht mehr in Anspruch nehmen möchten.

+

Gemäß der vertraglich vereinbarten Kündigungsfrist bestätigen wir, dass Ihre Produkte und Services wie folgt + gekündigt werden:

+
+ + + + + + + + + + + + + + + +
Produkt / ServiceKündigungsdatum
+ product_name?> + matchcode): ?> +
matchcode?> + +
cancel_date)?>
+ product_name?> + matchcode): ?> +
matchcode?> + +
cancel_date)?>
+
+

Die gekündigten Produkte und Services stehen Ihnen nach dem Kündigungsdatum nicht mehr zur Verfügung

+

Sollten Sie keine Produkte oder Services mehr von uns beziehen, werden Ihre in unserem System gespeicherten Daten + gemäß den gesetzlichen Vorgaben nach Ablauf der vorgeschriebenen Fristen gelöscht.

+

Die Abrechnung der Entgelte für die genutzten Services erfolgt bis zum genannten Datum und wird Ihnen entsprechend übermittelt.

+

Wir bedanken uns für Ihr Vertrauen und wünschen Ihnen alles Gute für die Zukunft.

+
+
+

Mit freundlichen Grüßen,

+

Xinon GmbH

+
+ + + + diff --git a/Layout/default/Emailtemplates/attachments/new_order_spin.pdf.php b/Layout/default/Emailtemplates/attachments/new_order_spin.pdf.php index c07ba156f..1ae626e9b 100644 --- a/Layout/default/Emailtemplates/attachments/new_order_spin.pdf.php +++ b/Layout/default/Emailtemplates/attachments/new_order_spin.pdf.php @@ -23,7 +23,7 @@
- + 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 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);