Criterion for the integrality of hypergeometric series with parameters from quadratic fields