We may want (now or in the future) to emit invoices to users whose addresses don't match the following pattern :
def display_address
address = room.present? ? "Appartement #{room}\n" : ''
"#{address}Résidence Léonard de Vinci\nAvenue Paul Langevin\n59650 Villeneuve-d'Ascq"
end
either because they don't have a room and still buy a subscription, or because the invoice should be addressed to a legal entity having another address (for instance the alumni association)
I suggest adding a new address (or custom_address to avoid confusion) nullable attribute to users, and do the following logic :
display_address =
IF custom_address IS NOT NULL THEN custom_address
ELSE IF room IS NOT NULL THEN "Appartement......Villeneuve-d'Ascq"
ELSE "Résidence......Villeneuve-d'Ascq"
Reminder : Once emitted, an invoice (the pdf as well as all the parameters used to generate it) are fixed and independently stored, so there is no problem for a user changing display_ address afterwards
We may want (now or in the future) to emit invoices to users whose addresses don't match the following pattern :
either because they don't have a room and still buy a subscription, or because the invoice should be addressed to a legal entity having another address (for instance the alumni association)
I suggest adding a new
address(orcustom_addressto avoid confusion) nullable attribute to users, and do the following logic :Reminder : Once emitted, an invoice (the pdf as well as all the parameters used to generate it) are fixed and independently stored, so there is no problem for a user changing display_ address afterwards