sending int nbe billing info only if nbe is greater than 0

This commit is contained in:
Frank Schubert
2023-02-28 17:18:04 +01:00
parent f869e14351
commit acf8ff7bc7

View File

@@ -825,6 +825,8 @@ class OrderController extends mfBaseController {
$ext_products = false;
$int_products = false;
$ext_products_nbe = 0;
//var_dump($r->products);exit;
// validate and add products
if(is_array($r->products) && count($r->products)) {
@@ -863,7 +865,7 @@ class OrderController extends mfBaseController {
} else {
$product_data["price_nne"] = $prod->price_nne;
}
if($this->me->is("Admin") && $p["price_nbe"]) {
if($this->me->is("Admin") && strlen($p["price_nbe"])) {
$product_data["price_nbe"] = Layout::commaToDot($p["price_nbe"]);
} else {
$product_data["price_nbe"] = $prod->price_nbe;
@@ -908,6 +910,7 @@ class OrderController extends mfBaseController {
if($prod->external) {
$ext_products = true;
$ext_product_owner_id = $prod->external_id;
$ext_products_nbe += $product_data["price_nbe"];
} else {
$int_products = true;
@@ -1020,8 +1023,12 @@ class OrderController extends mfBaseController {
if(!$order->sendExtBillinfoEmail(new Address($ext_product_owner_id))) {
$this->layout()->setFlash("Beim Senden der externen Billing Benachrichtigung ist ein Fehler aufgetreten.", "warning");
}
if(!$order->sendExtBillNbeInfoEmail(new Address($ext_product_owner_id))) {
$this->layout()->setFlash("Beim Senden der internen Billing NBE Benachrichtigung ist ein Fehler aufgetreten.", "warning");
if($ext_products_nbe) {
// only send nbe mail if there is nbe
if(!$order->sendExtBillNbeInfoEmail(new Address($ext_product_owner_id))) {
//$this->layout()->setFlash("Beim Senden der internen Billing NBE Benachrichtigung ist ein Fehler aufgetreten.", "warning");
}
}
}
@@ -1032,7 +1039,7 @@ class OrderController extends mfBaseController {
}
if($int_products && $ext_products) {
$this->layout()->setFlash("Eigene und Fremdprodukte gefunden, nur interne Billing Benachrichtigung verschickt.", "warning");
//$this->layout()->setFlash("Eigene und Fremdprodukte gefunden, nur interne Billing Benachrichtigung verschickt.", "warning");
}
}