protect from blank
This commit is contained in:
parent
3a7b510e64
commit
5da5246800
@ -653,43 +653,43 @@ class PCustomer < ApplicationRecord
|
|||||||
else
|
else
|
||||||
case key
|
case key
|
||||||
when "societe_raison_sociale"
|
when "societe_raison_sociale"
|
||||||
particular_bill.organisation = value
|
particular_bill.organisation = value if !value.blank?
|
||||||
|
|
||||||
when "nom_enseigne"
|
when "nom_enseigne"
|
||||||
particular_bill.com_name = value
|
particular_bill.com_name = value if !value.blank?
|
||||||
|
|
||||||
when "adresse_facturation_1"
|
when "adresse_facturation_1"
|
||||||
particular_bill.address_1 = value
|
particular_bill.address_1 = value if !value.blank?
|
||||||
|
|
||||||
when "adresse_livraison_2"
|
when "adresse_livraison_2"
|
||||||
send_address_2 = value
|
send_address_2 = value if !value.blank?
|
||||||
|
|
||||||
when "adresse_3"
|
when "adresse_3"
|
||||||
particular_bill.address_3 = value
|
particular_bill.address_3 = value if !value.blank?
|
||||||
|
|
||||||
when "cp"
|
when "cp"
|
||||||
particular_bill.cp = value
|
particular_bill.cp = value if !value.blank?
|
||||||
|
|
||||||
when "ville_1"
|
when "ville_1"
|
||||||
particular_bill.city = value
|
particular_bill.city = value if !value.blank?
|
||||||
|
|
||||||
when "pays"
|
when "pays"
|
||||||
particular_bill.country = value
|
particular_bill.country = value if !value.blank?
|
||||||
|
|
||||||
when "societe_livraison"
|
when "societe_livraison"
|
||||||
particular_bill.address_4 = value
|
particular_bill.address_4 = value if !value.blank?
|
||||||
|
|
||||||
when "forme_juridique"
|
when "forme_juridique"
|
||||||
particular_bill.address_5 = value
|
particular_bill.address_5 = value if !value.blank?
|
||||||
|
|
||||||
when "telephone_1"
|
when "telephone_1"
|
||||||
particular_bill.tel = value
|
particular_bill.tel = value if !value.blank?
|
||||||
|
|
||||||
when "telephone_2"
|
when "telephone_2"
|
||||||
particular_bill.tel2 = value
|
particular_bill.tel2 = value if !value.blank?
|
||||||
|
|
||||||
when "fax"
|
when "fax"
|
||||||
particular_bill.fax = value
|
particular_bill.fax = value if !value.blank?
|
||||||
|
|
||||||
when "mode_reglement"
|
when "mode_reglement"
|
||||||
if value.present?
|
if value.present?
|
||||||
@ -719,7 +719,7 @@ class PCustomer < ApplicationRecord
|
|||||||
when "Mensuel - 30j fin de mois du dépôt"
|
when "Mensuel - 30j fin de mois du dépôt"
|
||||||
n.payment_delais = 30
|
n.payment_delais = 30
|
||||||
else
|
else
|
||||||
n.payment_delais = value
|
n.payment_delais = value if !value.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
when "nom_banque"
|
when "nom_banque"
|
||||||
@ -728,66 +728,66 @@ class PCustomer < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
when "adresse_banque_1"
|
when "adresse_banque_1"
|
||||||
bank_particular.address_1 = value
|
bank_particular.address_1 = value if !value.blank?
|
||||||
|
|
||||||
when "adresse_banque_2"
|
when "adresse_banque_2"
|
||||||
bank_particular.address_2 = value
|
bank_particular.address_2 = value if !value.blank?
|
||||||
|
|
||||||
when "code_banque"
|
when "code_banque"
|
||||||
bank_particular.cp = value
|
bank_particular.cp = value if !value.blank?
|
||||||
|
|
||||||
when "ville_banque"
|
when "ville_banque"
|
||||||
bank_particular.city = value
|
bank_particular.city = value if !value.blank?
|
||||||
|
|
||||||
when "pays_banque"
|
when "pays_banque"
|
||||||
bank_particular.country = value
|
bank_particular.country = value if !value.blank?
|
||||||
|
|
||||||
when "telephone_livraison"
|
when "telephone_livraison"
|
||||||
send_tel = value
|
send_tel = value if !value.blank?
|
||||||
|
|
||||||
when "portable_livraison"
|
when "portable_livraison"
|
||||||
send_tel2 = value
|
send_tel2 = value if !value.blank?
|
||||||
|
|
||||||
when "fax_livraison"
|
when "fax_livraison"
|
||||||
send_fax = value
|
send_fax = value if !value.blank?
|
||||||
|
|
||||||
when "representant"
|
when "representant"
|
||||||
p_commercial_code = value
|
p_commercial_code = value if !value.blank?
|
||||||
when "nom_representant"
|
when "nom_representant"
|
||||||
p_commercial_firstname = value
|
p_commercial_firstname = value if !value.blank?
|
||||||
|
|
||||||
when "code_iban"
|
when "code_iban"
|
||||||
iban = value
|
iban = value if !value.blank?
|
||||||
when "code_bic"
|
when "code_bic"
|
||||||
bic = value
|
bic = value if !value.blank?
|
||||||
|
|
||||||
when "nom_contact"
|
when "nom_contact"
|
||||||
contact.name = value
|
contact.name = value if !value.blank?
|
||||||
|
|
||||||
when "titre_contact"
|
when "titre_contact"
|
||||||
particular_bill.civilite = value
|
particular_bill.civilite = value if !value.blank?
|
||||||
|
|
||||||
when "fonction_contact"
|
when "fonction_contact"
|
||||||
if value.present?
|
if value.present?
|
||||||
contact.p_contact_types << PContactType.find_or_create_by!(name: value)
|
contact.p_contact_types << PContactType.find_or_create_by!(name: value)
|
||||||
end
|
end
|
||||||
when "telephone_contact"
|
when "telephone_contact"
|
||||||
contact.tel = value
|
contact.tel = value if !value.blank?
|
||||||
|
|
||||||
when "portable_contact"
|
when "portable_contact"
|
||||||
if value.present?
|
if value.present?
|
||||||
if contact.tel.nil?
|
if contact.tel.nil?
|
||||||
contact.tel = value
|
contact.tel = value if !value.blank?
|
||||||
else
|
else
|
||||||
contact_2 = PContact.new(tel: value)
|
contact_2 = PContact.new(tel: value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
when "email_contact"
|
when "email_contact"
|
||||||
contact.email = value
|
contact.email = value if !value.blank?
|
||||||
|
|
||||||
when "observation"
|
when "observation"
|
||||||
n.p_customer_sheet_note = value
|
n.p_customer_sheet_note = value if !value.blank?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -829,7 +829,7 @@ class PCustomer < ApplicationRecord
|
|||||||
when "client_divers"
|
when "client_divers"
|
||||||
|
|
||||||
else
|
else
|
||||||
eval "n.#{key} = value"
|
eval "n.#{key} = value if !value.blank?"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,15 +53,15 @@ class PFournisseur < ApplicationRecord
|
|||||||
else
|
else
|
||||||
case key
|
case key
|
||||||
when "nom_fournisseur"
|
when "nom_fournisseur"
|
||||||
n.name = value
|
n.name = value if !value.blank?
|
||||||
when "address"
|
when "address"
|
||||||
n.address1 = value
|
n.address1 = value if !value.blank?
|
||||||
when "ville"
|
when "ville"
|
||||||
n.city = value
|
n.city = value if !value.blank?
|
||||||
when "pays"
|
when "pays"
|
||||||
n.country = value
|
n.country = value if !value.blank?
|
||||||
when "tva_intracom"
|
when "tva_intracom"
|
||||||
n.tva_num = value
|
n.tva_num = value if !value.blank?
|
||||||
when "delai_paiement"
|
when "delai_paiement"
|
||||||
if value.present?
|
if value.present?
|
||||||
case value
|
case value
|
||||||
@ -88,19 +88,19 @@ class PFournisseur < ApplicationRecord
|
|||||||
when "60 jours fin de mois"
|
when "60 jours fin de mois"
|
||||||
n.payment_delais = 60
|
n.payment_delais = 60
|
||||||
else
|
else
|
||||||
n.payment_delais = value
|
n.payment_delais = value if !value.blank?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
when "interlocuteur"
|
when "interlocuteur"
|
||||||
contact_1.name = value
|
contact_1.name = value if !value.blank?
|
||||||
when "fonction"
|
when "fonction"
|
||||||
contact_1.p_contact_types << PContactType.find_or_create_by!(name: value)
|
contact_1.p_contact_types << PContactType.find_or_create_by!(name: value)
|
||||||
when "tel"
|
when "tel"
|
||||||
contact_1.tel = value
|
contact_1.tel = value if !value.blank?
|
||||||
when "skype"
|
when "skype"
|
||||||
contact_1.skype = value
|
contact_1.skype = value if !value.blank?
|
||||||
when "email_1"
|
when "email_1"
|
||||||
contact_1.email = value
|
contact_1.email = value if !value.blank?
|
||||||
when "email_2"
|
when "email_2"
|
||||||
contact_2 = PContact.new(email: value)
|
contact_2 = PContact.new(email: value)
|
||||||
when "email_3"
|
when "email_3"
|
||||||
@ -108,7 +108,7 @@ class PFournisseur < ApplicationRecord
|
|||||||
when "reglement_par"
|
when "reglement_par"
|
||||||
n.p_payment_type_id = PPaymentType.find_or_create_by!(name: value).id
|
n.p_payment_type_id = PPaymentType.find_or_create_by!(name: value).id
|
||||||
else
|
else
|
||||||
eval "n.#{key} = value"
|
eval "n.#{key} = value if !value.blank?"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user