Almost worked for me (for about 6000 comments) except I could not import comment date and hostname fields. As far as I see they are basically hardcoded for now...

Any quick fix for that fields?

Comments

danepowell’s picture

Are you sure? Hostname and created date should be able to be mapped just like any other field. Yes they are given a default value, but you can override this by mapping a source in the processor. I don't think the way these are processed as changed since 6.x-1.x.

If you have mapped these fields correctly, are you sure your parser is providing the correct source values to the mapper?

dooug’s picture

Status: Active » Needs review
StatusFileSize
new757 bytes

I can confirm this. If you look at the comment_save() function, you'll see the created date and the hostname get set on inserting a new comment.

I've attached a patch that fixes the created date to maintain the source data when importing a comment.

The hostname isn't easily fixed. A possible work-around is to run the import for the comments without the hostname in the source (it'll create the comments), then run the importer again with the hostname (it'll update the existing comment records with the hostname).

danepowell’s picture

Status: Needs review » Needs work

I see... so the issue is not that we fail to set or map the hostname/date- the problem is that the hostname in particular gets overwritten when you call comment_save().

I think this is really a bug in core. The other fields get checked (isset) so as not to be overwritten, but hostname is an exception, for no obvious reason.

The only other options I see are to fork comment_save (ugh) or somehow override the IP address (is it just a static variable? not sure...)

dooug’s picture

I think you are right, in comment_save() it should check if the $comment->hostname isset before setting it.

I posted an issue on the comment.module: #1380626: Comment_save should not overwrite hostname if already set

danepowell’s picture

Status: Needs work » Postponed
Anonymous’s picture

Status: Postponed » Reviewed & tested by the community

I was having the same issue of dates not importing, but got it working after applying this patch (I also applied the patch from #1380626: Comment_save should not overwrite hostname if already set, not sure if that's required though...).

hvalentim’s picture

Same problem. Applied both patches such as BWPanda but it still does not work for the Date :/

And I am getting this in the watchdog:
Notice: A non well formed numeric value encountered in FeedsCommentProcessor->entitySave() (line 83 of /srv/www/site/public_html/sites/all/modules/feeds_comment_processor/FeedsCommentProcessor.inc)

Edit: Seems like it works only using UNIX Time stamp format.

tgeller’s picture

For the record, the patch worked for me with dates in the format:

2004-06-01 23:46:45

So perhaps it's worth applying in -dev. I know it's not the real solution, but it'll help out a few people.

sbakshian’s picture

Hi. I am running Drupal 7. Before applying the 1334830-1.patch, the dates in my csv file were not being used. After I applied "1334830-1.patch", I am now getting the value "Wed, 12/31/1969 - 18:33" for all the created dates. I checked my CSV file and the format of what I am importing is the following "2012-02-15 14:53:12"

As a side note, I am importing a content type with a date in it via Feeds and that column is coming in just fine.

Any ideas how to fix this? Or what I am doing wrong?

Thanks much,
Sam Bakshian

danepowell’s picture

Title: Comment date and hostname are missing » Missing comment date
Status: Reviewed & tested by the community » Fixed

I pushed the patch in #2: http://drupalcode.org/project/feeds_comment_processor.git/commit/8d11f7d
Note that this is completely untested, so please try the dev release that rolls tonight and let me know if it doesn't work.

I think we are all in agreement that the hostname problem is a core issue: #1380626: Comment_save should not overwrite hostname if already set
Trying to hack around that here would be just that - a hack. Interested parties should apply the patch in that issue.

sbakshian’s picture

Hi Dane,

This patch did not work for me and getting the dates to import properly. I still am getting the same date "Wed, 12/31/1969 - 18:33" being used for all imported comments. Any thoughts?

Thanks again,
Sam

dooug’s picture

Status: Fixed » Postponed (maintainer needs more info)

@sbakshian, can you post an example of of your csv that you are importing and describe your steps to import? And then we can better determine if the patch needs work.

sbakshian’s picture

Sure. The steps that I am taking are the following:
1. Go to Comment Importer and have the following settings:
Basic Settings:
Attached to: [none]
Periodic import: off
Import on submission

Fetcher:
File upload: Upload content from a local file.

Parser:
CSV parser
Parse data in Comma
Default delimiter: ;
No header: unchecked

Processor
Comment Parser
Input format: Plain text
Author: anonymous
Expire comments: Never
Update existing comments: Do not update existing comments

Mapping:
status -> Title
comment -> Comment
created -> Published date
ticket_id -> Node ID
uid -> User ID

Let me know if you need anything else.

Thanks very much,
Sam

PS - I tried to attach the csv file to this reply but drupal does not allow me to post a csv file. Here are the first 25 lines:
"id";"ticket_id";"uid";"created";"comment";"status"
"4";"20";"6";"2012-01-24 15:47:41";"Ran System restore to 5 most recent points, had no effect.";
"5";"20";"6";"2012-01-24 15:48:13";"Ran chkdsk /R, no errors found.";
"6";"20";"6";"2012-01-24 15:49:22";"Ran Memtest, no errors found after 25 passes.";
"7";"20";"6";"2012-01-24 15:50:47";"Backed up user data in case of drive failure. Running HDTune to test drive hardware.";
"8";"20";"7";"2012-01-25 07:53:56";"HDTune test on disk found no errors.";
"9";"20";"6";"2012-02-09 10:23:44";"Repaired MBR, booted up, ran virus scan, MBAM scan, all came clean.";
"10";"27";"7";"2012-02-15 08:04:47";"Backups were going to the C drive.Deleting old backups.";
"11";"29";"7";"2012-02-15 09:58:29";"Installed external hard drive into new case.Copied outlook contacts off of desktop computer.";
"12";"27";"7";"2012-02-15 11:33:26";"Old backups deleted - now over 150 GB free space.Uninstalled expired AVG, installed and updated Free AVG.Installed and ran CCleaner.Installed and ran Defraggler.";
"13";"28";"6";"2012-02-15 12:04:44";"Diagnosed bad hard drive, contacted customer, getting replacement drive to reinstall Windows. Quoted $175 total cost. Not attempting data recovery per customer.";
"14";"26";"7";"2012-02-15 14:53:12";"Checked and confirmed that the power adapter is bad.Tried our universal power adapter and the computer booted back up to her freecell game.Recommend the Kensington 90 Watt Wall Notebook Power Adapter.";
"15";"26";"7";"2012-02-15 15:14:28";"Called, left a message about needing a new power adapter.";
"16";"28";"7";"2012-02-15 15:34:09";"Installed Windows 7, still need to update drivers.";
"17";"25";"6";"2012-02-15 15:52:23";"Steven reset passwords for all users.";
"18";"23";"6";"2012-02-15 15:53:09";"Replaced CD drive, purchased from Microcenter.";
"19";"22";"6";"2012-02-15 15:58:03";"Removed virus, diagnosed bad network card, set up USB Wireless card.";
"20";"28";"6";"2012-02-15 15:58:43";"Created Invoice in SimpleInvoices.";
"21";"28";"6";"2012-02-15 16:06:08";"Paid by Check, Check # 187.73";
"22";"24";"7";"2012-02-16 07:32:52";"New power adapter tested ok, opened up laptop and confirmed part number for power jack which tests bad.Notified Adm who approved $20 part and $99 labor.Ordered part.";
"23";"26";"7";"2012-02-16 07:58:36";"Called Lynn to tell her the price of a power adapter.She approved $60 so I will pick that up at Microcenter today to have for her by 3:30.";
"24";"26";"7";"2012-02-16 09:42:55";"Power adapter ordered, ready to pick up at Microcenter.Will be back here by 3:30.";
"25";"25";"1";"2012-02-16 13:24:23";;"Work Completed"

sbakshian’s picture

I am still stuck with the "Wed, 12/31/1969 - 18:33" date being imported into my comments. After doing some more searching and reading, I found that my problem might be related to an incorrect date format in my csv file. However, when I import a similar csv file via node import, the created date comes over just fine. Very grateful for any suggestions. I would be more than happy to email anyone the csv files for testing.

Thanks again,
Sam

tgeller’s picture

@sbakshian: Install Feeds Tamper (http://drupal.org/project/feeds_tamper). It includes a plugin that'll convert your time format to proper Unix time. Very handy.

sbakshian’s picture

@tgeller Yes!!!!! Thank you so so much! :) That was it. I installed Feeds Tamper and had it convert the time format to the proper Unix time. Totally made my week :D

tgeller’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Glad it worked @sbakshian !

The original commenter (@betarobot) appears to have dropped out of this thread, which is over a year old. I'm closing it, but anyone who isn't satisfied with the solutions here can re-open it.

wuinfo - bill wu’s picture

Category: bug » task
Status: Closed (fixed) » Needs work

This module saves me a lot of time, thanks.

Open this issue again because:

Like node processor and user processor. Date like "2013-03-03 11:12" is importable without 3rd party module.

Tested with source date "2013-03-03 11:12" and "2013-03-03". The imported date was "1970-01-01 01:33" in both cases.

Changed the category to task.

twistor’s picture

Issue summary: View changes
Status: Needs work » Closed (fixed)
wuinfo - bill wu’s picture

Nice job, thanks @twistor.