diff options
Diffstat (limited to 'src/mod_privacy_odbc.erl')
-rw-r--r-- | src/mod_privacy_odbc.erl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mod_privacy_odbc.erl b/src/mod_privacy_odbc.erl index 1fdf799d..aac29552 100644 --- a/src/mod_privacy_odbc.erl +++ b/src/mod_privacy_odbc.erl @@ -414,7 +414,12 @@ parse_items(Els) -> parse_items(Els, []). parse_items([], Res) -> - lists:reverse(Res); + %% Sort the items by their 'order' attribute + %% 5 is the position of 'order' attribute in a #listitem tuple + %% This integer can be calculated at runtime with: + %% 2 + length(lists:takewhile(fun(E) -> E =/= order end, + %% record_info(fields, listitem))), + lists:keysort(5, Res); parse_items([{xmlelement, "item", Attrs, SubEls} | Els], Res) -> Type = xml:get_attr("type", Attrs), Value = xml:get_attr("value", Attrs), |