Feature Update

This commit is contained in:
Daniel Spitzer
2023-02-21 12:24:44 +00:00
committed by Frank Schubert
parent 0763f068bd
commit aa72b1ba95
18 changed files with 437 additions and 526 deletions

View File

@@ -93,13 +93,11 @@ class DeviceController extends mfBaseController
$data = [];
$data['name'] = trim($r->name);
$data['devicetype_id'] = $r->devicetype_id;
if (empty(trim($r->pop_id))) {
if (trim($r->pop_id)=="0") {
$data['pop_id'] = NULL;
} else {
$data['pop_id'] = $r->pop_id;
}
$data['ip'] = $r->ip;
$data['mac'] = $r->mac;
$data['serial'] = $r->serial;
@@ -139,11 +137,38 @@ class DeviceController extends mfBaseController
$this->layout()->setFlash("Device konnte nicht angelegt werden", "error");
$this->redirect("Device");
}
$returnUrl="Device";
$returnAction = "Index";
$returnVariables = array();
$returnAnker = "";
if ($this->request->returnto) {
if (strpos($this->request->returnto, "-") !== false) {
$urls = explode('-', $this->request->returnto);
$urlCounter = 0;
$returnUrlGen = "";
foreach ($urls as $url) {
if ($urlCounter > 0) {
$returnUrlGen .= "/";
}
$returnUrlGen .= ucfirst($url);
$urlCounter++;
}
$returnAction = "";
$returnVariables['id'] = $id;
$returnUrl = $returnUrlGen;
} else {
$returnUrl = ucfirst($this->request->returnto);
}
}
if ($mode == "edit") {
$this->layout()->setFlash("Device erfolgreich geändert", "success");
} else if ($mode = "add") {
$this->layout()->setFlash("Device erfolgreich angelegt", "success");
}
$this->redirect("Device");
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
}
}