Scottish firms fined after trench collapses on worker