Fix version number generation when we want to set the patch number

Refs #8097
Merge remote branch 'origin/bugfix/8097_fix_patch_number'