remove next in custom_import

This commit is contained in:
Barnabé 2021-10-14 09:08:25 +02:00
parent b57ed75754
commit 2abba273a9
2 changed files with 47 additions and 43 deletions

View File

@ -692,7 +692,7 @@ class PCustomer < ApplicationRecord
particular_bill.fax = value particular_bill.fax = value
when "mode_reglement" when "mode_reglement"
next if value.nil? if value.present?
if value == "VIR" || "VIR COM" || "VIR 60 J NET" || "VIR 30 J NET" if value == "VIR" || "VIR COM" || "VIR 60 J NET" || "VIR 30 J NET"
n.p_payment_type_id = PPaymentType.find_or_create_by(name: "Virement").id n.p_payment_type_id = PPaymentType.find_or_create_by(name: "Virement").id
elsif value == "TRAITE" elsif value == "TRAITE"
@ -700,6 +700,7 @@ class PCustomer < ApplicationRecord
else else
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
end end
end
when "libelle_mode_reglement" when "libelle_mode_reglement"
case value case value
@ -722,8 +723,9 @@ class PCustomer < ApplicationRecord
end end
when "nom_banque" when "nom_banque"
next if value.nil? if value.present?
bank = PBank.find_or_create_by(name: value) bank = PBank.find_or_create_by(name: value)
end
when "adresse_banque_1" when "adresse_banque_1"
bank_particular.address_1 = value bank_particular.address_1 = value
@ -766,19 +768,20 @@ class PCustomer < ApplicationRecord
particular_bill.civilite = value particular_bill.civilite = value
when "fonction_contact" when "fonction_contact"
next if value.nil? 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
when "telephone_contact" when "telephone_contact"
contact.tel = value contact.tel = value
when "portable_contact" when "portable_contact"
next if value.nil? if value.present?
if contact.tel.nil? if contact.tel.nil?
contact.tel = value contact.tel = value
else else
contact_2 = PContact.new(tel: value) contact_2 = PContact.new(tel: value)
end end
end
when "email_contact" when "email_contact"
contact.email = value contact.email = value

View File

@ -63,7 +63,7 @@ class PFournisseur < ApplicationRecord
when "tva_intracom" when "tva_intracom"
n.tva_num = value n.tva_num = value
when "delai_paiement" when "delai_paiement"
next if value.nil? if value.present?
case value case value
when "A la commande" when "A la commande"
n.payment_delais = 0 n.payment_delais = 0
@ -90,6 +90,7 @@ class PFournisseur < ApplicationRecord
else else
n.payment_delais = value n.payment_delais = value
end end
end
when "interlocuteur" when "interlocuteur"
contact_1.name = value contact_1.name = value
when "fonction" when "fonction"