Fix compilation errors that occur in Scala 2.10.2 or later.
Sorting is invalid if template number is specified in item query screen.
Order history.