Skip to content

Commit

Permalink
Contact imports default file type is now csv.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas von Deyen committed May 15, 2012
1 parent 8650ed6 commit 3570231
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions app/controllers/alchemy_crm/admin/contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ def new
def import
if request.post?
if params[:verified] == "1"
if params[:fields] || !(params[:file].content_type =~ /csv|plain|comma-separated-values/i).nil?
handle_csv_post_request
elsif !(params[:file].content_type =~ /vcard|directory/i).nil?
if params[:file] && !(params[:file].content_type =~ /vcard|directory/i).nil?
handle_vcf_post_request
else
flash[:error] = alchemy_crm_t(:invalid_file_type) % {:mime_type => params[:file].content_type}
redirect_to admin_contacts_path
handle_csv_post_request
end
else
@error = build_error_message(alchemy_crm_t(:imported_contacts_not_verified))
Expand Down Expand Up @@ -84,7 +81,7 @@ def create_resource_items_from_csv(*args)
@csv_import_errors.push [contact, contact.errors]
end
end
@valid_contacts = @contacts.select(&:valid?)
@valid_contacts = @contacts.select(&:valid?)
reader.remove_file if @csv_import_errors.empty?
end

Expand Down

0 comments on commit 3570231

Please sign in to comment.