Skip to content

Commit 9e329f2

Browse files
authored
Merge pull request #5479 from mind84/editable_features_performance
[Bugfix] Multiple calls of editableFeatures method breaks php
2 parents 25ba42b + 48c9b5d commit 9e329f2

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lizmap/modules/lizmap/classes/qgisVectorLayer.class.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -1174,9 +1174,11 @@ public function isFeatureEditable($feature)
11741174
* when there is a filter by login (or by polygon). This allows to deactivate the editing icon
11751175
* for the non-editable features inside the popup and attribute table.
11761176
*
1177+
* @param array<string, string> $wfsParams Extra WFS parameters to filter the layer : FEATUREID or EXP_FILTER could be use
1178+
*
11771179
* @return array Data containing the status (restricted|unrestricted) and the features if restricted
11781180
*/
1179-
public function editableFeatures()
1181+
public function editableFeatures($wfsParams = array())
11801182
{
11811183
// Editable features are a restricted list
11821184
$restricted_empty_data = array(
@@ -1255,6 +1257,8 @@ public function editableFeatures()
12551257
'GEOMETRYNAME' => 'none',
12561258
);
12571259

1260+
$params = array_merge($params, $wfsParams);
1261+
12581262
// Perform the request to get the editable features
12591263
$wfsRequest = new WFSRequest($project, $params, lizmap::getServices());
12601264
// Activate edition context to get filtered layer for edition

lizmap/modules/lizmap/lib/Request/WMSRequest.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,16 @@ protected function gfiVectorXmlToHtml($layerId, $layerName, $layerTitle, $layer,
781781
// edition can be restricted on current feature
782782
$qgisLayer = $this->project->getLayer($layerId);
783783

784+
// get wfs name
784785
/** @var \qgisVectorLayer $qgisLayer */
785-
$editableFeatures = $qgisLayer->editableFeatures();
786+
$typename = $qgisLayer->getWfsTypeName();
787+
788+
// additional WFS parameter for features filtering
789+
$wfsParams = array(
790+
'FEATUREID' => $typename.'.'.$id,
791+
);
792+
793+
$editableFeatures = $qgisLayer->editableFeatures($wfsParams);
786794
$editionRestricted = '';
787795
if (array_key_exists('status', $editableFeatures) && $editableFeatures['status'] === 'restricted') {
788796
$editionRestricted = 'edition-restricted="true"';

0 commit comments

Comments
 (0)