Skip to content

Commit

Permalink
Changes to user import for blank fields and bad emails
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Jun 3, 2011
1 parent ae2db40 commit e680f92
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion app/models/model_extension/end_user_import_extension.rb
Expand Up @@ -228,7 +228,17 @@ def import_csv(filename,data,options={}) #:nodoc:
fields.each do |fld|
value = row[fld[1]].to_s
if fld[4].to_sym == :field
entry_values[fld[3]] = value
if fld[3] == 'email'
if !value.blank?
if value =~ RFC822::EmailAddress
entry_values[fld[3]] = value unless value.blank?
elsif value.split(',')[0].to_s.strip =~ RFC822::EmailAddress
entry_values[fld[3]] = value.split(',')[0].strip
end
end
else
entry_values[fld[3]] = value unless value.blank?
end
elsif fld[4].to_sym == :address
process_import_address(entry,entry_addresses,fld[3],value)
elsif fld[4].to_sym == :tags
Expand All @@ -243,6 +253,7 @@ def import_csv(filename,data,options={}) #:nodoc:
end

entry.attributes = entry_values
entry.admin_edit = true

if entry.valid?
entry_addresses.each do |key,adr|
Expand Down
2 changes: 1 addition & 1 deletion app/views/member_import/status.rjs
Expand Up @@ -11,6 +11,6 @@ else
if @completed
page << '$("wizard_next").disabled = false;'
else
page << 'setTimeout(ImportStatus.monitor,1000);'
page << 'setTimeout(ImportStatus.monitor,5000);'
end
end

0 comments on commit e680f92

Please sign in to comment.