Commit 12588c61d4b32bb32e207459a8731c5297f78fb9

Authored by MoisesMachado
1 parent 6c8127c4

ActionItem261: converted the enteprises identifier to an aceptable format and ch…

…anged the identifier format to accept dots 


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1764 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/profile.rb
@@ -36,7 +36,7 @@ class Profile < ActiveRecord::Base @@ -36,7 +36,7 @@ class Profile < ActiveRecord::Base
36 acts_as_having_settings :field => :data 36 acts_as_having_settings :field => :data
37 37
38 # Valid identifiers must match this format. 38 # Valid identifiers must match this format.
39 - IDENTIFIER_FORMAT = /^[a-z][a-z0-9~]*([_-][a-z0-9~]+)*$/ 39 + IDENTIFIER_FORMAT = /^[a-z][a-z0-9~.]*([_-][a-z0-9~.]+)*$/
40 40
41 # These names cannot be used as identifiers for Profiles 41 # These names cannot be used as identifiers for Profiles
42 RESERVED_IDENTIFIERS = %w[ 42 RESERVED_IDENTIFIERS = %w[
script/extract_sies_data.rb
@@ -91,11 +91,21 @@ categories[#{cat.id}] = cat#{@seq}.id @@ -91,11 +91,21 @@ categories[#{cat.id}] = cat#{@seq}.id
91 endereco << " CEP: " << ent.cep 91 endereco << " CEP: " << ent.cep
92 end 92 end
93 93
94 - puts "new_ent({ :name => #{ent.nome.inspect}, :identifier => #{ent.nome.to_slug.inspect}, :contact_phone => #{ent.tel.inspect}, :address => #{endereco.inspect}, :lat => #{ent.lat.inspect}, :lng => #{ent.long.inspect}, :geocode_precision => #{ent.geomodificou.inspect}, :data => { :id_sies => #{ent.id_sies.inspect} }, :organization_info => OrganizationInfo.new(:contact_email => #{email.inspect}) }, #{ent.products.map{|p| { :name => p.category.nome , :product_category_id => p.category.id } }.inspect}, #{ent.input_products.map{|p| {:product_category_id => p.category.id} }.inspect})" 94 + puts "new_ent({ :name => #{ent.nome.inspect},
  95 + :identifier => #{ent.nome.to_slug.inspect},
  96 + :contact_phone => #{ent.tel.inspect},
  97 + :address => #{endereco.inspect},
  98 + :lat => #{ent.lat.inspect},
  99 + :lng => #{ent.long.inspect},
  100 + :geocode_precision => #{ent.geomodificou.inspect},
  101 + :data => { :id_sies => #{ent.id_sies.inspect} },
  102 + :organization_info => OrganizationInfo.new(:contact_email => #{email.inspect}) },
  103 + [#{ent.products.map{|p| "{ :name => #{p.category.nome.inspect} , :product_category_id => categories[#{p.category.id}] }"}.join(', ')}],
  104 + [#{ent.input_products.map{|p| "{ :product_category_id => categories[#{p.category.id}]}" }.join(', ')}])"
95 end 105 end
96 106
97 def dump_city(city) 107 def dump_city(city)
98 - puts "Region.create!(:name => #{city.cidade.inspect}, :parent => STATES[#{city.id.to_s[0..1]}], :lat => #{city.latitude}, :lng => #{city.longitude})" 108 + puts "Region.create!(:name => #{city.cidade.inspect}, :parent => STATES[#{city.id.to_s[0..1]}], :lat => #{city.latitude}, :lng => #{city.longitude}, :environment => Environment.default)"
99 end 109 end
100 110
101 end 111 end