A Dunfermline man, who assaulted a shop employee and then spat at a female bar worker, has been jailed for a year.