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

[Backport release_3_7] Fix Relation Reference Form control OrderByValue default value to true #4843

Merged
merged 1 commit into from
Oct 4, 2024
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
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
Loading