Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Multiple calls of editableFeatures method breaks php #5479

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lizmap/modules/lizmap/classes/qgisVectorLayer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1174,9 +1174,11 @@ public function isFeatureEditable($feature)
* when there is a filter by login (or by polygon). This allows to deactivate the editing icon
* for the non-editable features inside the popup and attribute table.
*
* @param array<string, string> $wfsParams Extra WFS parameters to filter the layer : FEATUREID or EXP_FILTER could be use
*
* @return array Data containing the status (restricted|unrestricted) and the features if restricted
*/
public function editableFeatures()
public function editableFeatures($wfsParams = array())
{
// Editable features are a restricted list
$restricted_empty_data = array(
Expand Down Expand Up @@ -1255,6 +1257,8 @@ public function editableFeatures()
'GEOMETRYNAME' => 'none',
);

$params = array_merge($params, $wfsParams);

// Perform the request to get the editable features
$wfsRequest = new WFSRequest($project, $params, lizmap::getServices());
// Activate edition context to get filtered layer for edition
Expand Down
10 changes: 9 additions & 1 deletion lizmap/modules/lizmap/lib/Request/WMSRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,16 @@ protected function gfiVectorXmlToHtml($layerId, $layerName, $layerTitle, $layer,
// edition can be restricted on current feature
$qgisLayer = $this->project->getLayer($layerId);

// get wfs name
/** @var \qgisVectorLayer $qgisLayer */
$editableFeatures = $qgisLayer->editableFeatures();
$typename = $qgisLayer->getWfsTypeName();

// additional WFS parameter for features filtering
$wfsParams = array(
'FEATUREID' => $typename.'.'.$id,
);

$editableFeatures = $qgisLayer->editableFeatures($wfsParams);
$editionRestricted = '';
if (array_key_exists('status', $editableFeatures) && $editableFeatures['status'] === 'restricted') {
$editionRestricted = 'edition-restricted="true"';
Expand Down
Loading