We know that for a PID $R$, any finitely generated module is of the form $\frac{R}{(a_1)} \oplus \dots \oplus \frac{R}{(a_s)} $. I was wondering if the converse of this statement is true, that is, is it true that for a domain $R$, if any f.g. module is isomorphic to $\frac{R}{I_1} \oplus \dots \oplus \frac{R}{I_s}$ for ideals $I_i \triangleleft R $, must $R$ be a PID?

I know that a counter example to the above statement must be non Noetherian (and infact, it must be that any non-principal ideal is not f.g.) because if $I = (a_1, ..., a_n)$ is a non principal f.g. ideal, that it is a torsion free $R$ module, but it isn't free, since $x_1, ... x_m$ are not linearly independent if $m > 1$ since $x_2 x_1 + (-x_1)x_2 = 0$, hence they do not form a basis.

PS: I would generally like $R$ to be commutative unitial and an integral domain, but I would love to know even for other cases.