Merge branch 'fronkdev' into 'master'
snopp opsdata api connected/active status for estmk networks See merge request fronk/thetool!647
This commit is contained in:
@@ -16,17 +16,27 @@ class Snopp extends Modules\ApiControllerModule
|
||||
|
||||
}
|
||||
|
||||
public function setPreorderConnected($id) {
|
||||
if(!$id || !is_numeric($id)) {
|
||||
public function setPreorderConnected($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]);
|
||||
//print_r($wohneinheit);
|
||||
|
||||
$preorder = \PreorderModel::getFirstActive(["adb_wohneinheit_id" => $wohneinheit->id]);
|
||||
if(!$preorder) {
|
||||
return \mfResponse::NotFound(["message" => "Home not found"]);
|
||||
}
|
||||
@@ -41,20 +51,30 @@ class Snopp extends Modules\ApiControllerModule
|
||||
$preorder->save();
|
||||
}
|
||||
|
||||
//print_r($preorder);exit;
|
||||
|
||||
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"]);
|
||||
}
|
||||
|
||||
@@ -49,16 +49,6 @@ class OperationaldataApicontroller extends mfBaseApicontroller
|
||||
$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");
|
||||
$this->addRoute("/preorder/customerInstallationFeedback", [$modules["Cif"], "userSetCif"], "POST");
|
||||
|
||||
$this->addRoute("/preorder/:code/clientInstallationFinished", [$modules["Cif"], "providerSetCif"], "POST");
|
||||
$this->addRoute("/preorder/:code/serviceActivated", [$modules["Activation"], "setServiceActive"], "POST");
|
||||
$this->addRoute("/preorder/:code", "getPreorder", "GET");
|
||||
$this->addRoute("/preorder/:code", "cancelPreorder", "DELETE");
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user