Now showing all Workorders in Preorder detail
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
class ADBWohneinheit extends mfBaseModel {
|
||||
private $hausnummer;
|
||||
private $rimo_workorder;
|
||||
private $rimo_workorders;
|
||||
private $ftu_data;
|
||||
private $status;
|
||||
|
||||
@@ -244,7 +245,15 @@ class ADBWohneinheit extends mfBaseModel {
|
||||
}
|
||||
return $this->rimo_workorder;
|
||||
}
|
||||
|
||||
|
||||
if($name == "rimo_workorders") {
|
||||
$this->rimo_workorders = RimoWorkorderModel::search(["adb_wohneinheit_id" => $this->id]);
|
||||
/*if(count($workorders)) {
|
||||
$this->rimo_workorders = $workorders;
|
||||
}*/
|
||||
return $this->rimo_workorders;
|
||||
}
|
||||
|
||||
if($name == "ftu_data") {
|
||||
$rimo_data = $this->getExternalRimoData();
|
||||
|
||||
|
||||
@@ -1264,8 +1264,9 @@ class PreorderController extends mfBaseController {
|
||||
if(!$this->me->is("Admin")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$preorder_id = $this->request->id;
|
||||
$wo_id = $this->request->wid;
|
||||
|
||||
if(!is_numeric($preorder_id) || $preorder_id < 1) {
|
||||
return false;
|
||||
@@ -1279,14 +1280,22 @@ class PreorderController extends mfBaseController {
|
||||
if(!$preorder->adb_wohneinheit_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$workorder = RimoWorkorderModel::getFirst(["adb_wohneinheit_id" => $preorder->adb_wohneinheit_id]);
|
||||
if(!$workorder) {
|
||||
|
||||
if(!is_numeric($wo_id) || $wo_id < 1) {
|
||||
return false;
|
||||
}
|
||||
$workorder = new RimoWorkorder($wo_id);
|
||||
if(!$workorder->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if($preorder->adb_wohneinheit_id != $workorder->adb_wohneinheit_id) {
|
||||
$this->log->warning(__METHOD__.": wohneinheit_id not equal");
|
||||
return false;
|
||||
}
|
||||
|
||||
$workorder->delete();
|
||||
return ["message" => "Workorder deleted successfully", "id" => $preorder->id];
|
||||
return ["message" => "Workorder deleted successfully", "id" => $preorder->id, "wid" => $wo_id];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user