Integrable scalar cosmologies with matter and curvature