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"]);
|
return \mfResponse::Ok(["message" => "OK"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPreorderActive($id) {
|
public function setPreorderActive($req_id) {
|
||||||
if(!$id || !is_numeric($id)) {
|
if(!$req_id) {
|
||||||
return \mfResponse::BadRequest(["message" => "id missing"]);
|
return \mfResponse::BadRequest(["message" => "id missing"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$wohneinheit = new \ADBWohneinheit($id);
|
$wohneinheit = false;
|
||||||
if(!$wohneinheit->id) {
|
if(is_numeric($req_id)) {
|
||||||
return \mfResponse::NotFound(["message" => "Home not found"]);
|
$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) {
|
if(!$preorder) {
|
||||||
return \mfResponse::NotFound(["message" => "Home not found"]);
|
return \mfResponse::NotFound(["message" => "Home not found"]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user