diff --git a/app/models/customer.rb b/app/models/customer.rb index bb184aa..f7799e9 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -171,6 +171,30 @@ class Customer < ActiveRecord::Base end + + before_validation do + + customer = self + + customer.particular_bill = customer.particular_bill || Particular.new + customer.particular_bill.skip_validation = true + customer.particular_bill.organisation = customer.organisation + customer.particular_bill.name = customer.name + customer.particular_bill.firstname = customer.firstname + customer.particular_bill.address_2 = customer.address + customer.particular_bill.address_3 = customer.address2 + customer.particular_bill.cp = customer.cp + customer.particular_bill.city = customer.city + customer.particular_bill.country = customer.country + customer.particular_bill.tel = customer.phone + customer.particular_bill.email = customer.email + + customer.particular_send = customer.particular_send || Particular.new + customer.particular_send.skip_validation = true + + customer.particular_idem = true + + end