Skip to content

Commit

Permalink
Merge pull request #3920 from rldhont/fix-check-geometry-field
Browse files Browse the repository at this point in the history
[Bugfix] Check Geometry Edition constraint
  • Loading branch information
rldhont authored Oct 11, 2023
2 parents 9b33aa7 + 03bf7b8 commit 384948c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lizmap/modules/lizmap/classes/qgisVectorLayer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ public function checkFeatureAgainstPolygonFilter($values)

return false;
} catch (Exception $e) {
jLog::log('Project '.$this->project->getKey().' layer '.$this->name.': bad SQL query to check feature against polygon filter : '.$sql, 'lizmapadmin');
\jLog::log('Project '.$this->project->getKey().' layer '.$this->name.': bad SQL query to check feature against polygon filter : '.$sql, 'lizmapadmin');

throw $e;
}
Expand Down Expand Up @@ -807,7 +807,7 @@ public function insertFeature($values)

return $pkvals;
} catch (Exception $e) {
jLog::log('Project '.$this->project->getKey().' layer '.$this->name.': bad SQL query to insert a feature :'.$sql, 'lizmapadmin');
\jLog::log('Project '.$this->project->getKey().' layer '.$this->name.': bad SQL query to insert a feature :'.$sql, 'lizmapadmin');

throw $e;
}
Expand Down
4 changes: 4 additions & 0 deletions lizmap/modules/lizmap/lib/Form/QgisForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,10 @@ public function check($feature = null)
$constraintExpressions[$fieldName] = $constraints['exp_value'];
}
}
// Get geometry from form if already set
if ($geometryColumn != '' && $values[$geometryColumn] == null) {
$values[$geometryColumn] = $form->getData($geometryColumn);
}

// Check the geometry is inside the filtering polygons, if relevant
$geomInPolygon = $this->layer->checkFeatureAgainstPolygonFilter($values);
Expand Down

0 comments on commit 384948c

Please sign in to comment.