diff --git a/Layout/default/Address/Form.php b/Layout/default/Address/Form.php index 550f0bd51..e3d90dec8 100644 --- a/Layout/default/Address/Form.php +++ b/Layout/default/Address/Form.php @@ -1,3 +1,4 @@ +parent->types);exit;?> @@ -170,6 +171,7 @@ + diff --git a/Layout/default/Contract/Form.php b/Layout/default/Contract/Form.php index d3703e3b4..201cea374 100644 --- a/Layout/default/Contract/Form.php +++ b/Layout/default/Contract/Form.php @@ -389,11 +389,11 @@
\
\ \
\ + + +
diff --git a/Layout/default/Order/Index.php b/Layout/default/Order/Index.php index 6f3b68049..a0c3bcf36 100644 --- a/Layout/default/Order/Index.php +++ b/Layout/default/Order/Index.php @@ -1090,6 +1090,8 @@ $('#new-journal-').toggle(); $('#new-journal- textarea[name=text]').focus(); + + $('.order-tab a[href="#order-detail--details"]').tab('show'); diff --git a/Layout/default/Pipework/export_progress.xls.php b/Layout/default/Pipework/export_progress.xls.php index af6ce3923..6809c011a 100644 --- a/Layout/default/Pipework/export_progress.xls.php +++ b/Layout/default/Pipework/export_progress.xls.php @@ -219,179 +219,6 @@ foreach($networks as $networkname => $buildings) { } $i++; - -// -// /* -// * Linework data -// */ -// $sheet->setCellValue($col[$i].$line, ($term->getWorkflowvalue('pop_id')) ? (new Pop($term->getWorkflowvalue('pop_id')))->name : ""); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT); -// $i++; -// $sheet->setCellValue($col[$i].$line, ($term->getWorkflowvalue('ist_pop_id')) ? (new Pop($term->getWorkflowvalue('ist_pop_id')))->name : ""); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('schrank'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_schrank'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('baugruppe'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_baugruppe'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('modul'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_modul'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ports'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_ports'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('abschlusstyp'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_abschlusstyp'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bb_kabel'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_bb_kabel'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bb_kabel_steps'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_bb_kabel_steps'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bb_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_bb_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('kundenkabel_typ'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_kundenkabel_typ'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('kundenkabel_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_kundenkabel_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('backbone_finished'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('backbone_setup_date'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('customer_setup_date'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bep_deployed'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('customer_cable_injected'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('spliced_network'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('spliced_customer'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ont_deployed'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ont_sn'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// -// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('customer_passive_finished'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10); -// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); -// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); -// $i++; -// $sheet->setCellValue($col[$i].$line, $building->workflow_comment); $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen); diff --git a/application/Address/Address.php b/application/Address/Address.php index 976c65a2d..806fa6983 100644 --- a/application/Address/Address.php +++ b/application/Address/Address.php @@ -3,6 +3,7 @@ class Address extends mfBaseModel { protected $forcestr = ['street','company','zip','phone','fax','mobile','note']; private $parent; + private $childaddresses; private $types; private $attributes; private $permissions; @@ -90,20 +91,29 @@ class Address extends mfBaseModel { return false; } - if(!$this->parent_id) { - $this->types = AddresstypeModel::search(['address_id' => $this->id], true); - } else { - // get types from parent - - $parent = $this->getProperty("parent"); - $types = $parent->getProperty("types"); - $this->types = $types; - } + $all_types = AddresstypeModel::search(['address_id' => $this->id], true); + if($this->parent_id) { + // get types from parent + $parent_types = $this->getProperty("parent")->getProperty("types"); + if($parent_types) { + $all_types = array_merge($all_types, $parent_types); + } + } + $this->types = $all_types; return true; } + public function getChildrenByType($type) { + if(!$this->id || !$type) { + return []; + } + + $children = AddressModel::search(['addresstype' => [$type], "parent_id" => $this->id]); + return $children; + } + public function generateServicePin() { if(!$this->customer_number) { return false; @@ -152,6 +162,11 @@ class Address extends mfBaseModel { return $this->parent; } + if($name == "childaddresses") { + $this->childaddresses = AddressModel::search(['parent' => $this->id]); + return $this->childaddresses; + } + $classname = ucfirst($name); $idfield = $name."_id"; $this->$name = new $classname($this->$idfield); diff --git a/application/Emailnotification/Emailnotification.php b/application/Emailnotification/Emailnotification.php index b50ee91dc..e3d12cb25 100644 --- a/application/Emailnotification/Emailnotification.php +++ b/application/Emailnotification/Emailnotification.php @@ -59,7 +59,6 @@ class Emailnotification { public function setTo($email) { $this->email_to = $email; - $this->to_name = $name; } public function send() { diff --git a/application/Order/Order.php b/application/Order/Order.php index 1cbd3770e..a9f170c70 100644 --- a/application/Order/Order.php +++ b/application/Order/Order.php @@ -163,6 +163,65 @@ class Order extends mfBaseModel { } } + public function sendFileuploadEmail(OrderFile $file) { + $filetype = $file->name; + + $this->log->debug("in sendFileuploadEmail(); filetype: $filetype"); + + if(!defined("TT_ORDER_FILE_TYPES") || ! is_array(TT_ORDER_FILE_TYPES )) { + return false; + } + if(!array_key_exists($filetype, TT_ORDER_FILE_TYPES)) { + return false; + } + $tpl = new Layout(); + $tpl->setTemplate("Emailtemplates/order/fileupload/".$filetype); + if(!$tpl->templatePathExists()) { + $this->log->debug(__METHOD__.": tpl does not exist, not sending email."); + return true; + } + $tpl->set("order", $this); + $tpl->set("file", $file); + $body = $tpl->render(); + + $values = $tpl->getReturnedValue(); + + $subject = $values['subject']; + $from = $values['from_email']; + $from_name = $values['from_email_name']; + $to = $values['to']; + + if(!$subject || !$from || !$from_name || !$to) { + $this->log->warn("Order Fileupload Email not sent. (subject: '$subject', from: '$from', from_email: '$from_email', to: '$to')"); + } else { + $filepath = MFUPLOAD_FILE_SAVE_PATH; + if($file->file->subfolder) { + $filepath .= "/".$file->file->subfolder; + } + $filepath .= "/".$file->file->store_filename; + + $finfo = new finfo(FILEINFO_MIME_TYPE); + $mimetype = $finfo->file($filepath); + if(!$mimetype) { + $this->log->warning("File (orderfile->id: ".$file->id.") not a valid mimetype: $mimetype"); + } + + $email = new Emailnotification(); + $email->setSubject($subject); + $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->addAttachment($filepath, null, $file->file->filename, $mimetype); + $email->send(); + $this->log->info(__CLASS__."::save(): Sending Order Fileupload Email to '$to'"); + return true; + } + + return false; + } + public function getProperty($name) { if($this->$name == null) { @@ -194,6 +253,7 @@ class Order extends mfBaseModel { if($name == "products") { $this->products = OrderProductModel::search(["order_id" => $this->id]); + //var_dump($this->products);exit; return $this->products; } diff --git a/application/Order/OrderController.php b/application/Order/OrderController.php index 0b25eaee9..878adc315 100644 --- a/application/Order/OrderController.php +++ b/application/Order/OrderController.php @@ -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); } + } } diff --git a/application/OrderProduct/OrderProductModel.php b/application/OrderProduct/OrderProductModel.php index af57296d2..f5dc895df 100644 --- a/application/OrderProduct/OrderProductModel.php +++ b/application/OrderProduct/OrderProductModel.php @@ -100,12 +100,16 @@ class OrderProductModel { $db = FronkDB::singleton(); $where = self::getSqlFilter($filter); - $res = $db->select("OrderProduct", "*", "$where ORDER BY order_id, pos, product_id, description"); + $sql = "SELECT * FROM OrderProduct WHERE $where ORDER BY order_id, pos, product_id, description"; + //mfLoghandler::singleton()->debug($sql); + + $res = $db->query($sql); if($db->num_rows($res)) { while($data = $db->fetch_object($res)) { $items[] = new OrderProduct($data); } } + return $items; } diff --git a/lang/de.php b/lang/de.php index 2e8830cab..a4351b10c 100644 --- a/lang/de.php +++ b/lang/de.php @@ -18,6 +18,7 @@ $l['customers'] = "Kunden"; $l['supplier'] = "Lieferant"; $l['suppliers'] = "Lieferanten"; $l['contact'] = "Kontakt"; +$l['techcontact'] = "Technischer Kontakt"; $l['billing'] = "Rechnungsadresse"; $l['business'] = "Business"; $l['residential'] = "Residential"; diff --git a/lib/mvcfronk/mfLayout/mfLayout.php b/lib/mvcfronk/mfLayout/mfLayout.php index 1b9556f8a..39fb39b53 100644 --- a/lib/mvcfronk/mfLayout/mfLayout.php +++ b/lib/mvcfronk/mfLayout/mfLayout.php @@ -53,10 +53,18 @@ class mfLayout { return $this->returnValue; } + private function getTplPath() { + return VIEWDIR . "/" . $this->package . "/" . $this->template . ".php"; + } + + public function templatePathExists() { + return file_exists($this->getTplPath()); + } + public function render() { $this->defaultLayoutvariables(); - $tpl_path = VIEWDIR . "/" . $this->package . "/" . $this->template . ".php"; + $tpl_path = $this->getTplPath(); if(!is_file($tpl_path)) { $tpl_path = VIEWDIR . "/default/" . $this->template . ".php"; }