Skip to content

Commit

Permalink
Merge pull request #4843 from 3liz/backport-4841-to-release_3_7
Browse files Browse the repository at this point in the history
[Backport release_3_7] Fix Relation Reference Form control OrderByValue default value to true
  • Loading branch information
rldhont authored Oct 4, 2024
2 parents d66902e + d4acd0a commit bf84b32
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lizmap/modules/lizmap/lib/Form/QgisForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,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);
}
Expand Down
15 changes: 14 additions & 1 deletion lizmap/modules/lizmap/lib/Form/QgisFormControlProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit bf84b32

Please sign in to comment.