Add sorting functionality to cmd_notes

- Added sorting to cmd_notes
- Added make_sortable function so that sorts work happily even
  when the disparate notes don't have content of the same types
  in the fields the sort is requested over.

Redmine Feature Request #7965