diff --git a/Layout/default/Preorder/include/preorder-detail.php b/Layout/default/Preorder/include/preorder-detail.php
index 876afe49f..f0254f5a7 100644
--- a/Layout/default/Preorder/include/preorder-detail.php
+++ b/Layout/default/Preorder/include/preorder-detail.php
@@ -78,27 +78,49 @@
-
Zustimmungen
-
-
- | Zustimmung AGB: |
- =($preorder->accept_agb) ? '' : ''?> |
-
- | Zustimmung DSGVO: |
- =($preorder->accept_dsgvo) ? '' : ''?> |
-
- | Zustimmung Rücktrittsrecht: |
- =($preorder->accept_withdrawal) ? '' : ''?> |
-
- | Zustimmung Datenweitergabe: |
- =($preorder->accept_marketing) ? '' : ''?> |
-
- | Zustimmung Grabungsarbeiten: |
- =($preorder->accept_digging) ? '' : ''?> |
-
-
-
+
+
+
+
Zustimmungen
+
+
+ | Zustimmung AGB: |
+ =($preorder->accept_agb) ? '' : ''?> |
+
+ | Zustimmung DSGVO: |
+ =($preorder->accept_dsgvo) ? '' : ''?> |
+
+ | Zustimmung Rücktrittsrecht: |
+ =($preorder->accept_withdrawal) ? '' : ''?> |
+
+ | Zustimmung Datenweitergabe: |
+ =($preorder->accept_marketing) ? '' : ''?> |
+
+ | Zustimmung Grabungsarbeiten: |
+ =($preorder->accept_digging) ? '' : ''?> |
+
+
+
+
+
+
+
+
Starterpaket
+
+
+ | CIF Token: |
+ =$preorder->ciftoken?> |
+
+ | CIF Kabelnachbestell-Url: |
+ =$preorder->cifcableurl?> |
+
+ | Starterpaket versandt: |
+ =($preorder->logistics && $preorder->logistics->sent) ? ' '.date("d.m.Y H:i", $preorder->logistics->sent) : ''?> |
+
+
+
+
diff --git a/application/ADBWohneinheit/ADBWohneinheit.php b/application/ADBWohneinheit/ADBWohneinheit.php
index bc2dcb6b6..d8d9befba 100644
--- a/application/ADBWohneinheit/ADBWohneinheit.php
+++ b/application/ADBWohneinheit/ADBWohneinheit.php
@@ -161,14 +161,17 @@ class ADBWohneinheit extends mfBaseModel {
public function getPatchEqString() {
$patch = "";
- if($this->patch_cluster) {
- $patch = $this->patch_cluster;
- } else {
- $patch = $this->getProperty("hausnummer")->netzgebiet->extref;
- }
- if($this->patch_shelf) $patch .= "-".$this->patch_shelf;
- if($this->patch_module) $patch .= "-".$this->patch_module;
+ if($this->patch_shelf) $patch .= $this->patch_shelf."-";
+ if($this->patch_module) $patch .= $this->patch_module;
+
+ if($patch) {
+ if($this->patch_cluster) {
+ $patch = $this->patch_cluster."-".$patch;
+ } else {
+ $patch = $this->getProperty("hausnummer")->netzgebiet->extref."-".$patch;
+ }
+ }
return $patch;
}
diff --git a/application/Api/v1/Modules/Preorder/Activation.php b/application/Api/v1/Modules/Preorder/Activation.php
new file mode 100644
index 000000000..e1a06e294
--- /dev/null
+++ b/application/Api/v1/Modules/Preorder/Activation.php
@@ -0,0 +1,61 @@
+ "Preorder not found"]);
+ }
+
+ $preorder = \PreorderModel::getFirst(['ucode' => strtoupper($code), 'partner_id' => $this->me->address_id]);
+ if(!$preorder) {
+ // try oaid
+ $preorder = \PreorderModel::getFirst(['oaid' => strtolower($code), 'partner_id' => $this->me->address_id], "`create` DESC");
+ }
+ if(!$preorder) {
+ // try as extref
+ $preorder = \PreorderModel::getFirst(['extref' => $code, 'partner_id' => $this->me->address_id]);
+ }
+
+ if(!$preorder) {
+ return \mfResponse::NotFound(["message" => "Preorder not found"]);
+ }
+
+ if($preorder->partner_id != $this->me->address_id) {
+ return \mfResponse::NotFound(["message" => "Preorder not found"]);
+ }
+
+ // set status to 200
+ if($preorder->status->code < 200) {
+ $new_status = \PreorderstatusModel::getFirst(["code" => 200]);
+ if(!$new_status) {
+ return \mfResponse::InternalServerError();
+ }
+ $preorder->status_id = $new_status->id;
+ $preorder->save();
+ }
+
+ return \mfResponse::Ok(["message" => "Status successfully updated."]);
+
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/application/Api/v1/Modules/Preorder/Cif.php b/application/Api/v1/Modules/Preorder/Cif.php
index 858d8e27a..e0e4ace06 100644
--- a/application/Api/v1/Modules/Preorder/Cif.php
+++ b/application/Api/v1/Modules/Preorder/Cif.php
@@ -37,12 +37,10 @@ class Cif extends Modules\ApiControllerModule {
return \mfResponse::NotFound(["message" => "Preorder not found"]);
}
-
if($preorder->partner_id != $this->me->address_id) {
return \mfResponse::NotFound(["message" => "Preorder not found"]);
}
-
// set status to 200
if($preorder->status->code < 200) {
$new_status = \PreorderstatusModel::getFirst(["code" => 200]);
@@ -66,10 +64,22 @@ class Cif extends Modules\ApiControllerModule {
return \mfResponse::BadRequest(["message" => "ciftoken missing"]);
}
- $preorder = \PreorderModel::getFirst(["ciftoken" => $this->get["ciftoken"], "partner_id" => $this->me->address_id]);
+ $preorder = \PreorderModel::getFirst(["ciftoken" => $this->get["ciftoken"]]);
if(!$preorder) {
return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
}
+ if(!$preorder->adb_hausnummer->netzgebiet_id) {
+ return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
+ }
+
+ $network = \NetworkModel::getFirst(["adb_netzgebiet_id" => $preorder->adb_hausnummer->netzgebiet->id]);
+ if(!$network) {
+ return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
+ }
+
+ if($network->owner_id != $this->me->address_id && $preorder->partner_id != $this->me->address_id) {
+ return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
+ }
$return = $preorder->getCifdataApiArray();
@@ -80,16 +90,26 @@ class Cif extends Modules\ApiControllerModule {
* POST /preorder/customerInstallationFeedback
*/
public function userSetCif() {
- return \mfResponse::InternalServerError();
+ //return \mfResponse::InternalServerError();
if(!array_key_exists("ciftoken", $this->post) || !$this->post['ciftoken']) {
return \mfResponse::BadRequest(["message" => "ciftoken missing"]);
}
- $preorder = \PreorderModel::getFirst(["ciftoken" => $this->get["ciftoken"], "partner_id" => $this->me->address_id]);
+ $preorder = \PreorderModel::getFirst(["ciftoken" => $this->get["ciftoken"]]);
if(!$preorder) {
return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
}
+ if(!$preorder->adb_hausnummer->netzgebiet_id) {
+ return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
+ }
+ $network = \NetworkModel::getFirst(["adb_netzgebiet_id" => $preorder->adb_hausnummer->netzgebiet->id]);
+ if(!$network) {
+ return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
+ }
+ if($network->owner_id != $this->me->address_id && $preorder->partner_id != $this->me->address_id) {
+ return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
+ }
// set status to 200
if($preorder->status->code < 200) {
diff --git a/application/Api/v1/PreorderApicontroller.php b/application/Api/v1/PreorderApicontroller.php
index e90563b03..12c505ac6 100644
--- a/application/Api/v1/PreorderApicontroller.php
+++ b/application/Api/v1/PreorderApicontroller.php
@@ -1,6 +1,7 @@
$this->get,
- "post" => $this->post,
- "db" => $this->db(),
- "me" => $this->me
- ]);
+ $modules = [];
+ $moduleNames = ["Cif", "Activation"];
+ foreach($moduleNames as $moduleName) {
+ $classname = "thetool\Api\Modules\Preorder\\".$moduleName;
+ $modules[$moduleName] = new $classname([
+ "get" => $this->get,
+ "post" => $this->post,
+ "db" => $this->db(),
+ "me" => $this->me
+ ]);
+ }
+
+
$this->addRoute("/preorder", "submitPreorder", "POST");
$this->addRoute("/preorder/open", "getOpenPreorders", "GET");
- $this->addRoute("/preorder/customerInstallationFeedback", [$moduleCif, "getCifData"], "GET");
- $this->addRoute("/preorder/customerInstallationFeedback", [$moduleCif, "userSetCif"], "POST");
+ $this->addRoute("/preorder/customerInstallationFeedback", [$modules["Cif"], "getCifData"], "GET");
+ $this->addRoute("/preorder/customerInstallationFeedback", [$modules["Cif"], "userSetCif"], "POST");
$this->addRoute("/preorder/:code", "getPreorder", "GET");
$this->addRoute("/preorder/:code", "cancelPreorder", "DELETE");
- $this->addRoute("/preorder/:code/clientInstallationFinished", [$moduleCif, "providerSetCif"], "GET");
- $this->addRoute("/preorder/:code/serviceActivated", "setServiceActive", "POST");
+ $this->addRoute("/preorder/:code/clientInstallationFinished", [$modules["Cif"], "providerSetCif"], "GET");
+ $this->addRoute("/preorder/:code/serviceActivated", [$modules["Activation"], "setServiceActive"], "POST");
}
/*
diff --git a/application/Order/OrderController.php b/application/Order/OrderController.php
index c20415167..b98869fc5 100644
--- a/application/Order/OrderController.php
+++ b/application/Order/OrderController.php
@@ -109,7 +109,7 @@ class OrderController extends mfBaseController {
$my_networks[] = new Network($filter['network_id']);
}
} else {
- $my_networks = $this->me->myNetworks("salespartner");
+ $my_networks = $this->me->myNetworks(["salespartner", "netowner"]);
if(array_key_exists("network_id", $filter)) {
$use_filter_network = false;