ConstructionConsent Filter update

This commit is contained in:
Frank Schubert
2025-01-14 14:57:03 +01:00
parent fd88903963
commit ae7d565398
4 changed files with 58 additions and 20 deletions

View File

@@ -262,6 +262,20 @@ class ConstructionConsent extends mfBaseModel {
private static function getSqlFilter($filter) {
$where = "1=1 ";
if(array_key_exists("project_id", $filter)) {
$project_id = $filter['project_id'];
if(is_numeric($project_id)) {
$where .= " AND ConstructionConsent.constructionconsentproject_id=$project_id";
}
}
if(array_key_exists("constructionconsentproject_id", $filter)) {
$constructionconsentproject_id = $filter['constructionconsentproject_id'];
if(is_numeric($constructionconsentproject_id)) {
$where .= " AND ConstructionConsent.constructionconsentproject_id=$constructionconsentproject_id";
}
}
if(array_key_exists("adb_wohneinheit_id", $filter)) {
$adb_wohneinheit_id = $filter['adb_wohneinheit_id'];
if(is_numeric($adb_wohneinheit_id)) {

View File

@@ -75,6 +75,13 @@ class ConstructionConsentController extends mfBaseController {
$items = ConstructionConsent::search($filter);
$this->layout->set("items", $items);
if(array_key_exists("project_id", $filter) && $filter["project_id"]) {
$project = new ConstructionConsentProject($filter["project_id"]);
if($project->id) {
$this->layout()->set("project", $project);
}
}
}
private function getPreparedFilter($filter) : array
@@ -87,6 +94,8 @@ class ConstructionConsentController extends mfBaseController {
}
}
return $new_filter;
}
@@ -110,6 +119,9 @@ class ConstructionConsentController extends mfBaseController {
protected function addAction() : void {
$this->layout()->setTemplate("ConstructionConsent/Form");
if($this->request->project_id) {
$this->layout()->set("project_id", $this->request->project_id);
}
}
protected function editAction() : void {