A thermodynamically-consistent theory of the ferro/paramagnetic transition