Fixed statusflags only set on Adddresses with Preorder
This commit is contained in:
@@ -43,4 +43,32 @@ class Snopp extends Modules\ApiControllerModule
|
||||
|
||||
return \mfResponse::Ok(["message" => "OK"]);
|
||||
}
|
||||
|
||||
public function setPreorderActive($id) {
|
||||
if(!$id || !is_numeric($id)) {
|
||||
return \mfResponse::BadRequest(["message" => "id missing"]);
|
||||
}
|
||||
|
||||
$wohneinheit = new \ADBWohneinheit($id);
|
||||
if(!$wohneinheit->id) {
|
||||
return \mfResponse::NotFound(["message" => "Home not found"]);
|
||||
}
|
||||
|
||||
$preorder = \PreorderModel::getFirstActive(["adb_wohneinheit_id" => $id]);
|
||||
if(!$preorder) {
|
||||
return \mfResponse::NotFound(["message" => "Home not found"]);
|
||||
}
|
||||
|
||||
$new_status = \PreorderstatusModel::getFirst(["code" => 500]);
|
||||
if(!$new_status) {
|
||||
return \mfResponse::InternalServerError();
|
||||
}
|
||||
|
||||
if($preorder->status->code < $new_status->code) {
|
||||
$preorder->status_id = $new_status->id;
|
||||
$preorder->save();
|
||||
}
|
||||
|
||||
return \mfResponse::Ok(["message" => "OK"]);
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@ class OperationaldataApicontroller extends mfBaseApicontroller
|
||||
$this->addRoute("/operationaldata/buildings", "getBuildingsByCampaign", "GET");
|
||||
|
||||
$this->addRoute("/operationaldata/home/:id/connected", [$modules["Snopp"], "setPreorderConnected"], "POST");
|
||||
$this->addRoute("/operationaldata/home/:id/active", [$modules["Snopp"], "setPreorderActive"], "POST");
|
||||
|
||||
/*$this->addRoute("/preorder/open", "getOpenPreorders", "GET");
|
||||
$this->addRoute("/preorder/customerInstallationFeedback", [$modules["Cif"], "getCifData"], "GET");
|
||||
|
||||
Reference in New Issue
Block a user