Permalink
Browse files

Fix: Use hardcoded tree sorting for MS Project XML.

MS Project will get confused if the sequence of the tasks in the file
does not match the WBS.

Reported-by: Marc Rosskopf
  • Loading branch information...
1 parent 5801d2d commit 2dffd0263e7426e54dcd36de1a2f6d3bcd1f3eff @scrapper scrapper committed Oct 20, 2013
Showing with 7 additions and 2 deletions.
  1. +3 −1 lib/taskjuggler/TjpSyntaxRules.rb
  2. +4 −1 lib/taskjuggler/reports/MspXmlRE.rb
@@ -1195,7 +1195,9 @@ def rule_exportFormat
Project XML format can represent. This will inevitably lead to some rounding
errors and different interpretation of the data. The numbers you will see in
Project are not necessarily an exact match of the numbers you see in
-TaskJuggler.
+TaskJuggler. The XML file format requires the sequence of the tasks in the
+file to follow the work breakdown structure. Hence all user provided sorting
+directions will be ignored for this format.
EOT
)
end
@@ -53,7 +53,10 @@ def to_mspxml
# Prepare the task list.
@taskList = PropertyList.new(@project.tasks)
@taskList.includeAdopted
- @taskList.setSorting(a('sortTasks'))
+ # The MSP XML format requires that the tasks are listed in 'tree' order.
+ # We purposely ignore the user provided sorting criteria.
+ @taskList.setSorting([ [ 'tree', true, -1 ],
+ [ 'seqno', true, -1 ] ])
@taskList = filterTaskList(@taskList, nil, a('hideTask'), a('rollupTask'),
a('openNodes'))
@taskList.sort!

0 comments on commit 2dffd02

Please sign in to comment.