diff --git a/Layout/default/Preorder/Index.php b/Layout/default/Preorder/Index.php index d4be4ae32..b1937a994 100644 --- a/Layout/default/Preorder/Index.php +++ b/Layout/default/Preorder/Index.php @@ -204,6 +204,16 @@ $pagination_entity_name = "Vorbestellungen"; +
+ + +
+
+
+ +
+
+
+ remarks))?> +
+ + + + + + + + + + + +
-

FTU

- - - - - - -
FTU Name:adb_wohneinheit->ftu_data["name"]?> -
FTU External ID:adb_wohneinheit->ftu_data["id"]?> -
- -

FCP

- fcp): ?> +
+

FTU

- - - - - - - - - - - - + + + + +
FCP Name:fcp->name?> -
FCP External ID:fcp->rimo_id?> -
FCP Execution State:fcp->rimo_ex_state?> -
FCP Operational State:fcp->rimo_op_state != "Undefined") ? $preorder->fcp->rimo_op_state : ""?> -
FCP Building Type:fcp->building_type?> -
FTU Name:adb_wohneinheit->ftu_data["name"]?> +
FTU External ID:adb_wohneinheit->ftu_data["id"]?> +
- -

Kein FCP zugewiesen

- -
- -
-
- -
-

Workorder

- adb_wohneinheit_id && is_array($preorder->adb_wohneinheit->rimo_workorders) && count($preorder->adb_wohneinheit->rimo_workorders)): ?> - adb_wohneinheit->rimo_workorders as $wo): ?> -

- rimo_name?> - $wo->id])?>" onclick="event.preventDefault(); downloadWorkorderAha(id?>);"> AHA Blatt -

- Workorder löschen - +

FCP

+ fcp): ?> +
- - + + - - + + + + + - - - - rimo_team_name): ?> - - - - - - - - - - - - + + + +
Namerimo_name?>FCP Name:fcp->name?>
External IDrimo_id?>FCP External ID:fcp->rimo_id?> +
FCP Execution State:fcp->rimo_ex_state?>
Statusrimo_status?>
Zugewiesen an:rimo_team_name?>
Erstelltcreate)?>
Bemerkung -
- -
- -
-
-
- remarks))?> -
-
FCP Operational State:fcp->rimo_op_state != "Undefined") ? $preorder->fcp->rimo_op_state : ""?> +
FCP Building Type:fcp->building_type?>
- + +

Kein FCP zugewiesen

+ - - - - -
+
- -
+ +

Patchposition adb_wohneinheit_id): ?> @@ -559,6 +561,7 @@

+
@@ -570,16 +573,47 @@
-

Bestellstatus

- - - - - - - - -
Status Codestatus->code?>
Status Textstatus->name?>
+ +
+
+

Bestellstatus

+ + + + + + + + +
Status Codestatus->code?>
Status Textstatus->name?>
+
+
+ +
+
+

Borderpoint Status

+
+
+ +
+
+ +
+
+ +
+
+
+

Statusflags

