diff --git a/lizmap/modules/lizmap/lib/Form/QgisForm.php b/lizmap/modules/lizmap/lib/Form/QgisForm.php index 72cdd3605f..039cd3b687 100644 --- a/lizmap/modules/lizmap/lib/Form/QgisForm.php +++ b/lizmap/modules/lizmap/lib/Form/QgisForm.php @@ -1762,6 +1762,8 @@ protected function PerformWfsRequest($wfsRequest, $formControl, $referencedField } // orderByValue + // orderByValue has been removed from XML since QGIS 3.32 + // TODO Remove check orderByValue and keep asort when QGIS 3.32 will be the minimum version for allowing a QGIS project if ($formControl->relationReferenceData['orderByValue']) { asort($data); } diff --git a/lizmap/modules/lizmap/lib/Form/QgisFormControlProperties.php b/lizmap/modules/lizmap/lib/Form/QgisFormControlProperties.php index aa1567f98f..8917326959 100644 --- a/lizmap/modules/lizmap/lib/Form/QgisFormControlProperties.php +++ b/lizmap/modules/lizmap/lib/Form/QgisFormControlProperties.php @@ -127,6 +127,18 @@ public function getEditAttributes() return $this->attributes; } + /** + * @param string $attrName + * + * @return bool + */ + public function hasEditAttribute($attrName) + { + $lowerName = strtolower($attrName); + + return isset($this->attributes[$attrName]) || isset($this->attributeLowerNames[$lowerName]); + } + /** * @param string $attrName * @@ -206,9 +218,10 @@ public function getValueRelationData() public function getRelationReference() { + // TODO Remove orderByValue when QGIS 3.32 will be the minimum version for allowing a QGIS project return array( 'allowNull' => $this->getEditAttribute('AllowNull'), - 'orderByValue' => $this->getEditAttribute('OrderByValue'), + 'orderByValue' => $this->hasEditAttribute('OrderByValue') ? $this->getEditAttribute('OrderByValue') : true, // OrderByValue has been removed from XML since QGIS 3.32 'relation' => $this->getEditAttribute('Relation'), 'mapIdentification' => $this->getEditAttribute('MapIdentification'), 'filters' => $this->getEditAttribute('filters'),