diff --git a/Layout/default/Contract/Index.php b/Layout/default/Contract/Index.php
index eff3e0e99..4365f42ad 100644
--- a/Layout/default/Contract/Index.php
+++ b/Layout/default/Contract/Index.php
@@ -51,7 +51,7 @@
| $contract->owner_id])?>" target="_blank">=$contract->owner->getCompanyOrName()?> |
- =$contract->product->name?> |
+ =$contract->product->product->name?> |
termination_id): ?>
=$contract->termination->building->street?>
diff --git a/Layout/default/Contractconfig/Index.php b/Layout/default/Contractconfig/Index.php
index b8de1b705..7847ae08e 100644
--- a/Layout/default/Contractconfig/Index.php
+++ b/Layout/default/Contractconfig/Index.php
@@ -32,7 +32,11 @@
|
@@ -255,7 +261,7 @@
-
+
- Journal
- Kontakt
- Details
@@ -535,7 +541,7 @@
- Keine anschlusslosen Bestellungen zu den Suchkriterien gefunden
+ Keine anschlusslosen Bestellungen zu den Suchkriterien gefunden
@@ -544,11 +550,10 @@
-
+
-
|
@@ -647,7 +652,7 @@
$order->id])?>">
$order->id])?>" onclick="if(!confirm('Soll der Service-PIN an den Vertragsinhaber gesendet werden?')) return false;">
- $order->id])?>">
+ $order->id, "filter" => $filter, "s" => $pagination['start']])?>">
$order->id])?>" onclick="if(!confirm('Bestellung wirklich löschen?')) return false;" class="text-danger" title="Löschen">
@@ -677,7 +682,7 @@
-
+
- Journal
- Kontakt
- Details
@@ -967,6 +972,9 @@
+
+ Keine Bestellungen mit Anschluss zu den Suchkriterien gefunden
+
@@ -996,7 +1004,13 @@
toggleOrder(order);
//$('body').scrollTop($('#order-' + order).offset() - 50);
scrollToDiv('#order-' + order);
+
+ if(hash.match(/order=(\d+)-details/)) {
+ $('.order-tab a[href="#order-detail-' + order + '-details"]').tab('show');
+ }
+
}
+
});
diff --git a/application/Contract/Contract.php b/application/Contract/Contract.php
index 155ea8889..b084199a4 100644
--- a/application/Contract/Contract.php
+++ b/application/Contract/Contract.php
@@ -4,6 +4,7 @@ class Contract extends mfBaseModel {
private $owner;
private $creator;
private $product;
+ private $orderproduct;
private $termination;
private $sla;
private $editor;
@@ -39,16 +40,27 @@ class Contract extends mfBaseModel {
}
if($name == "product") {
- $this->product = mfValuecache::singleton()->get("mfObjectmodel-OrderProduct-".$this->orderproduct_id);
+ $this->product = mfValuecache::singleton()->get("mfObjectmodel-Product-".$this->product_id);
if($this->product === null) {
- $this->product = new OrderProduct($this->orderproduct_id);
+ $this->product = new Product($this->product_id);
if($this->product->id) {
- mfValuecache::singleton()->set("mfObjectmodel-OrderProduct-".$this->orderproduct_id, $this->product);
+ mfValuecache::singleton()->set("mfObjectmodel-Product-".$this->product_id, $this->product);
}
}
return $this->product;
}
+ if($name == "orderproduct") {
+ $this->orderproduct = mfValuecache::singleton()->get("mfObjectmodel-OrderProduct-".$this->orderorderproduct_id);
+ if($this->orderproduct === null) {
+ $this->orderproduct = new OrderProduct($this->orderorderproduct_id);
+ if($this->orderproduct->id) {
+ mfValuecache::singleton()->set("mfObjectmodel-OrderProduct-".$this->orderorderproduct_id, $this->orderproduct);
+ }
+ }
+ return $this->orderproduct;
+ }
+
if($name == "creator") {
$this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
if($this->creator === null) {
diff --git a/application/Order/OrderController.php b/application/Order/OrderController.php
index f93c0fd2c..85aeb1b8e 100644
--- a/application/Order/OrderController.php
+++ b/application/Order/OrderController.php
@@ -112,7 +112,7 @@ class OrderController extends mfBaseController {
}
}
- if(!$showLonelies) {
+ //if(!$showLonelies) {
//var_dump($order_search);exit;
$pagination['maxItems'] = OrderModel::count($order_search);
foreach(OrderModel::search($order_search, $pagination) as $order) {
@@ -120,9 +120,17 @@ class OrderController extends mfBaseController {
$orders[$order->id] = $order;
}
}
+ //}
+
+ $showLoneliesCount = false;
+ foreach(["owner", "owner_address", "partner_number", "finish_date"] as $key) {
+ if(array_key_exists($key, $filter) && $filter[$key]) {
+ $showLoneliesCount = true;
+ break;
+ }
}
-
- if($showLonelies) {
+
+ if($showLonelies || $showLoneliesCount) {
$userIds = $this->me->getAddressOrParent()->getUserIds();
//var_dump($userIds);exit;
if(!array_key_exists("network_linked_status", $order_search)) {
@@ -265,10 +273,13 @@ class OrderController extends mfBaseController {
}
protected function addAction() {
+ //var_dump($this->request->filter);exit;
+
+
// TODO: filter by network permissions
$this->layout()->setTemplate("Order/Form");
if($this->me->is("Admin")) {
- $this->layout()->set("addresses", AddressModel::search(['parents_only' => 1]));
+ //$this->layout()->set("addresses", AddressModel::search(['parents_only' => 1]));
$this->layout()->set("products", ProductModel::getAll());
$this->layout()->set("terminations", TerminationModel::getAll());
} else {
@@ -280,17 +291,18 @@ class OrderController extends mfBaseController {
$users = [];
foreach($this->me->my_networks as $network) {
$network_ids[] = $network->id;
- $tmp_users = $network->getAddressUsersByAddresstype("salespartner");
+ /*$tmp_users = $network->getAddressUsersByAddresstype("salespartner");
foreach($tmp_users as $user) {
if(!in_array($user->id, $users)) {
$users[] = $user->id;
}
- }
+ }*/
}
+ /*
// get addresses from salespartner address' user ids
$addresses = AddressModel::search(["create_by" => $users]);
$this->layout()->set("addresses", $addresses);
-
+ */
// get terminations in my networks
$terms = TerminationModel::search(["network_id" => $network_ids]);
$this->layout()->set("terminations", $terms);
@@ -305,6 +317,15 @@ class OrderController extends mfBaseController {
}
+ if($this->request->filter) {
+ $this->layout()->set("filter", $this->request->filter);
+ }
+ if($this->request->noTermProducts) {
+ $this->layout()->set("noTermProducts", $this->request->noTermProducts);
+ }
+ if($this->request->s) {
+ $this->layout()->set("s", $this->request->s);
+ }
}
@@ -366,18 +387,12 @@ class OrderController extends mfBaseController {
$this->layout()->setFlash("Bestellung nicht gefunden", "error");
$this->redirect("Order");
}
+
// refuse to save if there is a contract already
-
if($order->finish_date && is_array($order->contracts) && count($order->contracts)) {
$this->layout()->setFlash("Bestellung kann nicht mehr bearbeitet werden, da sie bereits abgeschlossen und in Verrechnung ist.", "error");
$this->redirect("Order", "edit", ['id' => $order->id]);
}
- /*foreach($order->products as $p) {
- if($p->contract && $p->contract->id) {
- $this->layout()->setFlash("Bestellung kann nicht mehr bearbeitet werden, da sie bereits abgeschlossen und in Verrechnung ist.", "error");
- $this->redirect("Order", "edit", ['id' => $order->id]);
- }
- }*/
} else {
$id = false;
$mode = "add";
@@ -385,12 +400,6 @@ class OrderController extends mfBaseController {
// validate owner
$owner = false;
- /*if(!$r->owner_id) {
- $this->layout()->setFlash("Bitte Vertragsinhaber auswählen oder eintragen.", "error");
- $this->layout()->set("order", $r);
- return $this->add();
- }*/
-
$owner_new = false;
if(is_numeric($r->owner_id) && $r->owner_id > 0) {
@@ -415,11 +424,7 @@ class OrderController extends mfBaseController {
return $this->add();
}
}
- }/* else {
- $this->layout()->setFlash("Ungültiger Vertragsinhaber.");
- $this->layout()->set("order", $r);
- return $this->add();
- }*/
+ }
// validate billindaddress
@@ -456,11 +461,7 @@ class OrderController extends mfBaseController {
return $this->add();
}
}
- } /*else {
- $this->layout()->setFlash("Ungültiger Rechnungsempfänger.");
- $this->layout()->set("order", $r);
- return $this->add();
- }*/
+ }
// validate sepa
if(!$r->billing_type) {
@@ -873,8 +874,23 @@ class OrderController extends mfBaseController {
}
}
+
+ $sq = "";
+ $query = [];
+ if($r->s) {
+ $query['s'] = $r->s;
+ }
+ if($r->noTermProducts) {
+ $query["noTermProducts"] = $r->noTermProducts;
+ }
+ if($r->filter) {
+ $query["filter"] = $r->filter;
+ }
+
+ $qs = http_build_query($query);
+
$this->layout()->setFlash("Bestellung erfolgreich gespeichert.", "success");
- $this->redirect("Order", "edit", ["id" => $new_id]);
+ $this->redirect("Order", "Index", $qs, "order=$new_id-details");
}
diff --git a/public/assets/css/thetool.css b/public/assets/css/thetool.css
index 3b9e6007b..98c331638 100644
--- a/public/assets/css/thetool.css
+++ b/public/assets/css/thetool.css
@@ -404,3 +404,16 @@ td.controls {
.pointer {
cursor: pointer;
}
+
+
+.counter {
+ vertical-align: super;
+ font-size: .75em;
+ color: #fff;
+ background-color: tomato;
+ padding-left: 4px;
+ padding-right: 4px;
+ padding-top: 1px;
+ padding-bottom: 1px;
+ border-radius: 4px;
+}