Merged r13562 (#18269).

git-svn-id: http://svn.redmine.org/redmine/branches/2.6-stable@13630 e93f8b46-1217-0410-a6f0-8f06a7374b81
Backported r13560 and r13569 (#18280).

git-svn-id: http://svn.redmine.org/redmine/branches/2.6-stable@13631 e93f8b46-1217-0410-a6f0-8f06a7374b81