From 94547f1fedda1fac996b0276d4b338262b85ffc1 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Sat, 21 Oct 2017 17:00:42 +0200 Subject: [PATCH] suite --- app/models/customer.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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