class PCustomer < ApplicationRecord has_many :price_documents has_many :particulars, :as => :owner, :dependent => :destroy has_many :p_contact_ps, :class_name => "PContact", :through => :particulars, :source => :p_contacts has_many :p_contacts, :as => :contactable, :dependent => :destroy accepts_nested_attributes_for :p_contacts, allow_destroy: true has_many :p_customer_sheets has_many :p_sheet_lines, :through => :p_customer_sheets has_many :p_products, :through => :p_customer_sheets accepts_nested_attributes_for :particulars belongs_to :particular accepts_nested_attributes_for :particular has_many :p_payments belongs_to :p_customer_cat has_many :p_documents validates :code, :presence => true, :uniqueness => true has_many :p_compta_elements belongs_to :accounting_zone belongs_to :market_discount has_many :timer_watchers has_many :open_range_elements, :as => :element has_many :open_ranges, :through => :open_range_elements belongs_to :p_commercial has_many :p_customer_ribs, :dependent => :destroy accepts_nested_attributes_for :p_customer_ribs, :allow_destroy => true has_secure_password validations: false validates :password, :presence => true, :if => :password_needed? validates :password, confirmation: { case_sensitive: true }, :presence => true, :if => :password_needed? #validates :email, :presence => true, :uniqueness => true attr_accessor :actual_password, :valid_last_password, :valid_public, :generate_mdp, :valid_pswd_confirmation has_many :order_hist_lines has_many :order_hists # before_validation :set_auth_token, on: [:create, :update] before_validation do if self.code.blank? generate_code end end def generate_code if !self.code last_used_code = self.class.all.order(code: :desc).limit(1)[0].code last_number = last_used_code.match(/\d+/).to_s.to_i + 1 code = "CLI%04d" % [last_number] while self.class.find_by(code: code) last_number += 1 code = "CLI%04d" % [last_number] end self.code = code end end def self.qi_table_order { :created_at => {:name => "Date de création", :reorder => true, :as => :date}, :show_name => "Raison sociale", :code => {:name => "Code", :reorder => true}, :enabled => {:name => "Etat", :reorder => true, :sort_name => "p_customers.enabled"}, :p_commercial => {:name => "Commercial", :reorder => true, :sort_name => "p_commercials.name"}, :p_customer_cat => "Catégorie", :particular => "Ville", :market_discount => "Remise marché", :actions => "Actions" } #, :sort_name => "code" end def self.valid_sort r = [] self.qi_table_order.each do |key, value| if value.instance_of? Hash if value[:reorder] == false elsif value[:reorder] == true if value[:sort_name] r << value[:sort_name] else r << key.to_s end end end end return r end before_destroy do if self.p_customer_sheets.count > 0 or self.p_payments.count > 0 false else true end end def can_destroy? if self.p_customer_sheets.count > 0 or self.p_payments.count > 0 return false else return true end end after_initialize do begin self.p_payment_type_id = 41 if !self.p_payment_type_id? rescue end end before_validation do self.disabled_raison = "" if self.enabled if false #!self.code? if self.particulars[0] cars = self.particulars[0].organisation cars += self.particulars[0].name cars += self.particulars[0].firstname cars = cars.to_slug.gsub(/\W/,'').upcase cars = cars[0..1] cars += self.code = self.particulars[0].cp+cars end end generate_mlm_token if self.comptant if self.acompte errors.add(:acompte, "N'est pas compatible avec les paiements comptants") end if self.acompte_percent? errors.add(:acompte_percent, "N'est pas compatible avec les paiements comptants") end if self.payment_delais? errors.add(:payment_delais, "N'est pas compatible avec les paiements comptants") end if self.payment_fin_de_mois errors.add(:payment_fin_de_mois, "N'est pas compatible avec les paiements comptants") end end if self.acompte if !self.acompte_percent? errors.add(:acompte_percent, "Doit être remplis pour demander un acompte") end end if !self.comptant if !self.payment_delais? errors.add(:payment_delais, "Délais de paiement nécessaire si pas de paiement comptant") end end end def tva_rate if tva = TvaRate.where(:accounting_zone_id => self.accounting_zone_id).first return tva else return nil end end def update_caches end def ca_ht 0 end def ca_ttc 0 end def nbr_orders self.p_customer_sheets.where(:state => "facturée") end def nbr_orders_refusees self.p_customer_sheets.where(:state => "refusée") end def encours_assure r = 0.0 r = self.p_customer_cat.encourt_max if self.p_customer_cat r end def encours_assure_restant self.encours_assure.to_f - self.encours_ttc.to_f end def encours_ttc self.solde_avoir_and_bills - self.paiements_total end def th_r_encours_ttc self.solde_avoir_and_bills - self.th_r_paiements_total end def encours_at(date) self.solde_avoir_and_bills(date) - self.paiements_total(date) end def sheets_total_ht self.p_customer_sheets.where(:state => "facturée").sum(:cc_tot_amount_ht) end def solde_avoir_and_bills(date = Date.today) raise # p_document_id à remplacer self.p_documents.where(:p_document_type_id => [4,7]).where("created_at < ?", date.to_time.end_of_day).sum(:cache_total_ttc) end def sheets_total_ttc(date = Date.today) self.p_customer_sheets.where(:state => "facturée").where("created_at < ?", date.to_time.end_of_day).sum(:a_ok_total_ttc) end def paiements_total(date = Date.today) self.p_payments.where(:paid => true).where("paid_at < ?", date.to_time.end_of_day).sum(:amount) end def th_paiements_total self.p_payments.where(:paid => false).sum(:amount) end def th_r_paiements_total self.p_payments.sum(:amount) end def self.for_search(search) PCustomer.joins(:particulars).where("code LIKE ? or particulars.organisation LIKE ? or particulars.name LIKE ? or particulars.firstname LIKE ? or particulars.address_2 LIKE ? or particulars.address_3 LIKE ? or particulars.cp LIKE ? or particulars.city LIKE ?","%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%","%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%").uniq end def generate_mlm_token if !self.mlm_token? self.mlm_token = loop do mlm_token = SecureRandom.hex(3).upcase break mlm_token unless PCustomer.exists?(mlm_token: mlm_token) end end end def name self.show_name end def show_name if self.particular n = "" n += self.particular.organisation+" " if self.particular.organisation? #n += self.particular.name+" " if self.particular.name? #n += self.particular.firstname+" " if self.particular.firstname? return n end end def show_name_extend if self.particular n = "" n += self.code.to_s+" " n += self.particular.organisation+" " if self.particular.organisation? n += self.particular.name+" " if self.particular.name? n += self.particular.firstname+" " if self.particular.firstname? n += self.particular.cp+" " if self.particular.cp? n += self.particular.city+" " if self.particular.city? return n end end after_save do if !self.particular and self.particulars.count > 0 self.particular = self.particulars.first self.save end end def archive_import past_fact = self.p_documents.where("d_number regexp '^[0-9]+'").order("created_at DESC") if past_fact.first date = past_fact.first.created_at + 1.second amount = past_fact.sum(:cache_total_ttc) if !self.p_payments.where(:p_payment_type_id => 66).first p_payment = self.p_payments.new(:p_payment_type_id => 66, :imported => true, :paid => true, :paid_at => date, :amount => amount) p_payment.save end end PPayment.where(:imported => true).update_all(:paid => true) date = nil self.p_payments.order("paid_at DESC").each do |pp| enc = self.encours_at(pp.paid_at) if enc == 0.0 date = pp.paid_at.end_of_day break end end self.p_customer_sheets.where(:state => "facturée", :imported => true).update_all(:i_archive => false) self.p_documents.where(:label => "Facture", :imported => true).update_all(:i_archive => false) self.p_payments.where(:imported => true).update_all(:i_archive => false) self.p_customer_sheets.where(:state => "facturée", :imported => true).where("created_at < ?", date).update_all(:i_archive => true) self.p_documents.where(:label => "Facture", :imported => true).where("created_at < ?", date).update_all(:i_archive => true) self.p_payments.where(:imported => true).where("paid_at < ?", date).update_all(:i_archive => true) if date return true end def csv_enabled if self.enabled "Actif" else "Bloqué" end end def csv_p_commercial self.p_commercial.long_name if self.p_commercial end def csv_p_customer_cat self.p_customer_cat.name if self.p_customer_cat end def csv_particular r = "" if self.particular r += self.particular.cp.to_s+" " if self.particular.cp? r += self.particular.city.to_s+" " if self.particular.city? r += self.particular.country.to_s+" " if self.particular.country? end return r end def csv_market_discount if self.market_discount self.market_discount.percent.to_s+"%" end end def verify_actual_password self.authenticate(self.actual_password) end def password_needed? false # if (!self.id and (!self.generate_mdp or self.generate_mdp == "0")) or self.valid_pswd_confirmation # true # else # false # end end after_commit do self.generate_mdp_now if self.generate_mdp and self.generate_mdp != "0" end before_validation do if !self.particular self.particular = self.particulars.first end if self.valid_last_password and !PCustomer.find(self.id).authenticate(self.actual_password) errors.add(:actual_password, 'ne correspond pas au mot de passe actuel') end end def generate_mdp_now ps = SecureRandom.hex(4) self.password = ps self.password_confirmation = ps if !self.email? errors.add(:email, "Doit être présent") end self.generate_mdp = false if self.save #GeneralMailer.send_qi_mail("fr", "generation_mdp", self.email, {"mdp" => ps}).deliver mail_hist = MailHist.generate_mail(self.locale, MailType.find_by_slug("generation_mdp"), self.email, {:arguments => {:mdp => ps, :civilite => self.particular.civilite, :nom => self.particular.name, :prenom => self.particular.firstname }, :p_customer => self, :element => self}) else end end before_create do generate_token(:auth_token) end before_update do generate_token(:auth_token) end def generate_token(column) begin self[column] = SecureRandom.urlsafe_base64 end while PCustomer.exists?(column => self[column]) end acts_as_csv_import :fields => [ :code, :societe_raison_sociale, :nom_enseigne, :adresse_facturation_1, :adresse_livraison_2, :adresse_3, :cp, :cp2, :ville_1, :ville_2, :pays, :societe_livraison, :forme_juridique, :famille_client, :facturer_ttc, :mode_reglement, :libelle_mode_reglement, :telephone_1, :telephone_2, :fax, :risque, :bloque, :credit_accorde, :mode_tva, :nii, :nom_banque, :adresse_banque_1, :adresse_banque_2, :adresse_banque_3, :code_postal_banque, :ville_banque, :pays_banque, :code_banque, :code_guichet, :numero_compte, :cle_rib, :compte_comptable, :analytique, :taux_remise, :observation, :export_compta, :releve_compte, :email, :url, :siret, :representant, :nom_representant, :encour_initial, :credit_disponible, :code_tarif, :telephone_livraison, :portable_livraison, :fax_livraison, :encours_courant, :encours, :client_divers, :contacts_client, :date_creation, :code_iban, :code_bic, :nom_contact, :societe_contact, :titre_contact, :fonction_contact, :telephone_contact, :portable_contact, :email_contact ] def self.custom_csv_import(list, import_csv) #OK Code AUTO :code OK :code #OK Société - Raison Sociale :particular.organisation OK :societe_raison_sociale #OK Nom enseigne :particular.com_name OK :nom_enseigne #OK Adresse facturation 1 :particular.address_1 OK :adresse_facturation_1 #OK Adresse Livraison 2 :particular.address_2 OK :adresse_livraison_2 #OK Adresse 3 :particular.address_3 OK :adresse_3 #OK Code Postal 1 :particular.cp OK :cp #OK Code Postal 2 VIDE OK :cp2 #OK Ville 1 :particular_city OK :ville_1 #OK Ville 2 VIDE OK :ville_2 #OK Pays :particular.country OK :pays #OK Société Livraison :particular.address_4 OK :societe_livraison #OK Forme juridique livraison :particular.address_5 OK :forme_juridique #OK Famille Client VIDE OK :famille_client #OK Facturer en TTC VIDE OK :facturer_ttc #OK Mode Règlement :p_payment_type OK :mode_reglement #OK Libellé Mode Règlement :payment_delais OK :libelle_mode_reglement #OK Téléphone 1 :particular.tel OK :telephone_1 #OK Téléphone 2 :particular.tel2 OK :telephone_2 #OK Fax :particular.fax OK :fax #OK Risque VIDE OK :risque #OK Bloqué VIDE OK :bloque #OK Crédit accordé VIDE OK :credit_accorde #OK Mode TVA VIDE OK :mode_tva #OK N.I.I. VIDE OK :nii #OK Nom Banque :p_bank.name OK :nom_banque #OK Adresse 1 Banque :p_bank.particular.address_1 OK :adresse_banque_1 #OK Adresse 2 Banque :p_bank.particular.address_2 OK :adresse_banque_2 #OK Adresse 3 Banque VIDE OK :adresse_banque_3 #OK Code Postal Banque :p_bank.particular.cp OK :code_postal_banque #OK Ville Banque :p_bank.particular.ville OK :ville_banque #OK Pays Banque :p_bank.particular.pays OK :pays_banque #OK Code Banque INUTILE OK :code_banque #OK Code Guichet INUTILE OK :code_guichet #OK Numéro Compte INUTILE OK :numero_compte #OK Clé RIB INUTILE OK :cle_rib # Compte Comptable ??? ?? :compte_comptable #OK Analytique VIDE OK :analytique #OK Taux Remise VIDE OK :taux_remise #OK Observations AUTO :p_customer_sheet_note OK :observation #OK Export Compta VIDE OK :export_compta # Relevé Compte Bboolean à ajouter dans la base ?? :releve_compte #OK E-mail AUTO :email OK :email #OK URL VIDE OK :url #OK SIRET AUTO :siret OK :siret #OK Représentant :p_commercial_code OK :representant #OK Nom Représentant :p_commercial_firstname OK :nom_representant # Encours initial ??? ?? :encour_initial # Crédit Disponible ??? ?? :credit_disponible #OK Code Tarif VIDE OK :code_tarif #OK Téléphone Livraison :particular.send_tel OK :telephone_livraison #OK Portable Livraison :particular.send_tel2 OK :portable_livraison #OK Fax Livraison :particular.send_fax OK :fax_livraison # Encours courant ??? ?? :encours_courant # encours_courant ??? ?? :encours # Client divers ??? ?? :client_divers #OK Contacts client INUTILE OK :contacts_client #OK Date de création INUTILE OK :date_creation #OK Code IBAN :p_customer_ribs.iban OK :code_iban #OK Code BIC :p_customer_ribs.bic OK :code_bic #OK Nom du contact :p_contact_name OK :nom_contact #OK Société du contact VIDE OK :societe_contact #OK Titre du contact :p_contact.civilite OK :titre_contact #OK Fonction du contact :p_contact.comment OK :fonction_contact #OK Téléphone du contact :p_contact.tel OK :telephone_contact #OK Portable du contact :p_contact.tel2 OK :portable_contact #OK E-mail du contact :p_contact.email OK :email_contact # ap "*********************************************************************************************************" # ap "*********************************************************************************************************" # ap "*********************************************************************************************************" # ap list # ap list.class # ap "*********************************************************************************************************" # ap "*********************************************************************************************************" # ap "*********************************************************************************************************" # ap import_csv # ap "*********************************************************************************************************" # ap "*********************************************************************************************************" # ap "*********************************************************************************************************" list.each do |row| n = self.new(imported: true, p_customer_cat: PCustomerCat.find_by_name("Professionnel")) # particular = Particular.new(pro: true) particular_bill = Particular.new(pro: true) bank = bic = iban = p_commercial = particular_send = send_tel = send_tel2 = send_fax = send_address_2 = p_commercial_code = p_commercial_firstname = contact_2 = nil bank_particular = Particular.new(pro: true) contact = PContact.new row.each do |key, value| if self.type_for_attribute(key) and self.type_for_attribute(key).type == :decimal eval "n.#{key} = value.to_s.gsub(' ', '').gsub(',', '.')" else case key when "societe_raison_sociale" particular_bill.organisation = value if !value.blank? when "nom_enseigne" particular_bill.com_name = value if !value.blank? when "adresse_facturation_1" particular_bill.address_1 = value if !value.blank? when "adresse_livraison_2" send_address_2 = value if !value.blank? when "adresse_3" particular_bill.address_3 = value if !value.blank? when "cp" particular_bill.cp = value if !value.blank? when "ville_1" particular_bill.city = value if !value.blank? when "pays" particular_bill.country = value if !value.blank? when "societe_livraison" particular_bill.address_4 = value if !value.blank? when "forme_juridique" particular_bill.address_5 = value if !value.blank? when "telephone_1" particular_bill.tel = value if !value.blank? when "telephone_2" particular_bill.tel2 = value if !value.blank? when "fax" particular_bill.fax = value if !value.blank? when "mode_reglement" 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" case value when "Virement à la commande" n.payment_delais = 0 when "Chèque à la commande" n.payment_delais = 0 when "Chèque à réception" 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 when "nom_banque" if value.present? bank = PBank.find_or_create_by!(name: value) end when "adresse_banque_1" bank_particular.address_1 = value if !value.blank? when "adresse_banque_2" bank_particular.address_2 = value if !value.blank? when "code_postal_banque" bank_particular.cp = value if !value.blank? when "ville_banque" bank_particular.city = value if !value.blank? when "pays_banque" bank_particular.country = value if !value.blank? when "telephone_livraison" send_tel = value if !value.blank? when "portable_livraison" send_tel2 = value if !value.blank? when "fax_livraison" send_fax = value if !value.blank? when "representant" p_commercial_code = value if !value.blank? when "nom_representant" p_commercial_firstname = value if !value.blank? when "code_iban" iban = value if !value.blank? when "code_bic" bic = value if !value.blank? when "nom_contact" contact.name = value if !value.blank? when "titre_contact" particular_bill.civilite = value if !value.blank? when "fonction_contact" if value.present? contact.p_contact_types << PContactType.find_or_create_by!(name: value) end when "telephone_contact" contact.tel = value if !value.blank? when "portable_contact" if value.present? if contact.tel.nil? contact.tel = value if !value.blank? else contact_2 = PContact.new(tel: value) end end when "email_contact" contact.email = value if !value.blank? when "observation" n.p_customer_sheet_note = value if !value.blank? # champs vides ou inutiles : when "cp2" when "ville_2" when "famille_client" when "facturer_ttc" when "risque" when "bloque" when "credit_accorde" when "mode_tva" when "nii" when "adresse_banque_3" when "code_banque" when "code_guichet" when "numero_compte" when "cle_rib" when "analytique" when "taux_remise" when "export_compta" when "url" when "code_tarif" when "contacts_client" when "date_creation" when "societe_contact" # Champs ??? when "compte_comptable" when "encour_initial" when "credit_disponible" when "releve_compte" when "encours_courant" when "releve_compte" when "encours" when "client_divers" else eval "n.#{key} = value if !value.blank?" end end end n.particulars << particular_bill n.save! if bank bank.bic = bic bank_particular.organisation = bank.name bank.particulars << bank_particular if bank_particular.address_1 bank.save! import_csv.import_csv_elements << ImportCsvElement.new(:element => bank) end if bic || iban rib = PCustomerRib.find_or_create_by!(bic: bic, iban: iban) rib.bank = bank.name if bank 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) end 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 particular_send = Particular.new particular_send.tel = send_tel if send_tel particular_send.tel2 = send_tel2 if send_tel2 particular_send.fax = send_fax if send_fax n.particulars << particular_send n.particular_send_id = particular_send.id end n.p_contacts << contact if (contact.name || contact.tel || contact.email) n.p_contacts << contact_2 if contact_2 # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ n §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap n # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ contact §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap contact # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ n.contacts §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap n.p_contacts # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ n.particulars §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap n.particulars # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ n.p_customer_ribs §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap n.p_customer_ribs # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ n.p_commercial §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap n.p_commercial # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" # ap "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§" import_csv.import_csv_elements << ImportCsvElement.new(:element => n) end end end