Preorder patchposition can be edited now

This commit is contained in:
Frank Schubert
2023-12-15 18:33:29 +01:00
parent be6907fc55
commit dd07bbede6
8 changed files with 219 additions and 36 deletions
@@ -159,6 +159,20 @@ class ADBWohneinheit extends mfBaseModel {
return false;
}
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;
return $patch;
}
public function getProperty($name) {
if($this->$name == null) {
@@ -11,6 +11,10 @@ class ADBWohneinheitModel {
public $zusatz;
public $bezeichner;
public $nutzung;
public $patch_cluster;
public $patch_shelf;
public $patch_module;
public $patch_port;
public $create_by = null;
public $edit_by = null;
+3 -1
View File
@@ -693,8 +693,10 @@ class PreorderApicontroller extends mfBaseApicontroller {
}
$preorder_data['extref'] = (trim($this->post['extref'])) ? trim($this->post['extref']) : null;
$preorder_data['technology'] = (trim($this->post['technology'])) ? trim($this->post['technology']) : null;
/*
* patchposition now comes from RIMO
$preorder_data['equipment_name'] = (trim($this->post['equipment_name'])) ? trim($this->post['equipment_name']) : null;
$preorder_data['equipment_port'] = (trim($this->post['equipment_port'])) ? trim($this->post['equipment_port']) : null;
$preorder_data['equipment_port'] = (trim($this->post['equipment_port'])) ? trim($this->post['equipment_port']) : null;*/
/*
* setup price
+2 -2
View File
@@ -433,8 +433,8 @@ class Preorder extends mfBaseModel {
$a['connectionCount'] = ($this->connection_count) ? (int)$this->connection_count : 1;
$a['isAdditionalOrder'] = ($this->is_additional_order) ? true : false;
$a['technology'] = ($this->technology) ? $this->technology : null;
$a['equipment_name'] = ($this->equipment_name) ? $this->equipment_name: null;
$a['equipment_port'] = ($this->equipment_port) ? $this->equipment_port: null;
$a['equipment_name'] = ($wohneinheit->getPatchEqString()) ? $wohneinheit->getPatchEqString(): null;
$a['equipment_port'] = ($wohneinheit->patch_port) ? $wohneinheit->patch_port: null;
$a['preorderType'] = $this->type;
$a['acceptMarketing'] = ($this->accept_marketing) ? true : false;
$a['acceptAgb'] = ($this->accept_agb) ? true : false;
+38 -31
View File
@@ -802,6 +802,9 @@ class PreorderController extends mfBaseController {
case "deleteWorkorder":
$return = $this->deleteWorkorderApi();
break;
case "savePatchposition":
$return = $this->savePatchpositionApi();
break;
default:
$return = false;
}
@@ -987,39 +990,43 @@ class PreorderController extends mfBaseController {
$update[] = $up;
}
/* $update = [
"preorder" => [
"status" => [
"id" => $status->id,
"code" => $status->code,
"text" => $status->name
]
]
];
if($preorder->adb_hausnummer_id) {
$update["building"] = [
"status" => [
"id" => $preorder->adb_hausnummer->status->id,
"code" => $preorder->adb_hausnummer->status->code,
"text" => $preorder->adb_hausnummer->status->name
]
];
}
if($preorder->adb_wohneinheit_id) {
$update["unit"] = [
"status" => [
"id" => $preorder->adb_wohneinheit->status->id,
"code" => $preorder->adb_wohneinheit->status->code,
"text" => $preorder->adb_wohneinheit->status->name
]
];
}
*/
return ["message" => "Status saved successfully", "id" => $preorder_id, "updates" => $update];
}
private function savePatchpositionApi() {
$preorder_id = $this->request->id;
$cluster = $this->request->cluster;
$shelf = $this->request->shelf;
$module = $this->request->module;
$port = $this->request->port;
if(!is_numeric($preorder_id) || $preorder_id < 1) {
return false;
}
$preorder = new Preorder($preorder_id);
if(!$preorder->id) {
return false;
}
if(!$preorder->adb_wohneinheit_id) {
return false;
}
$we = $preorder->adb_wohneinheit;
if($cluster && $cluster != $we->cluster) {
$we->patch_cluster = $cluster;
}
$we->patch_shelf = $shelf;
$we->patch_module = $module;
$we->patch_port = $port;
$we->save();
return ["message" => "Patchposition saved successfully", "id" => $preorder->id];
}
private function deleteWorkorderApi() {
if(!$this->me->is("Admin")) {
return false;
@@ -1046,7 +1053,7 @@ class PreorderController extends mfBaseController {
}
$workorder->delete();
return ["Message" => "Workorder deleted successfully", "id" => $preorder->id];
return ["message" => "Workorder deleted successfully", "id" => $preorder->id];
}
}
-2
View File
@@ -51,8 +51,6 @@ class PreorderModel {
public $phone;
public $email;
public $technology;
public $equipment_name;
public $equipment_port;
public $is_additional_order;
public $shipping_address;
public $addon_services;