Keep filter after saving patching

This commit is contained in:
Frank Schubert
2021-09-23 21:14:42 +02:00
parent ba1c96c3f5
commit 8a9e29087a
4 changed files with 65 additions and 10 deletions

View File

@@ -157,15 +157,28 @@ class PatchingController extends mfBaseController {
$patch_data["linework_port"] = $r->linework_port;
$patch_data["device_type"] = $r->device_type;
$patch_data["device_name"] = $r->device_name;
$patch_data["device_port"] = $r->device_port;
$patch_data["patched"] = ($r->patched == "1") ? 1 : 0;
if(strlen($patch_data["device_type"])) {
$patch_data["device_type"] = $r->device_type;
} else {
$patch_data["device_type"] = null;
}
if($mode == "add") {
$patch_data['create_by'] = 1;
$patching = PatchingModel::create($patch_data);
if($patch_data["patched"]) {
$patch_data["patched_by"] = $this->me->id;
$patch_data["patched_date"] = date("U");
}
} else {
if($patch_data["patched"] && !$patchind->patched) {
$patch_data["patched_by"] = $this->me->id;
$patch_data["patched_date"] = date("U");
}
$patching->update($patch_data);
}
@@ -175,8 +188,19 @@ class PatchingController extends mfBaseController {
return $this->indexAction();
}
$sq = "";
$query = [];
if(is_numeric($this->request->s) && $this->request->s > 0) {
$query["s"] = $this->request->s;
}
if (is_array($this->request->filter)) {
$query["filter"] = $this->request->filter;
}
$qs = http_build_query($query);
$this->layout()->setFlash("Patchung erfolgreich gespeichert.", "success");
$this->redirect("Patching", "Index");
$this->redirect("Patching","Index", $qs);
}