Added externel product billing email

This commit is contained in:
Frank Schubert
2021-11-09 22:15:53 +01:00
parent bdae10aec1
commit 3f5eb667ac
4 changed files with 184 additions and 4 deletions

View File

@@ -494,6 +494,10 @@ class OrderController extends mfBaseController {
$order->save();
}
$ext_products = false;
$int_products = false;
//var_dump($r->products);exit;
// validate and add products
if(is_array($r->products) && count($r->products)) {
@@ -546,7 +550,11 @@ class OrderController extends mfBaseController {
}
// if product is not external and customer is new, create customer_number and service pin
if(!$prod->external ) {
if($prod->external) {
$ext_products = true;
} else {
$int_products = true;
if(!$owner->customer_number) {
$last_num = AddressModel::getLastCustomerNumber();
$this->log->debug("last_num: $last_num");
@@ -660,8 +668,21 @@ class OrderController extends mfBaseController {
// send order finish email
if($send_to_bill_email) {
if(!$order->sendIntBillinfoEmail()) {
$this->layout()->setFlash("Beim Senden der Billing Benachrichtigung ist ein Fehler aufgetreten.", "warning");
if($ext_products && !$int_products) {
if(!$order->sendExtBillinfoEmail()) {
$this->layout()->setFlash("Beim Senden der externen Billing Benachrichtigung ist ein Fehler aufgetreten.", "warning");
}
}
if($int_products) {
if(!$order->sendIntBillinfoEmail()) {
$this->layout()->setFlash("Beim Senden der Billing Benachrichtigung ist ein Fehler aufgetreten.", "warning");
}
}
if($int_products && $ext_products) {
$this->layout()->setFlash("Eigene und Fremdprodukte gefunden, nur interne Billing Benachrichtigung verschickt.", "warning");
}
}