bugfix import
This commit is contained in:
parent
56820f3f04
commit
6ed30defc6
@ -732,12 +732,16 @@ class PCustomer < ApplicationRecord
|
||||
n.payment_delais = 0
|
||||
when "30 JOURS FIN DE MOIS"
|
||||
n.payment_delais = 30
|
||||
n.comptant = false
|
||||
when "VIR 60J NET DATE RELEVE"
|
||||
n.payment_delais = 60
|
||||
n.comptant = false
|
||||
when "TRAITE A 60 JOURS FIN DE MOIS"
|
||||
n.payment_delais = 60
|
||||
n.comptant = false
|
||||
when "Mensuel - 30j fin de mois du dépôt"
|
||||
n.payment_delais = 30
|
||||
n.comptant = false
|
||||
else
|
||||
n.payment_delais = value if !value.blank?
|
||||
end
|
||||
@ -860,20 +864,22 @@ class PCustomer < ApplicationRecord
|
||||
|
||||
n.particulars << particular_bill
|
||||
|
||||
n.save
|
||||
n.save!
|
||||
|
||||
if bank
|
||||
bank.bic = bic
|
||||
bank.particulars << bank_particular if bank_particular.address_1
|
||||
bank.save
|
||||
bank.save!
|
||||
import_csv.import_csv_elements << ImportCsvElement.new(:element => bank)
|
||||
|
||||
end
|
||||
|
||||
if bic || iban
|
||||
rib = PCustomerRib.create(bic: bic, iban: iban)
|
||||
rib = PCustomerRib.find_or_create_by!(bic: bic, iban: iban)
|
||||
rib.bank = bank.name if bank
|
||||
account = PBankAccount.create(bic: bic, iban: iban, p_bank: bank, p_customer: n)
|
||||
account = PBankAccount.find_or_create_by!(bic: bic, iban: iban, p_customer: n)
|
||||
account.update(p_bank: bank) if bank
|
||||
|
||||
n.p_customer_ribs << rib
|
||||
import_csv.import_csv_elements << ImportCsvElement.new(:element => rib)
|
||||
import_csv.import_csv_elements << ImportCsvElement.new(:element => account)
|
||||
@ -882,6 +888,7 @@ class PCustomer < ApplicationRecord
|
||||
if p_commercial_code || p_commercial_firstname
|
||||
p_commercial = PCommercial.find_or_create_by!(code: p_commercial_code, firstname: p_commercial_firstname)
|
||||
n.p_commercial = p_commercial
|
||||
import_csv.import_csv_elements << ImportCsvElement.new(:element => p_commercial)
|
||||
end
|
||||
|
||||
if send_tel || send_tel2 || send_fax || send_address_2
|
||||
|
Reference in New Issue
Block a user