Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Support CCK Date fields.
Comment | File | Size | Author |
---|---|---|---|
#169 | node_import-374346.patch | 6.94 KB | monotaga |
#158 | node_import_date.inc_.txt | 7.76 KB | NaX |
#126 | Screenshot-2.png | 7.59 KB | twooten |
#119 | 374346.patch | 711 bytes | mvc |
#89 | date.inc__6.txt | 8.33 KB | oadaeh |
Comments
Comment #1
infojunkieSubscribe.
Comment #2
petey318 CreditAttribution: petey318 commentedSubscribing. date just went to 6.x-2.0 so its looking reasonably stable now...
Comment #3
Robrecht Jacques CreditAttribution: Robrecht Jacques commentedCould you try date.inc from CVS? Copy the file into
sites/all/modules/node_import/supported/date/date.inc
(creating a new directory).
If you could give me feedback on how it works or when it doesn't I'll be able to fix those and include CCK Date into -rc5.
Thanks.
Comment #4
infojunkieI tried to import the attached file. In Set import options (step 5 of 8), I chose "Custom Format" and "m/d/Y". On the preview screen, I got "An illegal choice has been detected. Please contact the site administrator." for each previewed record, as well as a var_dump of the values array. When I remove the date from the fields to be imported, the import proceeds correctly.
In the var_dump(), I noticed that field_date is set to be
whereas when I create a new node from the UI, the value that goes in for the same field is
The field_date I'm using is of type datestamp.
Thanks for your help!
Comment #5
infojunkieHere's some code for date.inc that seems to work in the case of date fields of type 'date' and of widget type 'date_select':
When I added this code to date.inc, the imported worked without complaining. Note that the date_convert() function takes a timezone argument that I left as default for the time being. I'll be working on other widget types and other date types.
Comment #6
infojunkieAttached is a new version of date.inc that I verified to work with all CCK Date types, widget types, and also with 'To date' enabled. Whoever is interested please test it and send your feedback here. Thanks!
Comment #7
Robrecht Jacques CreditAttribution: Robrecht Jacques commentedNice work. After some reviewing I'll include it in -rc5.
A question:
Could you not set
output_format
toDATE_ARRAY
orDATE_ISO
? Then you can get rid ofhook_node_import_values_alter()
altogether. Or am I confused aboutdate_format
andoutput_format
myself :-)Comment #8
infojunkieI tried to set
output_format
directly to DATE_ARRAY and avoid the extra conversion but got the following behaviour:* warning that mb_strlen (inside drupal_strlen) is passed an array on line 602 of node_import.inc. I commented that line just to let the processing continue.
* the DATE_ARRAY values end up in
values[cck:field_date:value]
but *not* invalues[field_date]
which is what is desired. I did not further debug the issue.Also, I made the following change to
case 'value2':
indate_node_import_fields()
:since the 'To date' should probably not be required if the field as a whole is not required.
Comment #9
jmbeach CreditAttribution: jmbeach commentedI've been testing out the ability to import Date fields with Node Import and been successful using the date.inc that was posted in #6 above.
However, if the date field for my content type has the repeat options enabled, I get a white screen with "Fatal error: Cannot unset string offsets". This error points to /sites/all/modules/date/date_repeat/date_repeat_form.inc on line 212.
When I am setting up the import, on step for for my field, called "Event date", there is an entry for "Unsupported: Event date -rrule". I assume that this means that importing repeat options is currently unsupported in the Node Import module.
If I set up my date field without repeat option, I am able to successfully import a CSV of dated nodes into my installation.
This has been reported over on the Date modules issue queue as http://drupal.org/node/379102 by someone else, but I thought I would mention this over here, too.
Comment #10
infojunkieI hadn't tested the repeat option :-) I'll try it and report my progress here. Thanks for testing!
Comment #11
presleyd CreditAttribution: presleyd commentedI'm getting the following error
This date field and it's corresponding To date is required. If I make them both optional the message about 'Some value myst be entered in the To date.' goes away but the message about To needing to be greater than From and the foreach warning continue. Any ideas?
I have tried both the 2.0 and the dev versions of date with no difference.
Comment #12
infojunkie@presleyd: Did you specify multiple values for your date field? When I did so in mine it gave me those errors.
Comment #13
presleyd CreditAttribution: presleyd commentedStarted over with reloading the csv file and recreated the Date field and that seemed to do it. I don't think that field ever had multiple values defined though so not sure what was causing the problem. I did switch from the JS popup tool to just a simple select widget though, maybe related?
Comment #14
infojunkie@presleyd: I had tested against the JS popup date widget so it's less likely to be the cause. I'm still working on the multiple values issue.
@jmbeach: the date repeat feature uses a multiple values date field, which currently doesn't work. So I'll fix that first.
Comment #15
jmbeach CreditAttribution: jmbeach commented@kratib: It would be nice if it could just drop a NULL into the rrule field for now. My date field has the repeat options enabled for events that I hand-enter, but the datasets I'm trying to import are strictly single occurrence dates.
Comment #16
catchTested this (no multiple or repeating dates though), and it worked great for me.
Comment #17
infojunkie@jmbeach: Even if your dates are single-valued when you import them, the fact that they have the repeat option turned on makes them automatically multi-valued internally, and hence subject to the problem of multi-valued dates in general. I did try to set the rrule field to NULL but got the same erroneous behaviour.
Comment #18
infojunkieI've tried to debug through the date module to find the source of this error but I was unable to find it so far. I won't be able to put more time into this for now.
The state so far is that the latest date.inc file contained in this thread seems to work for single-valued date fields, but not for multiple values nor for repeat dates. Sorry everyone!
Comment #19
Robrecht Jacques CreditAttribution: Robrecht Jacques commented#6 has been committed to CVS (together with small fix in #8).
Patch needs more work.
Comment #20
thtas CreditAttribution: thtas commentedI'm just trying out the latest date.inc
It looks like it's working well for me but i notice it's not automatically selecting the field in my CSV on step 4
my CSV field is called "DATE OF ISSUE", and my date field is called "Date of Issue/date_of_issue" but it's not automatically selected on step 4 of the wizard like title and other fields i have (simple text).
Great module though :)
Comment #21
presleyd CreditAttribution: presleyd commented@kratib
I have to confirm my problems sure seem related to the date popup widget, I get this error whenever that is enabled and never with select list ceteris paribus.
Comment #22
martysteer CreditAttribution: martysteer commentedI can confirm this causal relation too.
Just for the import I changed the widget to 'select list', then switched back after import.
Comment #23
infojunkieThanks everyone for this report. I was able to reproduce this behaviour. I'll look at it during this coming week.
Comment #24
vinothg CreditAttribution: vinothg commentedGreat Work!
Comment #6 patch worked without any issues for me!
Comment #25
Coupon Code Swap CreditAttribution: Coupon Code Swap commentedI am using the latest dev version of Node Import and the latest dev version of CCK Date and I am not able to get the date import working. Keep getting an error that "The dates are invalid".
Comment #26
petey318 CreditAttribution: petey318 commented@undoIT -
I had the same issue last night - took me a while to get to work - but my problem was the "select list" issue reported in #21 and #22. The import only worked for me when I had the date widget in my CCK content type set up as a "select list". It steadfastly refuses to work when you have it set to be a text field.
The other thing is to make sure that your import format matches the format of the data in your CSV file. You might need to select a "custom format" in one of the final steps of the import process, and then set that to match your CSV data.
Comment #27
Coupon Code Swap CreditAttribution: Coupon Code Swap commentedThanks, changing the date widget to Select List did the trick. Also, had to change taxonomy vocab to Tags to get term import working. No more errors :)
Comment #28
rbishop CreditAttribution: rbishop commentedive tried this as listed above but still a few days of head-scratching , is the recommend type "date" or "datestamp" ?
what have others that got this to work doing for timezone ? i cant tell if that is my problem. ive tried many combinations
i keep getting this error "warning: date_timezone_set() expects parameter 1 to be DateTime, null given in [...]/drupal_6_10/sites/all/modules/date/date/date_elements.inc on line 229."
ive tried CSV with these options,
"2005-11-16 12:00:00";
"2005-11-16";
maybe i need to try 12/12/2009 like others list here
Comment #29
zw111aaa CreditAttribution: zw111aaa commentedto #6, kratib
Thank you for your help.
but there is a waring like this.
warning: date_offset_get() expects parameter 1 to be DateTime, null given in C:\xampp\htdocs\sites\all\modules\date\date\date_elements.inc on line 500.
so I have to make a small modify in the file(/sites/all/modules/date/date/date_elements.inc).
line 467
// add by zw111aaa start
if (isset($element[$from_field]['#value']) && !is_array($element[$from_field]['#value'])) {
$element[$from_field]['#value'] = date($element[$from_field]['#date_format'],strtotime($element[$from_field]['#value']));
$element[$from_field]['#value'] = array('date' => $element[$from_field]['#value']);
}
// add by zw111aaa end
I think it is not a good way,it is just no warning.
If you have a good way to modify this warning,please tell me.
Thank you very much, kratib.
Comment #30
frostystoo CreditAttribution: frostystoo commentedI too have the problem of date repeat making the import not work. When I change the datetime field type to a select list, the dates don't get entered at all and the forms do not work so doesn't seem to be an option.
Comment #31
davidmolliere CreditAttribution: davidmolliere commentedComment #6 patch worked without any issues for me too :)
Kudos for this module, the ability to import Dates is a real plus !
Comment #32
sagrotan CreditAttribution: sagrotan commentedSame here as #28
Hav' tested a lot, but no clue, also with the latest snaps of node_import and date. Sadly, i am not able to get in the drupal code yet.
Help really appreciated...
Comment #33
PolSame problem for me... using dev version of today of node_import.
I've attached the screenshots...
The date field is a text field... What to do to get it working ?
Thanks !
Comment #34
sagrotan CreditAttribution: sagrotan commented@pol:
try to switch to "select list" in date field properties like #27 and do it again
Comment #35
seaneffel CreditAttribution: seaneffel commentedI'm working with the most up-to-date dev releases of both Date and Node_Import and I can't get date values to import at all. Here is my problem description:
1. I create a CSV file where each row looks like this:
2. My Date field is a date (not datestamp) "select list" with a prefab format that looks like "2009-04-23 18:22". The to-date is optional.
3. I'm not using repeating dates or popup widgets or anything. It's just a straight up, normal field containing a Date_module value.
4. I start the node import process. I upload the file and map the values into the Title field and the Date field. After mapping I am presented with the date format choices in step 5 of the import process and I choose the date format that matches the both the values I suggested above ( which is, again, "2009-04-23 18:00"). I set my timezone for New York.
5. When I get to step 7, I get an error, "An illegal choice has been detected. Please contact the site administrator." I can't figure out why I'm getting this. The scheme dump beneath the error messages says:
6. When I do not include the date field value in the import then everything goes smoothly. When I attempt to fill in the to-date value with something, I get the "Illegal Choice" error twice.
7. I take a chance and try to import the date values as a custom format in step 5, by selecting "custom format" and entering "Y-m-d h:i" and I get the same results ("Illegal Choice").
Hopefully this is enough of a write up that someone can figure out what am I doing wrong? Is it me or is there a bug out there that I can't see? Thanks for the help.
Comment #36
notebene CreditAttribution: notebene commentedI'm unfortunately failing heinously with this, considering just entering the 200+ records by hand.
Seems like this should be simple.
I'm using the latest DEV. I replaced my /sites/all/modules/node_import/supported/date/date.inc with the one up on #6 (I assume that's the right place).
Got my CSV file, my dates are formatted as mm/dd/yyyy (but not necessarily leading 0s), so I selected a 'custom' form in step 5 and used 'n/j/Y' as my custom format, and by the time I get to step 7, I get:
Thoughts? Ideas? Suggestions?
Edit: Nevermind, didn't read everything above, I'm seeing something that might be my issue.
Update 2: Yeah, that was it, the popup date widget. Hopefully this gets logged as an issue to still resolve. I would like to be able to enable this so some power users can upload data, but if the only solution for dates is to let them go change the date picker from the popup on the content type before/after the import, that's not a very good solution. I could leave the date input as the select, but in all the years I've been doing this, 'everyone' wants the cute date picker and throws a fit when they see a date field without it, and I don't blame them.
Comment #37
seaneffel CreditAttribution: seaneffel commentedRefocusing this issue with updated reports on the bug at hand.
Importing records into nodes that have dates tend to fail because of several reasons, including both the date field widget setting and the formatting of the date value itself.
The solution might be to talk to KarenS about how to make her Date module more accessible to Node_import.
Comment #38
seaneffel CreditAttribution: seaneffel commentedBetter name to suit this issue, too.
Comment #39
Aren Cambre CreditAttribution: Aren Cambre commentedsubscribe
Comment #40
KarenS CreditAttribution: KarenS commentedI don't have time to do much on this, but wanted to post a suggestion. I'm not sure how node_import works, but I assume from the problems you're having you are using drupal_execute() somewhere. I always recommend using node_save() instead of drupal_execute() because drupal_execute() is horribly fragile and breakable (and there are known bugs). Even Jeff Eaton (one of its creators) suggests avoiding it. I did a whole long thread on all the problems it creates when trying to fix brokenness in Content Copy (which was using drupal_execute()).
If you use drupal_execute() you have to format the data in ways that are very specific to the widget the field is using, and even then you'll have all kinds of problems because drupal_execute() validation fails if you try to do it more than once in the same session (it's a known core bug that has a looonnnggg thread) and anything that should happen during validation will fail. And the date module does work to re-factor the widget values into the right format for the field during validation, so things will break if that doesn't get triggered.
If you use node_save() you don't need to know anything about the widgets, you just import data in the format the field expects -- YYYY-MM-DD HH:MM:SS for datetime, YYYY-MM-DDTHH:MM:SS for ISO and 9999999999 for Unix. Super super simple.
The only reason for using drupal_execute is for validation, and the validation doesn't work anyway.
Comment #41
rkdesantos CreditAttribution: rkdesantos commentedUsing the patch in #6 with the latest -dev for both the Node Import and Date modules and this got me most of the way there but two problems still occur:
I get the following error in step #7: "The date is invalid" (triggered by the check in line ~480 in date_elements.inc in the date module). My data is formatted thusly: 20090510 for which I set a custom format of "Ymd". The field is set to not have a "To Date" and allow blanks.
If I comment out that error I can thru the import but no date is actually saved into the new node and no further errors are generated. The previews all look correct and nothing obvious is wrong at that point but nothing is stored.
Comment #42
xamanu CreditAttribution: xamanu commentedsubscribe
Comment #43
jakew CreditAttribution: jakew commentedsubscribe
Comment #44
JoshG-1 CreditAttribution: JoshG-1 commentedI was running into a problem importing dates with times like 14:00. The date module (6.x-2.1) was barfing when asked to use minutes with a value of zero: the hours minutes and seconds are not properly zero-padded. The attached patch takes care of this.
Comment #45
hotspoons CreditAttribution: hotspoons commentedI've been struggling with this a lot today, trying to import around 15,000 (!) relational records from different tables exported to CSV files. The first issue I had was listed above, as something along the lines of "date_offset_get() expects parameter 1 to be DateTime, null given in /var/www/sites/default/modules/custom/date/date/date_elements.inc on line 500.". Setting the CCK field to a select list, as has been mentioned elsewhere in this bug report, fixed that issue.
The next issue was I kept getting the "An illegal choice has been detected. Please contact the site administrator." and a var_export of the node objects on the preview for the dates, on some, but not all of my dates. I finally figured out what was causing that - some of my records go back as far as 2001, and the CCK date field defaults to "-3/+3" as the years back and forward to select from. So setting the min/max years for the records to -10/+10 on the CCK date field fixed that issue.
I'm still in the process of importing several hundred event records from 2001 through now (where I got stuck on the dates). After that, I have about 13,000 image nodes to import that will combine into galleries for each event that will be glued together with Taxonomy that will have to be hand built using a SQL query and the event ID imported to a temporary CCK field. But anyhow this particular bug report has been my saving grace trying to get everything imported to the system thus far. Thanks,
-Rich
Comment #46
hotspoons CreditAttribution: hotspoons commentedScratch that. It was 33,410 image nodes that needed importing. And since node import doesn't support file or image attachments to nodes *but* it does support CCK files and images, I came up with a work around.
Attached is my import, 14 hours in. I wrote up in detail how to import image attachments for nodes (and presumably file attachments for nodes should work as well) using a small bit of SQL and CCK fields as an intermediary here: http://drupal.org/node/483248
Comment #47
OneTallShort CreditAttribution: OneTallShort commentedJust want to confirm that the 2009-04-22 dev version of node-import still doesn't handle date fields with "Text field with custom input format". You MUST use "Select List" as your date widget. Otherwise, you will get a "The dates are invalid" on the first date it finds.
Note also that the "The dates are invalid" message only shows once (on the first date it tries to import), even though you may have multiple problematic date fields using the text widget.
It would be nice if this problem was at least noted in the support docs....
Comment #48
Aren Cambre CreditAttribution: Aren Cambre commented(Canceling this comment. Missed the fact that you have to use the latest -dev release, not RC4.)
Comment #49
Aren Cambre CreditAttribution: Aren Cambre commented(Restoring priority to how it was before I messed with this issue.)
Comment #50
Aren Cambre CreditAttribution: Aren Cambre commentedLook at #444884: Integration with nodereference fields only works if nodereference field set to "select" widget. The solution is the same: use a select field. Could this problem be unrelated to the Date module?
Comment #51
Cyberwolf CreditAttribution: Cyberwolf commentedSubscribing.
Comment #52
djflux CreditAttribution: djflux commentedsubscribing
Comment #53
Junro CreditAttribution: Junro commentedsubscribe...
Comment #54
GuyPaddock CreditAttribution: GuyPaddock commentedCan you guys try replacing node_import/supported/date/date.inc with the attached file and importing with your date pop-up fields? I added the different cases for the different kinds of widgets -- the Date module actually has at least 3 different ways of arranging the field value depending on the type of widget and chosen format, but I think I have a nice generic solution for all three.
Comment #55
GuyPaddock CreditAttribution: GuyPaddock commentedAttached is an even more improved version which corrects an issue with AM/PM being in the wrong case, and the default values not working when the value being imported was empty (used to default to January 1, 2009).
I hope it helps!
Comment #56
alex.k CreditAttribution: alex.k commentedThis file worked well, thanks very much. I had to add a section handling timezones, attaching the file with this change.
[EDIT] one thing that this file doesn't do very well is adapt to the chosen input format. It essentially depends on dates being entered as "[date] - [time]", as it looks for space-dash-space to split the time and date portion.
Comment #57
robomalo CreditAttribution: robomalo commentedsubscribing
Comment #58
alex.k CreditAttribution: alex.k commented@robomalo could you try the attached file, and report if it worked for you? If not, then add what your date field configuration and widget was. It would help the maintainer to know if the file works. Thanks.
Comment #59
robomalo CreditAttribution: robomalo commentedThe file doesn't seem to be working properly for me.
The following widgets had the following errors:
select: "An illegal choice has been detected. Please contact the site administrator."
text field: the right month and days, but the wrong year
text field + popup: the right month and days, but the wrong year
I tried Y-m-d H:i and a custom format Y-m-d. Both fail. I made sure my CCK field input format matched the import settings in each attempt.
I also tried it with the "-" between the date and time...
Comment #60
robomalo CreditAttribution: robomalo commentedI did just discovered it breaks my dates before 1900. strtotime() doesn't support this and is used by this .inc. Correct me if I am wrong, but I _think_ Date 2 supports older dates. Therefore, I think this file will have to be altered to support Date 2's functionality.
Comment #61
robomalo CreditAttribution: robomalo commentedIn the supplied date.inc I changed line 113 from
$values[$fieldname][$i][$colname]['date'] = date($widgetFormat, $time);
to
$values[$fieldname][$i][$colname]['date'] = $value[$colname];
and it worked for me. I know this won't work for everyone and only applies to a small group of people. This just shows
that the line
$time = strtotime($value[$colname]);
is the source of my errors. I had to make sure my CSV date Y-m-d matched the input format of my content type Y-m-d.
Comment #62
legion80 CreditAttribution: legion80 commentedI am in a similar situation to robomalo in that I have historical dates I'm dealing with. I used the code in #56 with the hotfix in #61, but at step 7 I am getting errors of "A valid date is required for Dates of existence 2 From date. Dates of existence 2 To date is invalid." I tried to import with date fields of type Datetime and Date.
An excerpt of the output of the record preview:
I am trying to figure out what part of node_import_check_date() is failing, but am unsure how to get debug messages injected in the output. The csv import only had date info (Y-m-d). Any suggestions what might be happening?
Comment #63
hotspoons CreditAttribution: hotspoons commentedI ran into this a couple of days ago - what you need to do is configure the CCK date field you are trying to import the date to, and change the granularity to Year, Month, and Day.
Comment #64
FiNeX CreditAttribution: FiNeX commentedThe field on the CSV is something like "2007-01-29" (Y-d-m) and the granularity of the cck field is Year, month and day but it still fails.
I still have the "illegal choice" error message.
any suggestion?
Comment #65
legion80 CreditAttribution: legion80 commentedI did a double-check and the granularity was already set to year, month, and day.
My field has an optional to-date.
Comment #66
BassPlaya CreditAttribution: BassPlaya commentedhotspoons, did this really work for you? Not for me. Using the latest date.module, node-import module + advanced help.
I've reset my dates to granularity to year month day and apparently you can't select a timezone. So no timezone. Tried to import but that still failed.
If you have further info that I'm not using rite now, please let us know.
Thanx.
Comment #67
legion80 CreditAttribution: legion80 commentedok i think i finally figured out what's going on, but am unsure about where the code needs to be altered.
after a lot of dsm()... it looks like what was going on was my data in the csv was formatted as "Y-m-d" but the field itself has a required format of "m/d/Y".
i was able to determine this by looking at date_text_input_value() in date_api_elements.inc. there's a line that says:
$value = date_limit_value(date_convert_from_custom($input, $element['#date_format']), $granularity);
the #date_format attribute is set to the node's format, not the csv file's specified format.
i am going to re-format those fields in my csv and try re-importing again and see if that fixes the issue.
Comment #68
aterchin CreditAttribution: aterchin commented#55 worked for me: date set to jquery popup calendar, 8/1/2009, m/d/Y custom format on import, no timezone conversion.
Comment #69
funkeyrandy CreditAttribution: funkeyrandy commentedi cant get any situation to work...my csv has format of 08/2009..ive tried all scenarios and patches...illegal choice!..added timezone/removed to no avail.
can some kind soul help here..ive been up for 15 hrs on this!
Comment #70
alex.k CreditAttribution: alex.k commentedCould you not use a normal dd/mm/yyyy format, and after importing, if you don't need the day of month, remove it from granularity and/or display formats?
Comment #71
funkeyrandy CreditAttribution: funkeyrandy commentedthing is, ive already done that!
Comment #72
alex.k CreditAttribution: alex.k commentedImporting csv formatted as yyyy/mm/dd into a datestamp field that uses minical popup widget worked for me using the patch in #56. Granularity down to the minute, and TZ handling set to 'Date's timezone'. Used the latest DateAPI and latest -dev version of node_import.
Comment #73
funkeyrandy CreditAttribution: funkeyrandy commentedis a datestamo field different from a regular date field?..just making sure
Comment #74
alex.k CreditAttribution: alex.k commentedIt's stored in the database differently, but to the user there's no difference IIRC. Please check date api docs, though.
Comment #75
funkeyrandy CreditAttribution: funkeyrandy commenteddid exact same thing, tz on field set to date, tx on import set to newyork...used datestamp as well
i get this:
There are errors in Article Pub Date:
* The dates are invalid.
thanks for helping with this..i hope i resolve it !
r
Comment #76
funkeyrandy CreditAttribution: funkeyrandy commentednot sure if this will help, but the out put is like this in the error:
[field_pubdate] => Array
(
[0] => Array
(
[value] => 2009-06-01T00:00:00
[timezone] =>
[offset] =>
)
)
Comment #77
funkeyrandy CreditAttribution: funkeyrandy commentedcould this be part of the issue?
[value] => 2009-06-01T00:00:00
Comment #78
funkeyrandy CreditAttribution: funkeyrandy commentedok this is horrible....ive just spent 15 hrs triyng to import a date field that should work out of the box with a bare bones drupal install...latest versions of node import and date....and ive developed over 20 drupal sites. can anyone help? i need to launch another site tonight...see my prev. posts...ive literally tried everything...even formatting my csv like this: 2009-06-01T00:00:00
all i get is The dates are invalid.
Comment #79
funkeyrandy CreditAttribution: funkeyrandy commentedok i have a temp fix for anyone with this issue: use date 6.x-2.0
it worked no problem with patch #56
r
Comment #80
jameswoods CreditAttribution: jameswoods commentedI hate to sound like another "me too" but...
I'm running Acquia Drupal on a Windows local dev box (hmmmm could this be it?)
I attached the "a Node import debug report"
I have the date.inc file from #56 put into l\sites\all\modules\node_import\supported\date
The node cck field is: Date, select list, custom imput format: n/j/Y, to date: never, granularity: year month day
I get these errors on step 7
# warning: mb_strlen() expects parameter 1 to be string, array given in C:\Documents and Settings\guru\Sites\acquia-drupal-site\acquia-drupal\includes\unicode.inc on line 404.
# An illegal choice has been detected. Please contact the site administrator.
And of course no nodes import 8^(
Any thoughts?
ADDITIONAL INFO:
When I remove the date from the import, everything imports fine, but the date field in question gets populated with 1/1/2009 (must be a default value of sorts)
ADDITIONAL ADDITIONAL INFO:
I've reworked my csv import so the values are in yyyy-mm-dd format, and the step 7 import says
"There are errors in Purchase Date:
* The dates are invalid."
and the step 7 values contains the following :
[cck:field_purchase_date:value] => Array
(
[0] => 2008-03-18
)
I'm just not getting it...my csv has yyyy-mm-dd format, my CCK date field has Y-m-d format, my Set import options (step 5 of 8) has Y-m-d format (and custom format selected)
-James
Comment #81
Kristi Wachter CreditAttribution: Kristi Wachter commentedHotspoons, I just wanted to say thanks for the -/+ tip in 45 - that was the one piece I needed to get date import to work for me.
Thanks!
Comment #82
snorkers CreditAttribution: snorkers commentedThe only way I could get Dates to import using 6.x-1.x-Dev (22 Apr 09) was to set in CCK the Date format via 'Select List' (#47). All others failed.Not correct. Select List (from Basic Information) is only the first step...
2. Had to ensure that Repeat Rules was disable in CCK content type
3. Then took out default values from CCK field
4. Then Customized Date Parts: For each element of the date/time, I selected the Text Field radio button(as opposed to Select List)
An after 2 days' effort, it looks like 500+ calendar entries are actually importing. Yay!
Now have to remember to put the CCK date fields in my content type back to something user friendly.
PS. Apologies to any email subscribers for re-editing this twice.
Comment #83
ndm CreditAttribution: ndm commentedI've tried with patch 56 it's work for the other widget, very thanks.
But you can't have the "to date", the problem is here. not in date field but in date field with to date.
Comment #84
davegan CreditAttribution: davegan commentedI managed to import by doing the following:
1) Change widget to select list
2) Change date range to +/- 10 years
3) Convert my dates to unix timestamps
Only 4 hours later...
Comment #85
alduya CreditAttribution: alduya commentedThe patch in #56 works for me. I'm using date pop-ups as input and required To date.
I hope this module will make it to the next version because it really looks promising. Keep up the good work.
Comment #86
DartonW CreditAttribution: DartonW commentedSee http://drupal.org/node/477392#comment-2111134, it may be related to some of the problems discussed here.
Comment #87
squarecandy CreditAttribution: squarecandy commentedSo close I can taste it:
using Date 6.x-2.4, Node Import RC4 with date.inc from #55.
Date field using jquery popup; Default value is "now"; Default value for To date is "blank";
Input format: MM/DD/YYYY; Granularity: Year Month Day
Happy to report everything works great if both From and To dates are supplied. But if the to date is blank, it fills in 12/31/1969. Now the To date is before the From date, and it throws the simple error "The To date must be greater than the From date."
It's important in this context to be able to import a blank To date - not this odd default 1969 date. Can anyone point me in the right direction?
Thanks!
Comment #88
squarecandy CreditAttribution: squarecandy commentedFigured it out... sweet. This helped me:
http://us.php.net/manual/en/function.strtotime.php#60579
The default values that are entered if there is no value get skipped if there is a From date but no To date - plus you still want it to evaluate the From date, so I re-checked for a FALSE result to $time. Weird that date(FALSE) returns "12/31/1969", right? How is that useful?
Thanks GuyPaddok and AlexK for the work on this. Is this planned for inclusion in RC5?
Comment #89
oadaeh CreditAttribution: oadaeh commentedI'm adding my piece to this puzzle. My issue was that the code in date.inc wasn't taking into account custom date definitions. The attached file does.
Comment #90
hansrossel CreditAttribution: hansrossel commented#89 works for me with node_import rc4 and dates in format 18/10/2009 - 00:00
Thanks!
Comment #91
seehawk CreditAttribution: seehawk commentedI'm having big problems importing dates as well. Not sure what I'm doing wrong.
I added the patch from #89 to the Oct 10 dev version. Made sure none of the date fields in the content type are required. Set them all to the Select List widget, +10:-10, hour and minute granularity. It's still not working. I keep getting "The dates are invalid." on step 7 of the import.
One of the fields is part of a content multigroup from CCK3, but I still get the error even when I don't import that field. The other 4 date fields in that content type are single-value fields ("from" date, but no "to" date). In the .csv I'm importing, dates look like this: "08/16/2006 - 00:00", and I'm using the matching date format in step 5 (the default format).
Dates all display like this on the output from step 7:
[cck:field_date_sent:value] => Array
(
[0] => 2006-08-16T00:00:00
)
I've been wrestling with this thing for a couple days now, and at this point, I'm completely lost. Can anyone suggest something else that I can try? Any ideas would be welcome!
Comment #92
legion80 CreditAttribution: legion80 commentedThe date.txt from #89 does not fold in the fix regarding historical dates. strtotime() returns FALSE for me.
I need to fold back in the fix by replacing this line (108 in the attachment in #89):
to
Comment #93
froboySubscribe
Comment #94
Cayenne CreditAttribution: Cayenne commentedSubscribing. Edited prior issue out.
Comment #95
kruser CreditAttribution: kruser commentedsubscribing
Comment #96
Aren Cambre CreditAttribution: Aren Cambre commentedRemoving improper assignment from #24.
Comment #97
asb CreditAttribution: asb commentedHi,
Imports with the date.inc.txt from #89 added to 6.x-1.0-rc4 do work somehow for me; however, the results are absolutely useless: as well the date as the CCK text field is empty in the created nodes (imported CSV file just contains two fields, a date and a description, shouldn'tbe too hard); the only thing that really gets "imported" is the node title. It seems to simulate the import operation and only bulk create nodes. No errors are given.
Settings: "Delimiter Separated Values", Record separator "Newline", Field separator "Pipe (|)", Text delimiter "none", Escape character "none".
Date field: Default "empty", "To"-date: "empty", "To"-date: "never". As simple as it gets, one should think.
With the latest 6.x-dev from 2009-Oct-10 it's the other way around: the CCK date field seem to be supported by default, but imports fail at "Preview import (step 7 of 8)" with the error: "There are errors in Datum: The dates are invalid". I tried this at first with a granularity limited to Year and month (sometimes wonders do happen) and then with bogus day data (granularity: Year/Month/Day), formatted like "2001-01-01T00:00:00". This also fails with the error mentioned above, even if the date field was configured accordingly.
The debugging array look like follows:
My this and last import used dates formatted like "2001-01-01", same granularity of the CCK date field (Year/Month/Day), formatting Y-m-d.
Same error; excerpt from array:
This is highly frustrating :-(
Greetings, -asb
Comment #98
asb CreditAttribution: asb commentedThis must be a bad joke; the 'Node import' module doesn't even bother to import one single textfield from a CSV file into one one CCK multiline text field. Nodes are created, titles are filled in, but all CCK fields are empty.
Has someone ever succeeded in importing anything into CCK fields with 'Node import'? I'd be rather interested in the import parameters...
Greetings, -asb
Comment #99
alex.k CreditAttribution: alex.k commentedCould be a regression introduced with later versions of CCK. Import worked for pretty much all core CCK fields with CCK 2.1/2.2
Comment #100
Cayenne CreditAttribution: Cayenne commentedI've done tons of imports into CCK fields with Node Import. Only dates were tricky... Got'em now.
Comment #101
Aren Cambre CreditAttribution: Aren Cambre commentedDid we ever determine whether this is a problem with Node import or Date?
Comment #102
savageanne CreditAttribution: savageanne commented#89 solved my simple date import issue. Thanks to all.
Comment #103
bibo CreditAttribution: bibo commentedI'm in the same situation as asb at #97. "Highly frustrated" would be a good definition of my current status after 3 workdays(!) of headbanging with this problem. I've tried all date.inc version and modifications in this thread, with node_import RC4, and the latest dev, and Date 2.2 and the dev-version.
Currently using node_import latest dev & date 2.4
My date cck settings should be ok (have tried all variations), currently with default values as "Blank", widget as "Select", "d.m.Y" as input format (and granularity). Select is using textboxes for each part. The date fields have "to date" and the field nor to date are required.
My imports seem to succeed, but the result is always empty, all my over 40 CCK fields just don't get imported, only the title is ok.
To get to the root of this, next thing im going to do is create a dummy content type called "test", with one CCK date field. Then im trying (again) all settings, patches, module versions and CSV import data types. Sounds fun, doesn't it.
Comment #104
marrch_caat CreditAttribution: marrch_caat commentedPatch in #89 worked well for me. Almost everything worked fine, except for taxonomy term import, that produced errors, so I had to remove mapping for that field :( dunno why...
Comment #105
bibo CreditAttribution: bibo commentedIn the end #89 worked for me aswell. Didn't have time to report back in the hurry before christmas.
Still I had this very weird bug while importing with #89. The nodes first appeared blank! That is, there was no CCK information visible on the node view and edit pages except the title.
However, to my surprise I found the data in the CCK tables, for the exact same nodes. Page refreshes didn't fix anything, but clearing all Drupal caches fixed everything, the CCK information magically appered!
What worked for me with patch from #89 was:
- node_import 6.x-1.0-rc4
- date 6.x-2.4
- All the CCK Date fields setting optimations mentioned above. I think maybe only the SELECt-thing and maybe "+/-10" years were necessary in the end with #89.
- Cache clearing immediately after import!
Downgrading from node_import 6.x dev to 6.x-1.0-rc4 required some manual db-settings ("file_offset" fields). I added the old "offset" column as a new column. Without the changes the import would fail because of SQL errors.
Having to clear the cache seems weird (I had all page caching off, although that's supposed to only affect anonymous users anyway).
Maybe a $node cache reset for each imported node could maybe fix the cache problem. (
node_load($nid, NULL, true);
)Comment #106
Aren Cambre CreditAttribution: Aren Cambre commentedSince #105 points out problems, this needs to have needs review status.
Comment #107
bibo CreditAttribution: bibo commentedI believe the cache problem originates from the signup module:
http://drupal.org/node/605594
There is a simple patch that should fix it (hasn't been committed to any signup version yet).
#89 seems is not at fault, so I hope it gets committed soon => setting issue again to reviewed & tested.
Comment #108
nw CreditAttribution: nw commentedI wrote a fix to this bug before finding this issue!
In essence what I have done is very similar to the patch in #89. However, my code is about 20 lines compared with 200 lines in #89. My modified function is copied below for comparison to #89. Given that #89 has had more community debugging than my code, it may have less bugs.
Comment #109
Aren Cambre CreditAttribution: Aren Cambre commentedSetting back to needs review because of proposed improvement.
Comment #110
semperos CreditAttribution: semperos commentedWill re-post what I wrote at a later time.
Comment #111
portalmanagers CreditAttribution: portalmanagers commentedI am getting this error message:
"Input error: 12/06/2009 - 11:00am is not allowed for Date (not a date in 01/17/2010 - 8:57pm format)."
My date formats in CSV file is EXACTLY as requested but I continue to get this same input error message.
Does anyone have suggestions for novice on how to resolve this error?
Comment #112
tripper54 CreditAttribution: tripper54 commentedMy problem was related to incorrect zero padding of minutes. I tried the patch in #44, but it broke other rows that previously imported without a problem.
It seemed minutes need to be padded with a leading zero, but hours should not be. I commented out the line from the patch that padded the hours, and my dates import fine now.
I hope this helps someone.
Comment #113
AbhyK CreditAttribution: AbhyK commentedhi everyone,
Use Date as type instead of Datetime for the field in content type it works fine and for every date it will assign value time stamp as T00:00:00 so it is stored in database as
vid nid field_test_date_csv_value
704 704 1969-12-31T00:00:00
705 705 1970-01-01T00:00:00
706 706 1970-01-02T00:00:00
707 707 1970-01-03T00:00:00
our field name is test_date_csv
you can customize date format as m-d-Y or use php manual
hope it will help someone as it work for us.
Comment #114
Cyberwolf CreditAttribution: Cyberwolf commentedSubscribing.
Comment #115
bneel CreditAttribution: bneel commented#89 works well thanks
Ben
Comment #116
geerlingguy CreditAttribution: geerlingguy commentedUsing the patch in #88 I get the following error:
Fatal error: Cannot unset string offsets in [...]sites/all/modules/date/date_repeat/date_repeat_form.inc on line 212
Hrm...
Comment #117
tttimi CreditAttribution: tttimi commentedHi,
almost everything works fine with patch #89, the sample data seems fine, yet when I strat to import, I get the following warning:
user warning: Unknown column 'file_offset' in 'field list' query: INSERT INTO node_import_tasks (name, uid, created, changed, fid, has_headers, file_options, headers, type, map, defaults, options, file_offset, row_done, row_error, status) VALUES ('events1-15.csv', 1, 1266828542, 1266828542, 30, 1, 'a:10:{s:11:\"file_format\";s:9:\"csv-excel\";s:16:\"record separator\";s:9:\"\";s:22:\"other record separator\";s:0:\"\";s:15:\"field separator\";s:1:\";\";s:21:\"other field separator\";s:0:\"\";s:14:\"text delimiter\";s:1:\"\"\";s:20:\"other text delimiter\";s:0:\"\";s:16:\"escape character\";s:1:\"\"\";s:22:\"other escape character\";s:0:\"\";s:5:\"title\";s:26:\"Semicolon Separated Values\";}', 'a:8:{i:0;s:5:\"ev_id\";i:1;s:8:\"ev_start\";i:2;s:6:\"ev_end\";i:3;s:13:\"ev_attandance\";i:4;s:8:\"ev_title\";i:5;s:8:\"ev_venue\";i:6;s:7:\"ev_note\";i:7;s:13:\"ev_reportfile\";}', 'node:date', 'a:13:{s:5:\"title\";s:1:\"4\";s:29:\"cck:field_ev_attandance:value\";s:1:\"3\";s:21:\"cck:field_eleje:value\";s:1:\"1\";s:23:\"cck:field_ev_note:value\";s:1:\"6\";s:24:\"cck:field_ev_venue:value\";s:1:\"5\";s:22:\"cck:field_eleje:value2\";s:1:\"2\";s:3:\"uid\";s:0:\"\";s:7:\"created\";s:0:\"\";s:6:\"status\";s:0:\"\";s:7:\"promote\";s:0:\"\";s:6:\"sticky\";s:0:\"\";s:7:\"comment\";s:0:\"\";s:4:\"path\";s:0:\"\";}', 'a:8:{s:7:\"comment\";s:1:\"0\";s:3:\"uid\";s:5:\"admin\";s:7:\"created\";s:0:\"\";s:3:\"log\";s:26:\"Imported with node_import.\";s:6:\"status\";s:1:\"1\";s:7:\"promote\";s:1:\"0\";s:6:\"sticky\";s:1:\"0\";s:4:\"type\";s:4:\"date\";}', 'a:2:{s:21:\"cck:field_eleje:value\";a:3:{s:8:\"timezone\";s:15:\"Europe/Budapest\";s:11:\"date_format\";s:9:\"Y-m-d H:i\";s:11:\"date_custom\";s:0:\"\";}s:22:\"cck:field_eleje:value2\";a:3:{s:8:\"timezone\";s:15:\"Europe/Budapest\";s:11:\"date_format\";s:9:\"Y-m-d H:i\";s:11:\"date_custom\";s:0:\"\";}}', 0, 0, 0, 0) in /www/data/intranet/includes/common.inc on line 3467.
What can be the problem?
Comment #118
oadaeh CreditAttribution: oadaeh commented@tttimi: The error you are getting has nothing to do with this issue. Your query for adding a data source is including the 'file_offset' column that is not in the 'node_import_tasks' table of your database. My first guess would be that the Node Import module did not get installed correctly on your site. Try disabling /and/ uninstalling the module, then try reinstalling it. If you get any errors, stop and resolve them first. if not, try importing again and see if it works. If not, then you'll have to resolve that problem in another issue.
Comment #119
mvcfor what it's worth, patch #89 worked for me after i applied this patch to node_import.inc, which accepts a wide range of date formats using php's strtodate().
Comment #120
osu_bucks CreditAttribution: osu_bucks commentedI'm getting the following errors when I import csv with date format: 8/24/2009 from csv. Will #89 fix my issue? I'm currently using 6.x-1.x-dev 2010 Feb-06, will I need to revert back to rc4 to apply the patch? Sorry... I'm a newbie with Drupal :)
warning: date_offset_get() expects parameter 1 to be DateTime, null given in /home/public_html/test.com/public/sites/all/modules/date/date/date_elements.inc on line 495.
warning: date_offset_get() expects parameter 1 to be DateTime, null given in /home/public_html/test.com/public/sites/all/modules/date/date/date_elements.inc on line 498.
warning: date_offset_get() expects parameter 1 to be DateTime, null given in /home/public_html/test.com/public/sites/all/modules/date/date/date_elements.inc on line 499.
warning: date_offset_get() expects parameter 1 to be DateTime, null given in /home/public_html/test.com/public/sites/all/modules/date/date/date_elements.inc on line 501.
Comment #121
dom_b CreditAttribution: dom_b commentedSame issue. My date input is absolutely correct but always get the same error.
Comment #122
sunny.oxide CreditAttribution: sunny.oxide commentedPatch in #89 works for me in 6.x-1.x-dev as of 2010 March 5th. Hope it gets into -dev soon.
Comment #123
rickmanelius CreditAttribution: rickmanelius commentedI've tried various combinations of all patches given... but I still get the "illegal" warning despite trying 6 hours of input and custom field variations. As soon as I turn off the date module, node imports work. If I do a to AND from date... I get 2 illegal warnings.
I'm using the very latest version of date, node import, and the patches listed above.
Comment #124
erwin k CreditAttribution: erwin k commentedUsed the date.inc from #89, used it as describe in #3
Options used:
-no column names
-semicolon sep. values
-custom format for date field
All rows and columns were imported, of which one column with a custom j/m/Y format
(and not relevant here, but still, one column with title of nodereference field)
Comment #125
geerlingguy CreditAttribution: geerlingguy commentedPatch should still be made against -dev version.
Comment #126
twooten CreditAttribution: twooten commentedMy CSV file has dates like "2003-10-01 08:17:49". I am attaching the error I keep getting. I am using the simple Date field type with select list.
Also using node_import-6.x-1.x-dev
Any ideas why it is giving me an error about the format?
Comment #127
oadaeh CreditAttribution: oadaeh commentedTry specifying a custom date format of "Y-m-d H:i:s" in the date configuration area of your import process. (I don't remember the name of the area, and I no longer have it available.)
The format of your data needs to match the format of your content type, which needs to match the format of the import.
Comment #128
erwin k CreditAttribution: erwin k commentedre #125, sorry about that, saw only now that what I did changed the issue's overall values.
Comment #129
jday CreditAttribution: jday commented#89 applied to dev worked for me with the exception of rows with single or empty date values, so I had to split my cvs file into three separate imports
1. rows with to and from dates
2. rows with only start dates
3. rows with blank date fields
Comment #130
rukaya CreditAttribution: rukaya commented#89 worked for me with dates in a 'Y-m-d' format, ie 2010-03-29. I was using a cck date field in content_profile, the date field was a custom input one, 'text field with custom input format'. I had to change :
if (($date = date_convert_from_custom($value, $input_format))) {
// It is useless to check for date_is_valid() as it is a DATE_DATETIME already.
$value = date_convert($date, DATE_DATETIME, $output_format, $timezone);
return TRUE;
}
to
if (($date = date_convert_from_custom($value, $input_format))) {
// It is useless to check for date_is_valid() as it is a DATE_DATETIME already.
// $value = date_convert($date, DATE_DATETIME, $output_format, $timezone);
$value = date_convert(strtotime($date), DATE_DATETIME, $output_format, $timezone);
return TRUE;
}
in node_import.inc, though.
Comment #131
Aren Cambre CreditAttribution: Aren Cambre commentedComment #132
d.cox CreditAttribution: d.cox commentedThe file from #89 with latest dev release March 20, 2010, and also setting my Date CCK field to "YYYY-MM-DD - 00:00:00" worked for me.
Comment #133
andrewfn CreditAttribution: andrewfn commentedAfter many frustrating hours, and final success, I thought it might be worth sharing my discoveries:
YYYY-MM-DD hh:mm
to be the most trouble-freeHope that helps somebody.
Comment #134
edg CreditAttribution: edg commentedCustom dates worked with date.inc file (#89) installed in rc4, although I did have to have to set up the CCK field in my content type to YYYY-MM-DD HH:MM:SS as recommended above by KarenS. Thanks all for posting!
Comment #135
lee20 CreditAttribution: lee20 commentedSubscribing. I was able to get #89 to work with the suggestions from #133.
Comment #136
Cyberwolf CreditAttribution: Cyberwolf commenteddate.inc of #89 did the job here as well, with input format YYYY-MM-DD hh:mm, no to-date.
Comment #137
dandaman CreditAttribution: dandaman commentedLike lee20 said, I was able to get #89 to work with the suggestions from #133. Very helpful.
Comment #138
seaneffel CreditAttribution: seaneffel commentedSeems like a couple of people reporting back success with the help of the .inc file in #89 and the tips in #133.
I'm marking this as RTBC and now let's hope for some sweet maintainer lovin'.
Comment #139
linneawilliams CreditAttribution: linneawilliams commentedDitto with #133.
I installed the most recent development version of node import and the file in #89, which I have gotten to work.
DATE FORMATTING:
in the csv file:
I'm using a "MM/DD/YYYY - HH:MM" in php it's "m/d/Y - H:i" format. (be sure to use a hyphen, not a dash, which Open Office will sneak in while you aren't looking).
in node import:
the same format is also the default.
in the field settings:
be sure that you are importing values that you have allowed.
Some examples: if the field is set to have no seconds, don't try to import seconds. if the minutes are allowed in 5min increments, don't try to import a date with time 12:33. If the field is set to have dates +3 or -3 years, don't try to import a date that's 20 years ago. These all triggered the good ol' "An illegal choice has been made. Please, contact the site administrator."
Hope this helps others who are struggling. You can do it!
Comment #140
geerlingguy CreditAttribution: geerlingguy commentedFor those using Excel to message the data, you will need to set the date column to use the following custom format (under Format > Cells...):
mm/dd/yyyy - hh:mm
You'll also need to save as Windows CSV rather than plain-vanilla CSV.
I'm still getting:
Fatal error: Cannot unset string offsets in /home/archstl/public_html/sites/all/modules/date/date_repeat/date_repeat_form.inc on line 212
Here's the line from date_repeat_form.inc:
if (array_key_exists('BYDAY', $form_values)) unset($form_values['BYDAY']['']);
I configured the date field to use the exact same format as the imported values (MM/DD/YYYY HH:MM) with 24-hour timestamps, and it's still not working for me :(
Could it be that I have optional 'To' dates and optional repeat options allowed for this date field?
[Edit: I was finally able to get everything working together, after a lot of tinkering; I had to add the dash to separate the date from the time, and set the date field to use a select list instead of the date popup... I think this patch should try to account for differing settings if at all possible; this is not user-friendly :-(]
Comment #141
chadhester CreditAttribution: chadhester commentedWorking with this right now... I have a ton of dates that use Unix Timestamp values. What I'll likely do is scrub the data in Excel (ack!), and prep the dates using a formula like:
Which yields something like "2010-05-26", where cell "K2" is a Unix Timestamp value. Note that I don't need the time portion, so I intentionally do not include this.
Otherwise I would use this:
Which yields something like "2010-05-26 15:34".
Hopefully this helps someone as much as it helped me. :)
Comment #142
nally CreditAttribution: nally commentedWhat if all my nodes for import have To parts to the Date field. Has anyone had success where every row has a range? (wish me luck!)
Comment #143
Rob_Feature CreditAttribution: Rob_Feature commentedAfter reading all the issues above, and trying every possible combination, it seems that there is one thing that hasn't been fixed in all of this (unless I missed it):
I have 'to date' as 'optional'. Some of my imports have a to date, and some do not. Any record with a blank 'to date' gives me "An illegal choice has been detected. Please contact the site administrator." while any record that has a 'to date' imports fine.
Notes:
To clarify, has anyone had optional 'to date' (in which some records have one, and some don't) work on import? I know my date formatting must be correct because other records (with a 'to date' record) work fine.
Comment #144
dystopianblue CreditAttribution: dystopianblue commentedFor those who are receiving the "An illegal choice has been detected. Please contact the site administrator." message and are trying to import a blank date or a date that doesn't have a "to date" value, try editing date.inc from #89 so that the array on line 205 contains only null values:
That seems to fix the problem for me.
Comment #145
Encarte CreditAttribution: Encarte commentedsubscribing
Comment #146
nwe_44 CreditAttribution: nwe_44 commentedsubscribing
Comment #147
agerson CreditAttribution: agerson commentedI would like to confirm that #44 combined with #112 do fix the issue with :00 minutes.
However, when I switched my CCK date field from select back to pop up, it wiped out all the dates.
Would it not be wise to break these date realted issues up into smaller chunks? It appears as if there are many separate problems with date that could be better tackled with separate issues. The module maintainer could create a separate "component" for date related issues to keep them all grouped together.
Comment #148
anonymous07 CreditAttribution: anonymous07 commentedSubscribe
UPDATE: SOLVED! With the hints in this very thread.
Here is the road map:
Good outline in this post: http://drupal.org/node/464114#comment-2558762 + Disable Date Popup =
Solved it for me
I am using Node_Import + CCK + Date + Scheduler + Rules to Import Nodes that will be published and unpublished on dates provided in the CSV. This all worked perfectly in D5.
It DOES work now in D6 for me using the above road map
Still some relatively minor issues:
1) Still get error during the import process (even though it DOES finish successfully) -
See: http://drupal.org/node/836360
and in the log it is,
it is due to some extra spaces in the PHP code that I have not found, see: http://drupal.org/node/128832
2) Still have to change the Date Custom Format for every import from the default m/d/Y H:i
3) Publish on Dates in the past are changing to 1969-12-31 20:33:30; right now I don't care as long as this does not happen to Publish on dates that are in the future
4) I just have figure out how to now change Meta tags while using Nodewords which used to work fine in D5
Comment #149
locomo CreditAttribution: locomo commentedsubscribe
Comment #150
dcomfort CreditAttribution: dcomfort commentedI was having similar issues importing dates into a CCK field. I tried different combos of formats. A simple solution turned out to be changing the date field to a select list and the import goes through fine.
Comment #151
el56 CreditAttribution: el56 commentedSubscribe
Comment #152
lentreprenaute CreditAttribution: lentreprenaute commentedA simple solution turned out to be changing the date field to a select list and the import goes through fine.
So i dont' know why, i wasn't enable to import Date but i changed the field format to select list like say Dcomfort... with succes.!!! Thank.
Flo
Comment #153
yanosz CreditAttribution: yanosz commentedHi,
same problem here. However, I was not able to circumvent it, as described above. (dev release, 2010-Jul-11)
Is there a another way to import date / time fields?
Comment #154
bmango CreditAttribution: bmango commentedsubscribe
Comment #155
Aren Cambre CreditAttribution: Aren Cambre commentedPer above comments, new patch needed that addresses some problems.
Comment #156
Junro CreditAttribution: Junro commentedDid you tried the Feed module to import nodes? http://drupal.org/project/feeds
It seems to be much more powerful and it's well maintained.
Comment #157
Marko B CreditAttribution: Marko B commentedsubs
Comment #158
NaX CreditAttribution: NaX commentedI was getting the follow errors when trying to do an import of nodes with 2 date fields using a custom format using UTC.
- PHP date module function errors as described in #120
- Optional empty dates = An illegal choice has been detected. Please contact the site administrator.
I took the date.inc file from #89 and incorporating the historical dates fix from #92 and reformatted it to be more in-line with Drupal coding standard.
And all my errors disappeared.
Thanks to everyone that worked on this.
I also tried the fix suggested at #108, but this did not resolve any of my errors.
Attached is my date.inc file.
Hope it helps.
Comment #159
Hummad CreditAttribution: Hummad commentedI am using the date.inc as described in # 158 and the getting the following error in the Preview import (step 7 of 8) and of-course the required file is there:
Upload a file first.
values = Array
(
[created] =>
[node_import_build_mode] => 1
[title] => ENGRO
[cck:field_openrate:value] => Array
(
[0] => 98
)
[type] => price
[cck:field_highrate:value] => Array
(
[0] => 0
)
[cck:field_closerate:value] => Array
(
[0] => 98
)
[cck:field_volume:value] => Array
(
[0] => 0
)
[cck:field_trandate:value] => Array
(
[0] => 1991-01-01
)
[cck:field_lowrate:value] => Array
(
[0] => 0
)
[cck:field_tot_ret_price:value] => Array
(
[0] => 7.51
)
[cck:field_adjust_price:value] => Array
(
[0] => 14.98
)
[cck:field_symbol:value] => Array
(
[0] => ENGRO
)
[uid] => 1
[revision] => 0
[log] => Imported with node_import.
[sticky] => 0
[status] => 1
[promote] => 0
[path] =>
[name] => admin
[taxonomy] => Array
(
)
[field_openrate] => Array
(
[0] => Array
(
[value] => 98
)
)
[field_highrate] => Array
(
[0] => Array
(
[value] => 0
)
)
[field_closerate] => Array
(
[0] => Array
(
[value] => 98
)
)
[field_volume] => Array
(
[0] => Array
(
[value] => 0
)
)
[field_trandate] => Array
(
[0] => Array
(
[value] => 1991-01-01
)
)
[field_lowrate] => Array
(
[0] => Array
(
[value] => 0
)
)
[field_tot_ret_price] => Array
(
[0] => Array
(
[value] => 7.51
)
)
[field_adjust_price] => Array
(
[0] => Array
(
[value] => 14.98
)
)
[field_symbol] => Array
(
[0] => Array
(
[value] => ENGRO
)
)
[op] => Preview
Comment #160
d.cox CreditAttribution: d.cox commented#158 I though worked, but now I'm getting the "An illegal choice has been detected. Please contact the site administrator".
Log is saying "Illegal choice 18 in Hour element."
Comment #161
Hummad CreditAttribution: Hummad commentedThe mentioned "Upload a file first" was due to conflict with Feeds Module. Once Feeds was un-installed and resolution of # 158 worked fine and the nodes are being imported.
Comment #162
boran CreditAttribution: boran commented#158 worked for me
Comment #163
Renee S CreditAttribution: Renee S commented#158 Worked for me. Thanks.
Comment #164
geerlingguy CreditAttribution: geerlingguy commentedI've tried #158, and I'm still getting the same error I got in #140:
Fatal error: Cannot unset string offsets in /home/archstl/public_html/sites/all/modules/date/date_repeat/date_repeat_form.inc on line 212
This error only goes away if I change the date field's input widget to a simple text field with custom input format.
Comment #165
benone CreditAttribution: benone commented@NAX from #158: THANK YOU!
Comment #166
oldmoonlake CreditAttribution: oldmoonlake commentedused the latest 6.x-1.x-dev as 11th, July and date.inc from #158, everything works like a charm. Thanks.
Comment #167
vadym.kononenko CreditAttribution: vadym.kononenko commentedlatest 6.x-1.x-dev and date.inc from #158. All works correctly too.
Field widget - text field with popup calendar
Comment #168
bibo CreditAttribution: bibo commented#158 works. Commit this please?
Comment #169
monotaga CreditAttribution: monotaga commentedThe changes in #158 http://drupal.org/node/374346#comment-3566770 seem to work for me at this point, too.
I've created a patch based on the changes in #158.
Comment #170
lukusThe changes in #158 worked for me as well.
Comment #171
nicknickoli CreditAttribution: nicknickoli commented#158 did not work for me with select-list date fields. I updated to dev releases on the date and node_import modules. The patch changed an "Illegal choice 0 in Second(minutes, hour) element" to "Minute (hour, month, day, year) field is required."
My date from the debug or csv is 2010-10-15 00:00. It would help me debugging to access #post values directly. I'm not seeing them in any hooks if validation fails?
Comment #172
Aren Cambre CreditAttribution: Aren Cambre commentedComment #173
naero CreditAttribution: naero commentedI had an issue importing a custom date format into a CCK date field "Published", error message read:
I took suggestion #22 into account, switched my CCK field's widget from "popup date selector" to a select field, and this worked. After my import, I switched it back to the popup selector.
Comment #174
daniel-san CreditAttribution: daniel-san commentedWas having difficulty with node import giving errors on date format for cck field using datetime. We would get errors for invalid format over and over no matter how we adjusted the date format on the import.
Applied patch from #169 and imported all of the event nodes with dates successfully.
Thank you for the work on this.
Dan
Comment #175
twowheeler CreditAttribution: twowheeler commentedWorks for me as well. Nice work.
Comment #176
Robrecht Jacques CreditAttribution: Robrecht Jacques commented#156 commited.
Comment #178
roshan_pant CreditAttribution: roshan_pant commented*********Useing node import from excel file -----step by step---****************************
# Modules
* cck
* node import
* token
* date API
# To Rememmber
* Use Always Date ISO format - yyyy-mm-dd or yyyy-mm-dd hh:mm:ss
* Make sure your CSV file has same date format
# Create Content Type
* i had problem while using jQuery_ui module and Date Popup for pop up calendar so i suggest that don't use it.
* select type 'date' of your content type.
* i suggest select operation 'select type'.
# Create your conntent
Thank You
From: roshan.pant@gmail.com
******************************************End************************************
Comment #179
Encarte CreditAttribution: Encarte commentedComment #180
Uv516 CreditAttribution: Uv516 commentedThe problem is not solved.
The issue is the date.inc file, line 145: $widgetFormatPieces = explode(' - ', $widgetFormat, 2);
The line is assuming only that the widget between date and time is ' - '.
The administrator is allowed to create other datetime formats with other widgets. Sometime I use 'd-m-Y, H:i'. That would not be solved correct in line 145 because of ', ' instead of ' - '.
Many datetime formats uses d-m-y H:i (with just one space).
Instead of line 145 ($widgetFormatPieces = explode(' - ', $widgetFormat, 2);) I have inserted this:
This will allow datetime formats of this:
Could someone make a better solution to allow other possible delimiters between [date] and [time]?
Perhaps someone could make a patch? (I can't)