score:3
It's likely the apartment's individual policy. I've seen places (not in Spain) that require the entire payment in advance as well. A place I'm staying at in New Zealand in October required the full payment up front, which I paid back in April.
It's not the norm, but it does happen.
So in regards to your question:
1) It's not a case of them 'enforcing' it - it's your choice whether to stay there or not. If you do, you agree to their terms and conditions. Same with any hotel's rules, whatever they might be, or however draconian they may seem.
2) This I'm not sure of. Perhaps for rent, but not for holiday accommodation. Fairly sure as long as they keep everything above board and don't scam you, they can do it. However, make sure you have proof of requests for payment and proof of payment, just to ensure that there's a paper / electronic trail, should the need arise.