Merge branch 'fronkdev' into 'master'

ConstructionConsent Filter update

See merge request fronk/thetool!898
This commit is contained in:
Frank Schubert
2025-01-14 13:57:44 +00:00
4 changed files with 58 additions and 20 deletions
@@ -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)) {
@@ -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 {