diff --git a/application/Api/v1/AddressdbApicontroller.php b/application/Api/v1/AddressdbApicontroller.php index 73dec6299..69739a7dc 100644 --- a/application/Api/v1/AddressdbApicontroller.php +++ b/application/Api/v1/AddressdbApicontroller.php @@ -939,7 +939,7 @@ class AddressdbApicontroller extends mfBaseApicontroller { $prices_return = [ "oaid" => $oaid, - "enduser_setup_price_net" => (float)$prices["enduser_setup"]->price_setup, + "enduser_setup_price_net" => round((float)$prices["enduser_setup"]->price_setup, 2), "enduser_setup_price_gross" => round((float)$prices["enduser_setup"]->price_setup * 1.2, 2), "enduser_setup_info" => $prices["enduser_setup"]->description, "enduser_setup_is_discount" => ($prices["enduser_setup"]->end_date) ? true : false, diff --git a/application/Building/Building.php b/application/Building/Building.php index c4cadb2f3..048f8aedb 100644 --- a/application/Building/Building.php +++ b/application/Building/Building.php @@ -42,15 +42,6 @@ class Building extends mfBaseModel { return $data; } - protected function afterSave() { - if($this->in_after_save) return true; - $this->in_after_save++; - - $this->resetProperties(); - - $this->in_after_save--; - } - public function resetProperties() { $this->network = null; $this->pop = null; diff --git a/application/Preorder/PreorderController.php b/application/Preorder/PreorderController.php index bc4741032..89b206192 100644 --- a/application/Preorder/PreorderController.php +++ b/application/Preorder/PreorderController.php @@ -305,6 +305,8 @@ class PreorderController extends mfBaseController { } } + //var_dump($new_filter);exit; + return $new_filter; } @@ -1066,6 +1068,9 @@ class PreorderController extends mfBaseController { case "addWorkorderRemark": $return = $this->addWorkorderRemarkApi(); break; + case "saveBorderpointStatus": + $return = $this->saveBorderpointStatusApi(); + break; case "saveOrderdate": $return = $this->saveOrderdateApi(); break; @@ -1083,9 +1088,38 @@ class PreorderController extends mfBaseController { $data = ["status" => "error"]; $this->returnJson($data); } - $data['status'] = "OK"; - $data['result'] = $return; - $this->returnJson($data); + + if(mfResponse::isResponse($return)) { + $this->returnJson($return); + } else { + $data['status'] = "OK"; + $data['result'] = $return; + $this->returnJson($data); + } + } + + protected function saveBorderpointStatusApi() { + $preorder_id = $this->request->preorder_id; + $status_type = $this->request->status_type; + $value = $this->request->value; + + $preorder = new Preorder($preorder_id); + if(!$preorder->id) { + return mfResponse::NotFound(["message" => "Preorder not found"]); + } + + if(!$value) { + $preorder->update(["borderpoint_status" => null]); + } else { + $preorder->update(["borderpoint_status" => $status_type]); + } + + $this->log->debug(__METHOD__.": $preorder_id - borderpoint status updated to $status_type"); + $preorder->save(); + + return mfResponse::Ok(); + + } protected function getFCPsForCampaignApi(): array { diff --git a/application/Preorder/PreorderModel.php b/application/Preorder/PreorderModel.php index ad57d5953..0f924df8f 100644 --- a/application/Preorder/PreorderModel.php +++ b/application/Preorder/PreorderModel.php @@ -35,6 +35,7 @@ class PreorderModel public $accept_marketing; public $accept_withdrawal; public $accept_digging; + public $borderpoint_status; public $contact_type; public $company; public $uid; @@ -566,8 +567,6 @@ class PreorderModel { $where = "1=1 "; - //var_dump($filter);exit; - if (array_key_exists("deleted", $filter)) { $deleted = $filter['deleted']; if ($deleted === null || $deleted === false) { @@ -685,6 +684,14 @@ class PreorderModel } + if (array_key_exists("borderpoint_status", $filter)) { + $borderpoint_status = FronkDB::singleton()->escape($filter['borderpoint_status']); + if ($borderpoint_status) { + $where .= " AND tt_preorder.borderpoint_status='$borderpoint_status'"; + } + } + + if (array_key_exists("preordercampaign_id", $filter)) { $preordercampaign_id = $filter['preordercampaign_id']; if (is_numeric($preordercampaign_id)) { diff --git a/db/migrations/20250507152034_preorder_add_borderpoint_status.php b/db/migrations/20250507152034_preorder_add_borderpoint_status.php new file mode 100644 index 000000000..dd751820e --- /dev/null +++ b/db/migrations/20250507152034_preorder_add_borderpoint_status.php @@ -0,0 +1,33 @@ +getEnvironment() == "thetool") { + $table = $this->table("Preorder"); + $table->addColumn("borderpoint_status", "enum", ["null" => true, "default" => null, "values" => ["need_measurement", "informed", "need_digging"], "after" => "accept_digging"]); + $table->update(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + $table = $this->table("Preorder"); + $table->removeColumn("borderpoint_status"); + $table->update(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } +} diff --git a/lib/mvcfronk/mfBase/mfBaseApicontroller.php b/lib/mvcfronk/mfBase/mfBaseApicontroller.php index e404a85ba..d264367dc 100644 --- a/lib/mvcfronk/mfBase/mfBaseApicontroller.php +++ b/lib/mvcfronk/mfBase/mfBaseApicontroller.php @@ -233,9 +233,9 @@ class mfBaseApicontroller { //var_dump(mb_detect_encoding($request_body), $charset); return $request_body; } - + // Request body is urlencoded or multipart-formdata - if(preg_match('#charset\s*=\s*["\']?([^ "\']+)["\']?\s*;?#i', $_SERVER["CONTENT_TYPE"], $m)) { + if(array_key_exists("CONTENT_TYPE", $_SERVER) && preg_match('#charset\s*=\s*["\']?([^ "\']+)["\']?\s*;?#i', $_SERVER["CONTENT_TYPE"], $m)) { $request_charset = strtolower($m[1]); } diff --git a/lib/mvcfronk/mfBase/mfBaseController.php b/lib/mvcfronk/mfBase/mfBaseController.php index a9ca40871..29a34f171 100644 --- a/lib/mvcfronk/mfBase/mfBaseController.php +++ b/lib/mvcfronk/mfBase/mfBaseController.php @@ -318,14 +318,30 @@ class mfBaseController return $url; } - public static function returnJson($data) + public static function returnJson($response) { - if (is_array($data)) { + if(mfResponse::isResponse($response)) { + $code = $response['code']; + $status = $response['status']; + $data = $response['data']; + + $proto = "HTTP/1.0"; + if($_SERVER["SERVER_PROTOCOL"]) { + $proto = $_SERVER["SERVER_PROTOCOL"]; + } + + header("$proto $code $status"); + header("Content-type: application/json"); + //http_response_code($code); + echo json_encode(["status" => $status, "result" => $data]); + exit; + } + if (is_array($response)) { header("Content-Type: application/json"); - echo json_encode($data); + echo json_encode($response); exit; } else { - throw new Exception("Data not an array"); + throw new Exception("Response data not an array"); } }