Changed OrderFiles; name is now dropdown of predefined types; Certain
types send emails
This commit is contained in:
@@ -24,8 +24,43 @@ class OrderController extends mfBaseController {
|
||||
$this->layout()->set("highlight", $this->request->id);
|
||||
$this->layout()->set("mynetworks", NetworkModel::getAll());
|
||||
|
||||
if(!is_array($order->terminations) || !count($order->terminations)) {
|
||||
$special_orders = [];
|
||||
$voice_orders = [];
|
||||
|
||||
$has_bras = false;
|
||||
$has_voice = false;
|
||||
|
||||
if(!is_array($order->products) || !count($order->products)) {
|
||||
$this->layout()->set("lonelyOrders", [$order]);
|
||||
$this->layout()->set("showLonelies", true);
|
||||
} else {
|
||||
foreach($order->products as $lop) {
|
||||
//var_dump($lop);exit;
|
||||
if(array_key_exists("bras_type", $lop->product->attributes) && $lop->product->attributes['bras_type']) {
|
||||
$has_bras = true;
|
||||
}
|
||||
if(array_key_exists("voip_chan", $lop->product->attributes) && $lop->product->attributes['voip_chan']) {
|
||||
$has_voice = true;
|
||||
}
|
||||
}
|
||||
if(!$has_bras && !$has_voice) {
|
||||
$this->layout()->set("special_orders", [$order]);
|
||||
$this->layout()->set("showSpecial", true);
|
||||
} elseif($has_voice && !$has_bras) {
|
||||
$this->layout()->set("voice_orders", [$order]);
|
||||
$this->layout()->set("showVoice", true);
|
||||
} else {
|
||||
$this->layout()->set("lonelyOrders", [$order]);
|
||||
$this->layout()->set("showLonelies", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($this->request->addJournal) {
|
||||
$this->layout()->set("addJournal", true);
|
||||
} else {
|
||||
$this->layout()->set("showDetail", true);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -761,7 +796,7 @@ class OrderController extends mfBaseController {
|
||||
if(!$orderproduct_id) {
|
||||
$product = OrderProductModel::create($product_data);
|
||||
} else {
|
||||
$product = new OrderProduct();
|
||||
$product = new OrderProduct($orderproduct_id);
|
||||
$product->update($product_data);
|
||||
}
|
||||
|
||||
@@ -793,7 +828,6 @@ class OrderController extends mfBaseController {
|
||||
|
||||
// generate and send Service PIN
|
||||
// only if owner_id wasn't changed
|
||||
$this->log->debug("test");
|
||||
if(!$owner->spin && (!property_exists($order->_old_data, "owner_id") || $order->owner_id == $order->_old_data->owner_id)) {
|
||||
$this->log->debug(__CLASS__."::save(): creating new SPIN for ".$owner->getCompanyOrName()." (".$owner->id.")");
|
||||
$spin = $owner->generateServicePin();
|
||||
@@ -899,7 +933,11 @@ class OrderController extends mfBaseController {
|
||||
$file->delete();
|
||||
unlink($upload->getSavepath()."/".$upload->getFilename());
|
||||
$this->layout()->setFlash("Dateiupload fehlgeschlagen", "warn");
|
||||
} else {
|
||||
// send email based on file type
|
||||
$order->sendFileuploadEmail($orderfile);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user