Except as otherwise provided in Section 31202, whenever a contract has been entered into, or a resolution passed, as provided in this chapter, any employee who has become an employee of the first public agency because of the assumption by such public agency of any or all of the functions of the second public agency who within one year after becoming an employee of the first public agency pays into the retirement fund of such first public agency the same amount which he would have contributed had he been employed by the first public agency at the same salary, and for the same time or periods of time for which and during which he was employed by the officer or department of the second public agency whose functions are assumed by the first public agency shall have all of the retirement rights which he would have had, if any, had he been an employee of the first public agency at such salary and for such time or periods of time.