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,13 +692,14 @@ class PCustomer < ApplicationRecord
particular_bill.fax = value
when "mode_reglement"
next if value.nil?
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
elsif value == "TRAITE"
n.p_payment_type_id = PPaymentType.find_or_create_by(name: "Traite").id
else
n.p_payment_type_id = PPaymentType.find_or_create_by(name: value).id
if value.present?
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
elsif value == "TRAITE"
n.p_payment_type_id = PPaymentType.find_or_create_by(name: "Traite").id
else
n.p_payment_type_id = PPaymentType.find_or_create_by(name: value).id
end
end
when "libelle_mode_reglement"
@ -722,8 +723,9 @@ class PCustomer < ApplicationRecord
end
when "nom_banque"
next if value.nil?
bank = PBank.find_or_create_by(name: value)
if value.present?
bank = PBank.find_or_create_by(name: value)
end
when "adresse_banque_1"
bank_particular.address_1 = value
@ -766,18 +768,19 @@ class PCustomer < ApplicationRecord
particular_bill.civilite = value
when "fonction_contact"
next if value.nil?
contact.p_contact_types << PContactType.find_or_create_by(name: value)
if value.present?
contact.p_contact_types << PContactType.find_or_create_by(name: value)
end
when "telephone_contact"
contact.tel = value
when "portable_contact"
next if value.nil?
if contact.tel.nil?
contact.tel = value
else
contact_2 = PContact.new(tel: value)
if value.present?
if contact.tel.nil?
contact.tel = value
else
contact_2 = PContact.new(tel: value)
end
end
when "email_contact"

View File

@ -63,32 +63,33 @@ class PFournisseur < ApplicationRecord
when "tva_intracom"
n.tva_num = value
when "delai_paiement"
next if value.nil?
case value
when "A la commande"
n.payment_delais = 0
when "A réception"
n.payment_delais = 0
when "7 jours net"
n.payment_delais = 7
when "21 jours net"
n.payment_delais = 21
when "30 jours"
n.payment_delais = 30
when "30 jours net"
n.payment_delais = 30
when "30 jours fin de mois"
n.payment_delais = 30
when "35 jours net"
n.payment_delais = 35
when "40 jours net"
n.payment_delais = 40
when "60 jours net"
n.payment_delais = 60
when "60 jours fin de mois"
n.payment_delais = 60
else
n.payment_delais = value
if value.present?
case value
when "A la commande"
n.payment_delais = 0
when "A réception"
n.payment_delais = 0
when "7 jours net"
n.payment_delais = 7
when "21 jours net"
n.payment_delais = 21
when "30 jours"
n.payment_delais = 30
when "30 jours net"
n.payment_delais = 30
when "30 jours fin de mois"
n.payment_delais = 30
when "35 jours net"
n.payment_delais = 35
when "40 jours net"
n.payment_delais = 40
when "60 jours net"
n.payment_delais = 60
when "60 jours fin de mois"
n.payment_delais = 60
else
n.payment_delais = value
end
end
when "interlocuteur"
contact_1.name = value