Order of custom groups not correct
Overview
When editing a case, the order of custom groups isn't correct (doesn't respect weight)
Reproduction steps
- Create a new custom group for a case "second"
- Create a new custom group for a case "first"
- change the order (weight) so "first" is before "second"
- create a new case
Current behaviour
the custom groups are sorted by id, not by weight
Expected behaviour
The custom groups are sorted by weight
Environment information
Out of the box normal civi. Do you want me to create a test case on demo?
Comments
I spent a few hours drilling through the code, getTree (CRM/Core/BAO/CustomGroup.php) returns the groups properly sorted
but groupTree in templates/CRM/Custom/Form/CustomData.tpl isn't ;(
in CRM/Core/BAO/CustomGroup.php::buildQuickForm $groupTree is correct (with the correct order)
but $form->assign_by_ref("{$prefix}groupTree", $groupTree);
ends up with the groupTree being re-ordered in smarty?
I'm a bit confused as when the order of the custom block is defined, but I'm pretty keen on having it respecting the weight/sort order ;)