merged back changes from trunk

git-svn-id: svn://svn.openvpms.org/openvpms/framework/branches/1.8-dev@5948 9e4fa352-aafb-0310-9071-df624684024b