snopp can also update active state for estmk networks now
This commit is contained in:
@@ -56,17 +56,25 @@ class Snopp extends Modules\ApiControllerModule
|
||||
return \mfResponse::Ok(["message" => "OK"]);
|
||||
}
|
||||
|
||||
public function setPreorderActive($id) {
|
||||
if(!$id || !is_numeric($id)) {
|
||||
public function setPreorderActive($req_id) {
|
||||
if(!$req_id) {
|
||||
return \mfResponse::BadRequest(["message" => "id missing"]);
|
||||
}
|
||||
|
||||
$wohneinheit = new \ADBWohneinheit($id);
|
||||
if(!$wohneinheit->id) {
|
||||
return \mfResponse::NotFound(["message" => "Home not found"]);
|
||||
$wohneinheit = false;
|
||||
if(is_numeric($req_id)) {
|
||||
$id = $req_id;
|
||||
$wohneinheit = new \ADBWohneinheit($id);
|
||||
}
|
||||
if(!$wohneinheit || !$wohneinheit->id) {
|
||||
$oaid = $req_id;
|
||||
$wohneinheit = \ADBWohneinheitModel::getFirst(["oaid" => $oaid]);
|
||||
if (!$wohneinheit) {
|
||||
return \mfResponse::NotFound(["message" => "Home not found"]);
|
||||
}
|
||||
}
|
||||
|
||||
$preorder = \PreorderModel::getFirstActive(["adb_wohneinheit_id" => $id]);
|
||||
$preorder = \PreorderModel::getFirstActive(["adb_wohneinheit_id" => $wohneinheit->id]);
|
||||
if(!$preorder) {
|
||||
return \mfResponse::NotFound(["message" => "Home not found"]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user