ConstructionConsent Filter update
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user