Fixed statusflags only set on Adddresses with Preorder and added snopp
connected api
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"]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user