diff --git a/Layout/andom-tec/Emailtemplates/attachments/new_order_spin.pdf.php b/Layout/andom-tec/Emailtemplates/attachments/new_order_spin.pdf.php
new file mode 100644
index 000000000..7a9f8d832
--- /dev/null
+++ b/Layout/andom-tec/Emailtemplates/attachments/new_order_spin.pdf.php
@@ -0,0 +1,81 @@
+setReturnValue([
+ 'filename' => "Wichtige Kundeninformation ".$owner->customer_number.".pdf"
+ ]);
+?>
+
+
+
+
+ Wichtige Kundeninformation zu Ihrem Glasfaseranschluss
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ company): ?>
+ =nl2br($owner->company)?>
+
+ getFullName()): ?>
+ =$owner->getFullName()?>
+
+ =$owner->street?>
+ =$owner->zip?> =$owner->city?>
+
+
+
+
+
+
Wichtige Kundeninformation zu Ihrem Glasfaseranschluss
+
+
+
+
Sehr geehrte Damen und Herren,
+
wir freuen uns sehr, dass Sie sich für einen Glasfaseranschluss im Netz der =$netowner->company?> entschieden haben. Hiermit möchten wir Ihnen gerne den Eingang Ihrer Bestellung bestätigen.
+
Bezüglich der gegebenenfalls erforderlichen Termine für die Installation melden wir uns (bzw. unsere Partner vom Leitungsbau) sobald die Herstellung möglich ist.
+
Ihr persönlicher Service-PIN lautet: =$owner->spin?>
+
Gemäß der EU-Datenschutzverordnung sind wir dazu verpflichtet, mit den uns anvertrauten Kundendaten sorgsam umzugehen. Dazu gehört die Abfrage eines Service-PINs mit welchem Sie bei uns auch
+ telefonische Auskünfte (z.B. vergessene Passwörter, Rechnungsauskünfte, etc.) erhalten können. Unsere Mitarbeiter werden Sie vor Beantwortung Ihrer Fragen um die Nennung des Service-PINs bitte.
+ Bitte haben Sie Verständnis, dass wir ohne korrekte Nennung Ihres PIN s keine Auskünfte erteilen können.
+
+
+
+
+
+
Sollten Sie noch Fragen haben, erreichen Sie uns per Mail an =$netowner->email?> oder telefonisch unter der Rufnummer =$netowner->phone?>.
+
+
+
+
+
+
Mit freundlichen Grüßen,
+
+
+
+
+
+
Ihr Team der =$netowner->company?>
+
+
+
+
\ No newline at end of file
diff --git a/Layout/andom-tec/Emailtemplates/customer/new_order.php b/Layout/andom-tec/Emailtemplates/customer/new_order.php
new file mode 100644
index 000000000..0c2868e77
--- /dev/null
+++ b/Layout/andom-tec/Emailtemplates/customer/new_order.php
@@ -0,0 +1,15 @@
+setReturnValue([
+ 'subject' => "Ihre Bestellung wurde erfasst",
+ 'from_email' => $netowner->email,
+ 'from_email_name' => $netowner->company." Kundenservice"
+ ]);
+?>
+
+Sehr geehrte Damen und Herren,
+
+im Anhang finden Sie weitere Informationen zur Ihrer Glasfaserbestellung, sowie Ihren persönlichen Service-PIN.
+
+Mit freundlichen Grüßen,
+
+Ihr Team der =$netowner->company?>
diff --git a/Layout/andom-tec/Emailtemplates/order/billing_external_energie.php b/Layout/andom-tec/Emailtemplates/order/billing_external_energie.php
new file mode 100644
index 000000000..a5a441533
--- /dev/null
+++ b/Layout/andom-tec/Emailtemplates/order/billing_external_energie.php
@@ -0,0 +1,131 @@
+terminations[0]->id;
+ $op = OrderProductModel::getFirst(['order_id' => $order->id, 'termination_id' => $term_id]);
+
+ $billing_start = date('U');
+ if($op->billing_delay) {
+ $billing_start = strtotime("+".$op->billing_delay." months");
+ }
+
+ $subject = "";
+ if($order->upgrade) {
+ $subject .= "[UPGRADE] ";
+ }
+ $subject .= $order->partner_number." - "
+ ."hergestellt am ".date("d.m.Y", $order->finish_date) . " - "
+ ."Verrechnung ab ".date("m", $billing_start)."/".date("Y", $billing_start)." - "
+ .str_replace("\n", " ", str_replace("\r", "", $order->owner->getCompanyOrName()));
+
+ $this->setReturnValue([
+ 'subject' => $subject,
+
+ 'from_email' => TT_OUTGOING_EMAIL,
+ 'from_email_name' => "XINON Partnerservice"
+ ]);
+
+?>
+upgrade): ?>
+Achtung: UPGRADE
+
+
+
+Rechnungspositionen
+====================
+
+Anzahl | Produktname | Verrechungsperiode | Preis periodisch | Preis Herstellung
+-----------------------------------------------------------------------------------------------------------------------
+products as $op): ?>
+=sprintf("%-12s", substr($op->amount,0,12))?> | =utf8_encode(sprintf("%-42s", utf8_decode(substr($op->product->name,0,42))))?> | =utf8_encode(sprintf("%-18s", utf8_decode(($op->billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")) ))?> | =sprintf("EUR %-12s", substr($op->price,0,12))?> | EUR =$op->price_setup?>
+
+-----------------------------------------------------------------------------------------------------------------------
+
+
+terminations) && count($order->terminations)): ?>
+Anschluss
+==========
+terminations as $term): ?>
+=$term->getAddress()?>
+
+
+
+
+
+Bestelldetails
+===============
+Bestelldatum: =date("d.m.Y", $order->order_date)?>
+
+Bestellung abgeschlossen: =date("d.m.Y", $order->finish_date)?>
+
+Einwilligung Datenschutz: =($order->allow_contact)? "Ja" : "Nein"?>
+
+
+
+Vertragsinhaber
+================
+Firma: =$order->owner->company?>
+
+Vorname: =$order->owner->firstname?>
+
+Nachname: =$order->owner->lastname?>
+
+Straße: =$order->owner->street?>
+
+PLZ: =$order->owner->zip?>
+
+Ort: =$order->owner->city?>
+
+Land: =$order->owner->country?>
+
+Telefon: =$order->owner->phone?>
+
+Fax: =$order->owner->fax?>
+
+Mobiltelefon: =$order->owner->mobile?>
+
+Email: =$order->owner->email?>
+
+billingaddress_id > 0 && $order->billingaddress_id != $order->owner_id): ?>
+
+
+Rechnungsempfänger
+===================
+Firma: =$order->billingaddress->company?>
+
+Vorname: =$order->billingaddress->firstname?>
+
+Nachname: =$order->billingaddress->lastname?>
+
+Straße: =$order->billingaddress->street?>
+
+PLZ: =$order->billingaddress->zip?>
+
+Ort: =$order->billingaddress->city?>
+
+Land: =$order->billingaddress->country?>
+
+Telefon: =$order->billingaddress->phone?>
+
+Fax: =$order->billingaddress->fax?>
+
+Mobiltelefon: =$order->billingaddress->mobile?>
+
+Email: =$order->billingaddress->email?>
+
+
+
+
+Verrechnung
+============
+billing_type == "invoice"): ?>
+Verrechnungsart: Rechnung
+
+Verrechnungsart: SEPA Bankeinzug
+Bank: =$order->bank_account_bank?>
+
+Kontoinhaber: =$order->bank_account_owner?>
+
+IBAN: =$order->bank_account_iban?>
+
+BIC: =$order->bank_account_bic?>
+
+
diff --git a/Layout/andom-tec/Emailtemplates/order/fileupload/handover_report.php b/Layout/andom-tec/Emailtemplates/order/fileupload/handover_report.php
new file mode 100644
index 000000000..965abe129
--- /dev/null
+++ b/Layout/andom-tec/Emailtemplates/order/fileupload/handover_report.php
@@ -0,0 +1,31 @@
+owner->getChildrenByType("techcontact");
+if(!is_array($contacts) || !count($contacts)) {
+ $contacts = [$order->owner];
+}
+
+$tos = [];
+foreach($contacts as $contact) {
+ if($contact->email) {
+ $tos[] = $contact->email;
+ }
+}
+
+$customer_string = str_replace(["\r","\n"], " ", $order->owner->getCompanyOrName());
+
+$subject = "Ihr Übergabeprotokoll / Technikerstammblatt";
+
+$this->setReturnValue([
+ 'subject' => $subject,
+ 'to' => $tos,
+ 'from_email' => "support@xinon.at",
+ 'from_email_name' => "XINON Kundenservice"
+]);
+
+?>
+Sehr geehrte Damen und Herren,
+
+im Anhang erhalten Sie das technische Übergabeprotokoll zum Anschluss des Kunden =$customer_string?> zur weiteren Verwendung.
+
+Ihr XINON Team
diff --git a/Layout/andom-tec/Emailtemplates/order/fileupload/order_pbx.php b/Layout/andom-tec/Emailtemplates/order/fileupload/order_pbx.php
new file mode 100644
index 000000000..063957ac1
--- /dev/null
+++ b/Layout/andom-tec/Emailtemplates/order/fileupload/order_pbx.php
@@ -0,0 +1,19 @@
+owner->getCompanyOrName())." [".$order->owner->customer_number."]";
+
+$subject = "Neue PBX-Bestellung eingelangt ($customer_string)";
+
+$this->setReturnValue([
+ 'subject' => $subject,
+ 'to' => "einkauf@xinon.at",
+ 'from_email' => TT_OUTGOING_EMAIL,
+ 'from_email_name' => TT_OUTGOING_EMAIL_NAME
+]);
+
+?>
+=str_replace(["\r","\n"], " ", $file->creator->name)?> hat die Bestellung einer Telefonanlage für den Kunden =$customer_string?> angelegt - siehe Dokument im Anhang. Bitte um technische Prüfung und Materialabklärung bzw. Herstellungsfreigabe.
+
+TheTool OrderROBOT (-;
+
+https://=$_SERVER['HTTP_HOST']?>=self::getUrl("Order","Index",['id' => $order->id])?>
diff --git a/Layout/andom-tec/Emailtemplates/order/fileupload/order_project.php b/Layout/andom-tec/Emailtemplates/order/fileupload/order_project.php
new file mode 100644
index 000000000..8ab9b7730
--- /dev/null
+++ b/Layout/andom-tec/Emailtemplates/order/fileupload/order_project.php
@@ -0,0 +1,19 @@
+owner->getCompanyOrName())." [".$order->owner->customer_number."]";
+
+$subject = "Neue Projektbestellung eingelangt ($customer_string)";
+
+$this->setReturnValue([
+ 'subject' => $subject,
+ 'to' => "einkauf@xinon.at",
+ 'from_email' => TT_OUTGOING_EMAIL,
+ 'from_email_name' => TT_OUTGOING_EMAIL_NAME
+]);
+
+?>
+=str_replace(["\r","\n"], " ", $file->creator->name)?> hat eine Projektbestellung für den Kunden =$customer_string?> angelegt - siehe Dokument im Anhang. Bitte um technische Prüfung und Materialabklärung bzw. Herstellungsfreigabe.
+
+TheTool OrderROBOT (-;
+
+https://=$_SERVER['HTTP_HOST']?>=self::getUrl("Order","Index",['id' => $order->id])?>
diff --git a/Layout/andom-tec/Emailtemplates/order/fileupload/sepa_form.php b/Layout/andom-tec/Emailtemplates/order/fileupload/sepa_form.php
new file mode 100644
index 000000000..f624c2a07
--- /dev/null
+++ b/Layout/andom-tec/Emailtemplates/order/fileupload/sepa_form.php
@@ -0,0 +1,19 @@
+owner->getCompanyOrName())." [".$order->owner->customer_number."]";
+
+$subject = "Neue Einzugsermächtigung eingelangt ($customer_string)";
+
+$this->setReturnValue([
+ 'subject' => $subject,
+ 'to' => "billing@xinon.at",
+ 'from_email' => TT_OUTGOING_EMAIL,
+ 'from_email_name' => TT_OUTGOING_EMAIL_NAME
+]);
+
+?>
+=str_replace(["\r","\n"], " ", $file->creator->name)?> hat soeben eine Einzugsermächtigung für den Kunden =$customer_string?> angelegt - siehe Dokument im Anhang. Bitte um Prüfung und Aktualisierung der Bankdaten des Kunden.
+
+TheTool OrderROBOT (-;
+
+https://=$_SERVER['HTTP_HOST']?>=self::getUrl("Order","Index",['id' => $order->id])?>
diff --git a/Layout/andom-tec/Emailtemplates/order/fileupload/voicenumber_porting.php b/Layout/andom-tec/Emailtemplates/order/fileupload/voicenumber_porting.php
new file mode 100644
index 000000000..743845049
--- /dev/null
+++ b/Layout/andom-tec/Emailtemplates/order/fileupload/voicenumber_porting.php
@@ -0,0 +1,19 @@
+owner->getCompanyOrName())." [".$order->owner->customer_number."]";
+
+$subject = "Neue Rufnummerportierung ($customer_string)";
+
+$this->setReturnValue([
+ 'subject' => $subject,
+ 'to' => "portierung@xinon.at",
+ 'from_email' => TT_OUTGOING_EMAIL,
+ 'from_email_name' => TT_OUTGOING_EMAIL_NAME
+]);
+
+?>
+=str_replace(["\r","\n"], " ", $file->creator->name)?> hat soeben eine Rufnummerportierung für den Kunden =$customer_string?> angelegt - siehe Dokument im Anhang. Bitte um Prüfung des Herstellungstermins und Einreichung.
+
+TheTool OrderROBOT (-;
+
+https://=$_SERVER['HTTP_HOST']?>=self::getUrl("Order","Index",['id' => $order->id])?>
diff --git a/Layout/andom-tec/Emailtemplates/order/int_billing_info.php b/Layout/andom-tec/Emailtemplates/order/int_billing_info.php
new file mode 100644
index 000000000..54dffa218
--- /dev/null
+++ b/Layout/andom-tec/Emailtemplates/order/int_billing_info.php
@@ -0,0 +1,79 @@
+terminations[0]->id;
+ $op = OrderProductModel::getFirst(['order_id' => $order->id, 'termination_id' => $term_id]);
+
+ if($order->finish_date) {
+ $billing_start = $order->finish_date;
+ } else {
+ $billing_start = date('U');
+ }
+
+ if($op->billing_delay) {
+ $billing_start = strtotime("+".$op->billing_delay." months");
+ }
+
+ $subject = "";
+ if($order->upgrade) {
+ $subject .= "[UPGRADE] ";
+ }
+ $subject .= $order->terminations[0]->building->network->name." - "
+ ."Verr. ab ".date("m", $billing_start)."/".date("Y", $billing_start)." - "
+ .$order->owner->customer_number." - "
+ .str_replace("\n", "", str_replace("\r\n", " ", $order->owner->getCompanyOrName()));
+
+ $this->setReturnValue([
+ 'subject' => $subject,
+
+ 'from_email' => TT_OUTGOING_EMAIL,
+ 'from_email_name' => TT_OUTGOING_EMAIL_NAME
+ ]);
+
+ $nne_products = [];
+?>
+upgrade): ?>
+Achtung: UPGRADE
+
+
+Netzgebiet: =$order->terminations[0]->building->network->name?>
+
+Bauabschnitt: =(($order->terminations[0]->building->networksection_id) ? $order->terminations[0]->building->networksection->name : "")?>
+
+Kundennummer: =$order->owner->customer_number?>
+
+Kunde: =str_replace("\n", "", str_replace("\r\n", " ", $order->owner->getCompanyOrName()))?>
+
+Verrechungsstart: =date("m", $billing_start)?>/=date("Y", $billing_start)?>
+
+
+Rechnungspositionen
+====================
+
+Anzahl | Produktname | Verrechungsperiode | Preis periodisch | Preis Herstellung
+-----------------------------------------------------------------------------------------------------------------------
+products as $op): ?>
+price_nne > 0.0) $nne_products[] = $op; ?>
+=sprintf("%-12s", substr($op->amount,0,12))?> | =utf8_encode(sprintf("%-42s", utf8_decode(substr($op->product->name,0,42))))?> | =utf8_encode(sprintf("%-18s", utf8_decode(($op->billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")) ))?> | =sprintf("EUR %-12s", substr($op->price,0,12))?> | EUR =$op->price_setup?>
+
+-----------------------------------------------------------------------------------------------------------------------
+
+
+
+
+Gutschriften
+=============
+
+terminations[0]->building->network->owner): ?>
+Netzeigentümer: =$order->terminations[0]->building->network->owner->getCompanyOrName()?>
+
+
+Anzahl | Produktname | Verrechungsperiode | Bauabschnitt | NNE
+-----------------------------------------------------------------------------------------------------------------------
+
+=sprintf("%-12s", substr($op->amount,0,12))?> | =utf8_encode(sprintf("%-42s", utf8_decode(substr($op->product->name,0,42))))?> | =utf8_encode(sprintf("%-18s", utf8_decode(($op->billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")) ))?> | =sprintf("%-24s", substr(($op->termination->building->networksection_id) ? $op->termination->building->networksection->name : "",0,24))?> | EUR =$op->price_nne?>
+
+-----------------------------------------------------------------------------------------------------------------------
+
+
+
+
+
diff --git a/Layout/default/Emailtemplates/attachments/new_order_spin.pdf.php b/Layout/default/Emailtemplates/attachments/new_order_spin.pdf.php
index 85e28fbf4..c07ba156f 100644
--- a/Layout/default/Emailtemplates/attachments/new_order_spin.pdf.php
+++ b/Layout/default/Emailtemplates/attachments/new_order_spin.pdf.php
@@ -23,19 +23,19 @@
-
+
Kundennummer:
- =$owner->customer_number?>
+ =$owner->customer_number?>
Vertrag erfasst am:
- =date('d.m.Y', $order->create)?>
+ =date('d.m.Y', $order->create)?>
Bestelldatum:
- =date('d.m.Y', $order->order_date)?>
+ =date('d.m.Y', $order->order_date)?>
@@ -85,14 +85,14 @@
Rechnungsauskünfte, etc) nach Ihrem persönlichen Service-PIN fragen.
-
+
Sollten Sie noch Fragen haben erreichen Sie uns per Mail (office@xinon.at) oder
- telefonisch unter der Rufnummer 03115 40800.
+ telefonisch unter der Rufnummer
03115 40800.
-
+
Mit besten Grüßen,
diff --git a/Layout/default/Order/Index.php b/Layout/default/Order/Index.php
index ca148782a..03310198a 100644
--- a/Layout/default/Order/Index.php
+++ b/Layout/default/Order/Index.php
@@ -50,7 +50,7 @@
$nid): ?>
- >=$fnet?>
+ >=$fnet?>
diff --git a/application/Dashboard/DashboardController.php b/application/Dashboard/DashboardController.php
index a0df469e5..da9f03ee7 100644
--- a/application/Dashboard/DashboardController.php
+++ b/application/Dashboard/DashboardController.php
@@ -94,8 +94,8 @@ class DashboardController extends mfBaseController {
$email->setBody($body);
$email->setFrom($from, $from_name);
$email->setTo($to);
- $email->setHeader("X-xinon-oid", $order->id);
- $email->setHeader("X-xinon-pid", $product->id);
+ $email->setHeader("X-".MFAPPNAME."-oid", $order->id);
+ $email->setHeader("X-".MFAPPNAME."-pid", $product->id);
$email->addAttachment($pdfpath, null, $pdfname, "application/pdf");
$email->send();
}
diff --git a/application/Emailnotification/Emailnotification.php b/application/Emailnotification/Emailnotification.php
index e3d12cb25..ee8c10aa5 100644
--- a/application/Emailnotification/Emailnotification.php
+++ b/application/Emailnotification/Emailnotification.php
@@ -14,7 +14,7 @@ class Emailnotification {
public function __construct() {
$this->headers = [
- 'X-Mailer' => 'XINON Mailer',
+ 'X-Mailer' => MFAPPNAME.' Mailer',
];
$this->email_from = TT_OUTGOING_EMAIL;
@@ -79,10 +79,11 @@ class Emailnotification {
$this->setHeader("Subject", $this->subject);
}
- if(!$this->headers['From'] && $this->from_name) {
+ if((!array_key_exists("From", $this->headers) || !$this->headers['From']) && $this->from_name) {
$this->headers['From'] = '"'.$this->from_name.'" <'.$this->email_from.'>';
}
+ $log = mfLoghandler::singleton();
//var_dump($this);exit;
@@ -108,6 +109,7 @@ class Emailnotification {
$body = $mime->get($mimeparams);
$headers = $mime->headers($this->headers);
+ //$log->debug(print_r($headers, true));
$mail =& Mail::factory('mail', ["-f ".$this->email_from]);
$mail->send($this->email_to, $headers, $body);
diff --git a/application/Order/Order.php b/application/Order/Order.php
index e7148fc52..b493ab021 100644
--- a/application/Order/Order.php
+++ b/application/Order/Order.php
@@ -93,6 +93,68 @@ class Order extends mfBaseModel {
}
}
+ public function sendSpinEmail() {
+ $owner = $this->getProperty("owner");
+
+ $spin_pdf_template = "Emailtemplates/attachments/new_order_spin.pdf";
+ $new_order_template = "Emailtemplates/customer/new_order";
+
+ $pdf_vars = [
+ 'order' => $this,
+ 'owner' => $owner
+ ];
+
+
+ if(TT_CUSTOM_ORDER_PDF_PER_NETOWNER) {
+ $terms = $this->getTerminations();
+ if(is_array($terms) && count($terms) && $terms[0]->id) {
+ $netowner = $terms[0]->building->network->owner;
+ } else {
+ $netowner = new Address(TT_CUSTOM_ORDER_PDF_DEFAULT_OWNER_ID);
+ }
+ $pdf_vars['netowner'] = $netowner;
+ }
+
+ // render service pin PDF
+ $pdf = new PdfForm($spin_pdf_template, $pdf_vars);
+ $pdfpath = $pdf->render();
+ $tvalue = $pdf->getReturnedValues();
+ $pdfname = $tvalue['filename'];
+
+ // send email to customer
+ // TODO template rendern auslagern nach Emailtempate klasse
+ $tpl = new Layout();
+ $tpl->setTemplate($new_order_template);
+
+ 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 = $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')");
+ } else {
+ $email = new Emailnotification();
+ $email->setSubject($subject);
+ $email->setBody($body);
+ $email->setFrom($from, $from_name);
+ $email->setTo($to);
+ $email->setHeader("X-".MFAPPNAME."-Oid", $this->id);
+ $email->addAttachment($pdfpath, null, $pdfname, "application/pdf");
+ $email->send();
+ $this->log->info(__CLASS__."::sendSpinEmail(): Sending new SPIN for ".$owner->getCompanyOrName()." (".$owner->id.")");
+ }
+
+ return true;
+ }
+
public function sendIntBillinfoEmail() {
// TODO template rendern auslagern nach Emailtempate klasse
$tpl = new Layout();
@@ -119,7 +181,7 @@ class Order extends mfBaseModel {
$email->setBody($body);
$email->setFrom($from, $from_name);
$email->setTo($to);
- $email->setHeader("X-xinon-oid", $this->id);
+ $email->setHeader("X-".MFAPPNAME."-oid", $this->id);
$email->send();
return true;
@@ -158,7 +220,7 @@ class Order extends mfBaseModel {
$email->setBody($body);
$email->setFrom($from, $from_name);
$email->setTo($to);
- $email->setHeader("X-Xinon-Oid", $this->id);
+ $email->setHeader("X-".MFAPPNAME."-Oid", $this->id);
$email->send();
return true;
@@ -213,8 +275,8 @@ class Order extends mfBaseModel {
$email->setBody($body);
$email->setFrom($from, $from_name);
$email->setTo($to);
- $email->setHeader("X-Xinon-Oid", $this->id);
- $email->setHeader("X-Xinon-OFid", $file->id);
+ $email->setHeader("X-".MFAPPNAME."-Oid", $this->id);
+ $email->setHeader("X-".MFAPPNAME."-OFid", $file->id);
$email->addAttachment($filepath, null, $file->file->filename, $mimetype);
$email->send();
$this->log->info(__CLASS__."::save(): Sending Order Fileupload Email to '$to'");
diff --git a/application/Order/OrderController.php b/application/Order/OrderController.php
index d87fc4308..d9b800bc3 100644
--- a/application/Order/OrderController.php
+++ b/application/Order/OrderController.php
@@ -67,9 +67,12 @@ class OrderController extends mfBaseController {
}
}
- $filter = [];
+ $rfilter = $this->request->filter;
+ if(!$rfilter) {
+ $rfilter = [];
+ }
- $this->layout->set("filter", $this->request->filter);
+ $this->layout->set("filter", $rfilter);
$filter = $this->getPreparedFilter($this->request->filter);
// pagination defaults
@@ -870,6 +873,7 @@ class OrderController extends mfBaseController {
continue;
}
$product_data['termination_id'] = $p['termination_id'];
+ $order_termination_id = $p['termination_id'];
} else {
$product_data['termination_id'] = null;
}
@@ -922,44 +926,8 @@ class OrderController extends mfBaseController {
if($spin && !AddressModel::search(['spin' => $spin])) {
$owner->spin = $spin;
if($owner->save()) {
-
- // render service pin PDF
- $pdf = new PdfForm("Emailtemplates/attachments/new_order_spin.pdf", ["owner" => $owner, "order" => $order]);
- $pdfpath = $pdf->render();
- $tvalue = $pdf->getReturnedValues();
- $pdfname = $tvalue['filename'];
-
- // send email to customer
- // TODO template rendern auslagern nach Emailtempate klasse
- $tpl = new Layout();
- $tpl->setTemplate("Emailtemplates/customer/new_order");
- $tpl->set("owner", $owner);
- $body = $tpl->render();
-
- $values = $tpl->getReturnedValue();
-
- $subject = $values['subject'];
- $from = $values['from_email'];
- $from_name = $values['from_email_name'];
- $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')");
- } else {
- $email = new Emailnotification();
- $email->setSubject($subject);
- $email->setBody($body);
- $email->setFrom($from, $from_name);
- $email->setTo($to);
- $email->setHeader("X-Xinon-Oid", $order->id);
- $email->setHeader("X-Xinon-Pid", $product->id);
- $email->addAttachment($pdfpath, null, $pdfname, "application/pdf");
- $email->send();
- $this->log->info(__CLASS__."::save(): Sending new SPIN for ".$owner->getCompanyOrName()." (".$owner->id.")");
- }
-
+ $order->sendSpinEmail();
}
-
}
} else {
$this->log->debug(__CLASS__."::save(): NOT creating new SPIN for ".$owner->getCompanyOrName()." (".$owner->id."): SPIN exists or owner of Order was changed or external products");
@@ -1217,8 +1185,24 @@ class OrderController extends mfBaseController {
$this->redirect("Order");
}
+ $pdf_vars = [
+ 'order' => $order,
+ 'owner' => $owner
+ ];
+
+
+ if(TT_CUSTOM_ORDER_PDF_PER_NETOWNER) {
+ $terms = $order->terminations;
+ if(is_array($terms) && count($terms) && $terms[0]->id) {
+ $netowner = $terms[0]->building->network->owner;
+ } else {
+ $netowner = new Address(TT_CUSTOM_ORDER_PDF_DEFAULT_OWNER_ID);
+ }
+ $pdf_vars['netowner'] = $netowner;
+ }
+
// render service pin PDF
- $pdf = new PdfForm("Emailtemplates/attachments/new_order_spin.pdf", ["owner" => $owner, "order" => $order]);
+ $pdf = new PdfForm("Emailtemplates/attachments/new_order_spin.pdf", $pdf_vars);
$pdfpath = $pdf->render();
$tvalue = $pdf->getReturnedValues();
$pdfname = $tvalue['filename'];
@@ -1246,45 +1230,13 @@ class OrderController extends mfBaseController {
$this->redirect("Order");
}
- // render service pin PDF
- $pdf = new PdfForm("Emailtemplates/attachments/new_order_spin.pdf", ["owner" => $owner, "order" => $order]);
- $pdfpath = $pdf->render();
- $tvalue = $pdf->getReturnedValues();
- $pdfname = $tvalue['filename'];
-
- // TODO template rendern auslagern nach Emailtempate klasse
- $tpl = new Layout();
- $tpl->setTemplate("Emailtemplates/customer/new_order");
- $tpl->set("owner", $owner);
- $body = $tpl->render();
-
- $values = $tpl->getReturnedValue();
-
- //var_dump($values);exit;
-
- $subject = $values['subject'];
- $from = $values['from_email'];
- $from_name = $values['from_email_name'];
- $to = $owner->email;
-
- if(!$subject || !$from || !$from_name || !$to) {
- $this->log->warn("Service PIN Email not sent. (subject: '$subject', from: '$from', from_email: '$from_name', to: '$to')");
- $this->layout()->setFlash("Beim Email versenden ist ein Fehler aufgetreten.", "error");
- $this->redirect("Order");
- } else {
- $email = new Emailnotification();
- $email->setSubject($subject);
- $email->setBody($body);
- $email->setFrom($from, $from_name);
- $email->setTo($to);
- $email->setHeader("X-Xinon-Oid", $order->id);
- $email->setHeader("X-Xinon-Pid", $product->id);
- $email->addAttachment($pdfpath, null, $pdfname, "application/pdf");
- $email->send();
-
+ if($order->sendSpinEmail()) {
$this->layout()->setFlash("Service PIN wurde erfolgreich versendet.", "success");
- $this->redirect("Order");
+ } else {
+ $this->layout()->setFlash("Fehler beim SPIN Versand!", "success");
}
+
+ $this->redirect("Order");
}
}
diff --git a/lib/Layout/Layout.php b/lib/Layout/Layout.php
index 72ad87147..69d4d2d7f 100644
--- a/lib/Layout/Layout.php
+++ b/lib/Layout/Layout.php
@@ -44,7 +44,7 @@ class Layout extends mfLayout {
}
/*
- * Gets mfBaseModel object from Cache or gets in from DB and saves it in Cache
+ * Gets mfBaseModel object from Cache or gets in from DB and saves it to Cache
*/
public static function getMfValuecacheObject($objectname, $id) {
$object = mfValuecache::singleton()->get("mfObjectmodel-$objectname-".$id);
diff --git a/public/assets/css/print.css b/public/assets/css/print.css
index 01e35378c..f9e88af06 100644
--- a/public/assets/css/print.css
+++ b/public/assets/css/print.css
@@ -15,8 +15,16 @@ html {
}
body {
- font-family: "Dejavu Sans", dejavusans;
- font-size:13px;
+ font-family: "Open Sans", "Dejavu Sans", dejavusans;
+ font-size:16pt;
height:100%;
margin-top: 20pt;
+}
+
+.center {
+ text-align: center;
+}
+
+.bold {
+ font-weight: bold;
}
\ No newline at end of file
diff --git a/public/assets/pdf/.gitignore b/public/assets/pdf/.gitignore
new file mode 100644
index 000000000..bf7d0f2f3
--- /dev/null
+++ b/public/assets/pdf/.gitignore
@@ -0,0 +1 @@
+logo-address-*.png
diff --git a/public/assets/pdf/logo-andom.png b/public/assets/pdf/logo-andom.png
new file mode 100644
index 000000000..e084e65fb
Binary files /dev/null and b/public/assets/pdf/logo-andom.png differ
diff --git a/public/assets/pdf/logo-bbaustria.png b/public/assets/pdf/logo-bbaustria.png
new file mode 100644
index 000000000..91be7713d
Binary files /dev/null and b/public/assets/pdf/logo-bbaustria.png differ
diff --git a/public/assets/pdf/logo-sknetworx.png b/public/assets/pdf/logo-sknetworx.png
new file mode 100644
index 000000000..0fed8b529
Binary files /dev/null and b/public/assets/pdf/logo-sknetworx.png differ
diff --git a/public/assets/pdf/logo.png b/public/assets/pdf/logo-xinon.png
similarity index 100%
rename from public/assets/pdf/logo.png
rename to public/assets/pdf/logo-xinon.png