Correction for get_next_value function

In january with a reset everymonth option activated, the sql for next number was wrong and always return the same reference