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): ?> + company)?>
+ + getFullName()): ?> + getFullName()?>
+ + street?>
+ zip?> 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 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: 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 PINs keine Auskünfte erteilen können.

+
+ +
+ +
+

Sollten Sie noch Fragen haben, erreichen Sie uns per Mail an email?> oder telefonisch unter der Rufnummer phone?>.

+
+ +
+ +
+

Mit freundlichen Grüßen,

+
+ +
+ +
+

Ihr Team der 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 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): ?> +amount,0,12))?> | product->name,0,42))))?> | billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")) ))?> | price,0,12))?> | EUR price_setup?> + +----------------------------------------------------------------------------------------------------------------------- + + +terminations) && count($order->terminations)): ?> +Anschluss +========== +terminations as $term): ?> +getAddress()?> + + + + + +Bestelldetails +=============== +Bestelldatum: order_date)?> + +Bestellung abgeschlossen: finish_date)?> + +Einwilligung Datenschutz: allow_contact)? "Ja" : "Nein"?> + + + +Vertragsinhaber +================ +Firma: owner->company?> + +Vorname: owner->firstname?> + +Nachname: owner->lastname?> + +Straße: owner->street?> + +PLZ: owner->zip?> + +Ort: owner->city?> + +Land: owner->country?> + +Telefon: owner->phone?> + +Fax: owner->fax?> + +Mobiltelefon: owner->mobile?> + +Email: owner->email?> + +billingaddress_id > 0 && $order->billingaddress_id != $order->owner_id): ?> + + +Rechnungsempfänger +=================== +Firma: billingaddress->company?> + +Vorname: billingaddress->firstname?> + +Nachname: billingaddress->lastname?> + +Straße: billingaddress->street?> + +PLZ: billingaddress->zip?> + +Ort: billingaddress->city?> + +Land: billingaddress->country?> + +Telefon: billingaddress->phone?> + +Fax: billingaddress->fax?> + +Mobiltelefon: billingaddress->mobile?> + +Email: billingaddress->email?> + + + + +Verrechnung +============ +billing_type == "invoice"): ?> +Verrechnungsart: Rechnung + +Verrechnungsart: SEPA Bankeinzug +Bank: bank_account_bank?> + +Kontoinhaber: bank_account_owner?> + +IBAN: bank_account_iban?> + +BIC: 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 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 +]); + +?> +creator->name)?> hat die Bestellung einer Telefonanlage für den Kunden angelegt - siehe Dokument im Anhang. Bitte um technische Prüfung und Materialabklärung bzw. Herstellungsfreigabe. + +TheTool OrderROBOT (-; + +https:// $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 +]); + +?> +creator->name)?> hat eine Projektbestellung für den Kunden angelegt - siehe Dokument im Anhang. Bitte um technische Prüfung und Materialabklärung bzw. Herstellungsfreigabe. + +TheTool OrderROBOT (-; + +https:// $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 +]); + +?> +creator->name)?> hat soeben eine Einzugsermächtigung für den Kunden angelegt - siehe Dokument im Anhang. Bitte um Prüfung und Aktualisierung der Bankdaten des Kunden. + +TheTool OrderROBOT (-; + +https:// $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 +]); + +?> +creator->name)?> hat soeben eine Rufnummerportierung für den Kunden angelegt - siehe Dokument im Anhang. Bitte um Prüfung des Herstellungstermins und Einreichung. + +TheTool OrderROBOT (-; + +https:// $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: terminations[0]->building->network->name?> + +Bauabschnitt: terminations[0]->building->networksection_id) ? $order->terminations[0]->building->networksection->name : "")?> + +Kundennummer: owner->customer_number?> + +Kunde: owner->getCompanyOrName()))?> + +Verrechungsstart: / + + +Rechnungspositionen +==================== + +Anzahl | Produktname | Verrechungsperiode | Preis periodisch | Preis Herstellung +----------------------------------------------------------------------------------------------------------------------- +products as $op): ?> +price_nne > 0.0) $nne_products[] = $op; ?> +amount,0,12))?> | product->name,0,42))))?> | billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")) ))?> | price,0,12))?> | EUR price_setup?> + +----------------------------------------------------------------------------------------------------------------------- + + + + +Gutschriften +============= + +terminations[0]->building->network->owner): ?> +Netzeigentümer: terminations[0]->building->network->owner->getCompanyOrName()?> + + +Anzahl | Produktname | Verrechungsperiode | Bauabschnitt | NNE +----------------------------------------------------------------------------------------------------------------------- + +amount,0,12))?> | product->name,0,42))))?> | billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")) ))?> | termination->building->networksection_id) ? $op->termination->building->networksection->name : "",0,24))?> | EUR 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 @@ @@ -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 @@
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
- + - + - + - +
Kundennummer:customer_number?>customer_number?>
Vertrag erfasst am:create)?>create)?>
Bestelldatum:order_date)?>order_date)?>