Skip to content

Commit

Permalink
Merge pull request #4841 from rldhont/fix-relation-reference-orderByV…
Browse files Browse the repository at this point in the history
…alue

Fix Relation Reference Form control OrderByValue default value to true
  • Loading branch information
rldhont authored Oct 4, 2024
2 parents 05bb5d2 + 145c3d8 commit 637e6d3
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 @@ -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);
}
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

2 comments on commit 637e6d3

@3liz-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest weekly run of end2end "playwright" tests failed with this latest commit on the branch release_3_6 😣

CC @nboisteault and @Gustry, please have a look to the logs. Maybe it's a false positive ?

Visit https://github.com/3liz/lizmap-web-client/actions/runs/11208121394

@3liz-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest weekly run of end2end "cypress" tests failed with this latest commit on the branch release_3_6 😣

CC @nboisteault and @Gustry, please have a look to the logs. Maybe it's a false positive ?

Visit https://github.com/3liz/lizmap-web-client/actions/runs/11208121394

Please sign in to comment.