diff --git a/cadastre/classes/listGeoCommuneDatasource.class.php b/cadastre/classes/listGeoCommuneDatasource.class.php index 3aabf05..1cd14c7 100644 --- a/cadastre/classes/listGeoCommuneDatasource.class.php +++ b/cadastre/classes/listGeoCommuneDatasource.class.php @@ -32,29 +32,26 @@ public function getData($form) $layerConditions = null; $layerSql = cadastreConfig::getLayerSql($repository, $project, $config->commune->id); $polygonFilter = cadastreConfig::getPolygonFilter($repository, $project, $config->commune->id); - if ($layerSql !== null && $polygonFilter !== null) { - $layerConditions .= '(' . $layerSql . ') AND (' . $polygonFilter . ')'; - } elseif ($layerSql !== null) { - $layerConditions = $layerSql; - } elseif ($polygonFilter !== null) { - $layerConditions = $polygonFilter; + $loginFilter = cadastreConfig::getLoginFilter($repository, $project, $config->parcelle->id); + $layerFilters = array(); + if ($layerSql !== null) { + $layerFilters[] = $layerSql; } - $fblConfig = cadastreConfig::getFilterByLogin($repository, $project, $config->commune->id); - - $searchConditions = jDao::createConditions(); - if ($fblConfig !== null) { - $filterValues = array('all'); - if (jAuth::isConnected()) { - if (property_exists($fblConfig, 'filterPrivate') && $fblConfig->filterPrivate == 'True') { - $user = jAuth::getUserSession(); - $filterValues[] = $user->login; - } else { - $filterValues = array_merge($filterValues, jAcl2DbUserGroup::getGroups()); - } + if ($polygonFilter !== null) { + $layerFilters[] = $polygonFilter; + } + if ($loginFilter !== null) { + $layerFilters[] = $loginFilter; + } + if (count($layerFilters) != 0) { + if (count($layerFilters) == 1) { + $layerConditions = $layerFilters[0]; + } else { + $layerConditions = '(' . implode(') AND (', $layerFilters) . ')'; } - $searchConditions->addCondition($fblConfig->filterAttribute, 'IN', $filterValues); } + $searchConditions = jDao::createConditions(); foreach ((array) $this->labelProperty as $property) { $searchConditions->addItemOrder($property, 'asc'); } diff --git a/cadastre/classes/listGeoSectionDatasource.class.php b/cadastre/classes/listGeoSectionDatasource.class.php index 76252fa..505944a 100644 --- a/cadastre/classes/listGeoSectionDatasource.class.php +++ b/cadastre/classes/listGeoSectionDatasource.class.php @@ -42,26 +42,23 @@ public function getData($form) $layerConditions = null; $layerSql = cadastreConfig::getLayerSql($repository, $project, $config->section->id); $polygonFilter = cadastreConfig::getPolygonFilter($repository, $project, $config->section->id); - if ($layerSql !== null && $polygonFilter !== null) { - $layerConditions .= '(' . $layerSql . ') AND (' . $polygonFilter . ')'; - } elseif ($layerSql !== null) { - $layerConditions = $layerSql; - } elseif ($polygonFilter !== null) { - $layerConditions = $polygonFilter; + $loginFilter = cadastreConfig::getLoginFilter($repository, $project, $config->parcelle->id); + $layerFilters = array(); + if ($layerSql !== null) { + $layerFilters[] = $layerSql; } - $fblConfig = cadastreConfig::getFilterByLogin($repository, $project, $config->section->id); - - if ($fblConfig !== null) { - $filterValues = array('all'); - if (jAuth::isConnected()) { - if (property_exists($fblConfig, 'filterPrivate') && $fblConfig->filterPrivate == 'True') { - $user = jAuth::getUserSession(); - $filterValues[] = $user->login; - } else { - $filterValues = array_merge($filterValues, jAcl2DbUserGroup::getGroups()); - } + if ($polygonFilter !== null) { + $layerFilters[] = $polygonFilter; + } + if ($loginFilter !== null) { + $layerFilters[] = $loginFilter; + } + if (count($layerFilters) != 0) { + if (count($layerFilters) == 1) { + $layerConditions = $layerFilters[0]; + } else { + $layerConditions = '(' . implode(') AND (', $layerFilters) . ')'; } - $searchConditions->addCondition($fblConfig->filterAttribute, 'IN', $filterValues); } foreach ((array) $this->labelProperty as $property) { diff --git a/cadastre/classes/listParcelleLieuNoMajicDatasource.class.php b/cadastre/classes/listParcelleLieuNoMajicDatasource.class.php index de2d1fb..c447047 100644 --- a/cadastre/classes/listParcelleLieuNoMajicDatasource.class.php +++ b/cadastre/classes/listParcelleLieuNoMajicDatasource.class.php @@ -42,26 +42,23 @@ public function getData($form) $layerConditions = null; $layerSql = cadastreConfig::getLayerSql($repository, $project, $config->parcelle->id); $polygonFilter = cadastreConfig::getPolygonFilter($repository, $project, $config->parcelle->id); - if ($layerSql !== null && $polygonFilter !== null) { - $layerConditions .= '(' . $layerSql . ') AND (' . $polygonFilter . ')'; - } elseif ($layerSql !== null) { - $layerConditions = $layerSql; - } elseif ($polygonFilter !== null) { - $layerConditions = $polygonFilter; + $loginFilter = cadastreConfig::getLoginFilter($repository, $project, $config->parcelle->id); + $layerFilters = array(); + if ($layerSql !== null) { + $layerFilters[] = $layerSql; } - $fblConfig = cadastreConfig::getFilterByLogin($repository, $project, $config->parcelle->id); - - if ($fblConfig !== null) { - $filterValues = array('all'); - if (jAuth::isConnected()) { - if (property_exists($fblConfig, 'filterPrivate') && $fblConfig->filterPrivate == 'True') { - $user = jAuth::getUserSession(); - $filterValues[] = $user->login; - } else { - $filterValues = array_merge($filterValues, jAcl2DbUserGroup::getGroups()); - } + if ($polygonFilter !== null) { + $layerFilters[] = $polygonFilter; + } + if ($loginFilter !== null) { + $layerFilters[] = $loginFilter; + } + if (count($layerFilters) != 0) { + if (count($layerFilters) == 1) { + $layerConditions = $layerFilters[0]; + } else { + $layerConditions = '(' . implode(') AND (', $layerFilters) . ')'; } - $searchConditions->addCondition($fblConfig->filterAttribute, 'IN', $filterValues); } foreach ((array) $this->labelProperty as $property) { diff --git a/cadastre/classes/listParcellePropDatasource.class.php b/cadastre/classes/listParcellePropDatasource.class.php index cad3e67..bfbd4de 100644 --- a/cadastre/classes/listParcellePropDatasource.class.php +++ b/cadastre/classes/listParcellePropDatasource.class.php @@ -57,26 +57,23 @@ public function getData($form) $layerConditions = null; $layerSql = cadastreConfig::getLayerSql($repository, $project, $config->parcelle->id); $polygonFilter = cadastreConfig::getPolygonFilter($repository, $project, $config->parcelle->id); - if ($layerSql !== null && $polygonFilter !== null) { - $layerConditions .= '(' . $layerSql . ') AND (' . $polygonFilter . ')'; - } elseif ($layerSql !== null) { - $layerConditions = $layerSql; - } elseif ($polygonFilter !== null) { - $layerConditions = $polygonFilter; - } - $fblConfig = cadastreConfig::getFilterByLogin($repository, $project, $config->parcelle->id); - - if ($fblConfig !== null) { - $filterValues = array('all'); - if (jAuth::isConnected()) { - if (property_exists($fblConfig, 'filterPrivate') && $fblConfig->filterPrivate == 'True') { - $user = jAuth::getUserSession(); - $filterValues[] = $user->login; - } else { - $filterValues = array_merge($filterValues, jAcl2DbUserGroup::getGroups()); - } + $loginFilter = cadastreConfig::getLoginFilter($repository, $project, $config->parcelle->id); + $layerFilters = array(); + if ($layerSql !== null) { + $layerFilters[] = $layerSql; + } + if ($polygonFilter !== null) { + $layerFilters[] = $polygonFilter; + } + if ($loginFilter !== null) { + $layerFilters[] = $loginFilter; + } + if (count($layerFilters) != 0) { + if (count($layerFilters) == 1) { + $layerConditions = $layerFilters[0]; + } else { + $layerConditions = '(' . implode(') AND (', $layerFilters) . ')'; } - $searchConditions->addCondition($fblConfig->filterAttribute, 'IN', $filterValues); } foreach ((array) $this->labelProperty as $property) {