// leave commented out or empty if MagicSmoke should figure it out automatically
// $BaseUrl = "https://localhost/smoke/index.php";
+//make sure files are interpreted as UTF-8
+// mb_language('uni');
+
?>
\ No newline at end of file
return array(
'isObject' => new Twig_Filter_Method($this, 'isObjectTest'),
'isFalse' => new Twig_Filter_Method($this, 'isFalse'),
+ 'isNull' => new Twig_Filter_Method($this, 'isFalse'),
'getClass' => new Twig_Filter_Method($this, 'getClass'),
);
}
//return verified cart and order
$trans->setorder($ord);
$trans->setcart($cart);
+ //send mail
+ $ord->mailDetails();
}
/**helper function for createOrder: verifies customer settings*/
$ord->status=WTorder::Sent;
$ord->update();
//return
- $trans->setorder(WOOrder::fromTableorder($ord));
+ $order=WOOrder::fromTableorder($ord);
+ $trans->setorder($order);
+ //mail
+ $order->mailDetails();
}
/**called from the OrderAddComment transaction*/
$tick->update();
}
//return
- $trans->setorder(WOOrder::fromTableorder($ord));
+ $order=WOOrder::fromTableorder($ord);
+ $trans->setorder($order);
+ //mail
+ $order->mailDetails();
}
/**called from the ReturnTicketVoucher transaction*/
$ord->update();
//return
- $trans->setorder(WOOrder::fromTableorder($ord));
+ $order=WOOrder::fromTableorder($ord);
+ $trans->setorder($order);
+ //send mail
+ $order->mailDetails();
}
/**called from the two functions below - checks whether the ticket can be changed*/
$trans->setvouchers( WOVoucherAudit::fromTableArrayvoucher_audit( WTvoucher_audit::selectFromDB($w)));
$trans->settickets( WOTicketAudit::fromTableArrayticket_audit( WTticket_audit::selectFromDB($w)));
}
+
+ ///mail order details to customer
+ public function mailDetails()
+ {
+ //get customer
+ $ct=WTcustomer::getFromDB($this->getcustomerid());
+ if(!is_a($ct,"WTcustomer")){
+ return;
+ }
+ if(!isEmail($ct->email)){
+ return;
+ }
+ //set reset parameters
+ global $MailFrom;
+ //init twig
+ BaseVars::initTwig();
+ BaseVars::init();
+ //gather basics and render mail
+ global $twig,$basevars;
+ $p=$twig->loadTemplate("ordermail.txt");
+ $list['customer']=WOCustomer::fromTablecustomer($ct);
+ $list['order']=$this;
+ $page=explode("\n",trim($p->render($list)));
+ //parse mail
+ if(count($page)<2)return;
+ $subject=array_shift($page);
+ $mode=0;
+ $mailtext="";$mailheader="";
+ foreach($page as $line){
+ if($mode==0){
+ if(trim($line)=="")$mode=1;
+ else $mailheader.=$line."\n";
+ }else{
+ $mailtext.=$line."\n";
+ }
+ }
+ //send mail
+ mb_send_mail($ct->email,$subject,$mailtext,$mailheader);
+ }
};
?>
\ No newline at end of file
//return
$trans->setticketuse($ret);
}
+
+ ///helper to get the event data in templates
+ public function getevent()
+ {
+ return WOEvent::fromTableevent(WTevent::getFromDB($this->geteventid()));
+ }
};
?>
\ No newline at end of file
--- /dev/null
+{#
+This template contains the mail sent to a customer
+when an order for this customer is created or changes.
+
+The first non-empty line contains the subject,
+subsequent lines contain the headers, then an empty line
+and after that the body of the mail.
+#}
+Order {{order.orderid}} Details at MagicSmoke.silmor.de
+From: no-reply@localdomain.com
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+Hello {{customer.title}} {{customer.name}}!
+
+Your order number {{order.orderid}} is currently at the status {{order.str_status}}.
+
+{% if order.invoiceaddress|isObject %}
+Your order will be invoiced to the following address:
+{{order.invoiceaddress.name}}
+{{order.invoiceaddress.addr1}}
+{{order.invoiceaddress.addr2}}
+{{order.invoiceaddress.city}} {{order.invoiceaddress.state}}
+{{order.invoiceaddress.zipcode}} {% if order.invoiceaddress.country|isObject %}{{order.invoiceaddress.country.name}}{% endif %}
+{% endif %}
+
+{% if order.deliveryaddress|isObject %}
+Your order will be delivered to the following address:
+{{order.deliveryaddress.name}}
+{{order.deliveryaddress.addr1}}
+{{order.deliveryaddress.addr2}}
+{{order.deliveryaddress.city}} {{order.deliveryaddress.state}}
+{{order.deliveryaddress.zipcode}} {% if order.deliveryaddress.country|isObject %}{{order.deliveryaddress.country.name}}{% endif %}
+{% endif %}
+
+
+
+total price : {{order.totalprice|asMoney}}
+already paid: {{order.amountpaid|asMoney}}
+payment due : {{order.amountdue|asMoney}}
+
+
+Detailed listing:
+
+{% for ticket in order.tickets %}
+Ticket: {{ticket.event.title}} ({{ticket.pricecategory.name}}) {{ticket.price|asMoney}} ({{ticket.str_status}})
+{% endfor %}
+{% for voucher in order.vouchers %}
+Voucher (Value: {{voucher.value|asMoney}}): {{voucher.price|asMoney}}
+{% endfor %}
+{% for item in order.items %}
+{{item.amount}}x {{item.productname}} {{item.totalprice}}
+{% endfor %}
+{% if order.shippingtype|isObject %}
+Shipping: {{order.shippingtype.description}} {{order.shippingcosts|asMoney}}
+{% endif %}
+
+
+
+The order was created {{order.ordertime|asDateTime}}.
+
+{% if not order.senttime|isNull %}
+{% if order.senttime > 0 %}
+The order has been shipped {{order.senttime|asDateTime}}.
+{% endif %}
+{% endif %}
+
+
+
+
+ with best regards,
+ your MagicSmoke team