I created content type with date CCK field to use in signup. To support event preparation workflow, I configured this field so it can be left empty (required checkbox not ticked). That allows an editor to create an event entry as a proposal (without a date), have a workflow around it (like group review, approval, date confirmation, etc.).
I expect signup.module to disable signups for all nodes that have date not entered yet, but it still tries to show such nodes, links to signup, etc. A bigger problem is that it spews a bunch of warnings:
warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /sites/all/modules/signup/includes/date.inc on line 488.
warning: date_modify() expects parameter 1 to be DateTime, null given in /sites/all/modules/signup/includes/date.inc on line 491.
warning: date_format() expects parameter 1 to be DateTime, null given in /sites/all/modules/signup/includes/date.inc on line 492.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | signup.empty_date20090815.patch | 503 bytes | iva2k |
Comments
Comment #1
iva2k commentedI tracked code responsible for warnings to function _signup_date_node_completed () in file includes/date.inc:
The fix is to add the following statement right after the above code:
(Please let me know if you'd rather have a patch file)
Comment #2
iva2k commentedThe above fix also applies to CVS HEAD.
Comment #3
dwwYes, a real patch would be lovely.
However, I'm not sure I'm sold on this approach. This seems like a band-aid over a deeper wound. If you have a node type configured where signup thinks a specific field holds the start date, but that field isn't required and you can effectively have untimed nodes, _signup_node_completed() isn't the only place you're going to have trouble.
It seems like a better fix is in _signup_date_get_node_scheduler(). In fact, that's already trying to handle this case, it just seems to be doing it wrong. ;) Anyway, that's the function to look at. If the node is configured with a CCK field as its signup start time, but that field is empty, _signup_date_get_node_scheduler() should return 'none', not 'date'. Then, in theory, none of the rest of this should be happening.
Comment #4
iva2k commentedThanks for the pointer. Will the below change (line 4) alone to includes/date.inc do the trick?
Was:
New:
Comment #5
dwwpatches, please! ;)
I'm a little worried about hard-coding [0] in there, but I guess signup doesn't handle multi-valued date fields right now, anyway.
Better would be something like:
Someone would have to actually test this and inspect the relevant data structures to make sure that's all right, but it seems clearer to just do the full check in one step instead of the nested thing you've got.
Comment #6
iva2k commentedHere's the patch. Please review.
Comment #7
mattyoung commentedI am getting maybe the same errors:
However, my datetime field for signup is required so it's set to something for sure.
Comment #8
snorkers commentedI'm seeing this too, but only since RC6. (had created new entry as hadn't spotted issue due to slightly misleading title #588046: Error if Date Field Null for content type that is Signup-enabled). My comment as below:
I have a content type Course that has an optional start/end date/time, and the content type is enabled for signup, but is also optional.
I had no problems with previous releases, but in the latest update (6.x-1.0-rc6) I get the following error for a new Course node with no date/time values set (ie, using Blank default values), regardless of whether signup is enabled/disabled for this node:
If a start date/time is entered, the error does not appear. This error only appears on initial create; subsequent edit/save operations do not generate this error. Time zone handling is set to Site's time zone.
Comment #9
dww@mattyoung and @snorkers: Does the patch in #6 help?
Comment #10
snorkers commentedJust rolled the patch at #6 against RC6 and the error is gone. Thanks @iva2k and @dww :)
Apologies - hadn't tried the patch as I thought this was an RC6-emergent issue only.
Comment #11
steveparks commentedI too have tested the patch at #6 against rc6, and it makes these errors go away, without any apparent side effects.
Comment #12
OliverColeman commented#6 seems to work for me, thanks!
Comment #13
OliverColeman commentedWell, after fixing this problem, I discovered why it was now popping up in the first place (after upgrading to rc6): Signup was preventing any CCK fields being saved for any new nodes. So for any one turning up here with the same problem, see the issue (with patch) over at #605594: node_load() during signup's node_save() breaks node data cached by CCK.
Comment #14
iva2k commentedSo 3 people tested patch in #6 already, have warnings gone and no side effects. Bumping to "reviewed & tested by the community".
Comment #15
karens commentedI can also confirm this fix is needed and it works.
Comment #16
bibo commentedWorks for me too! Commit this please.
Comment #17
Mac Clemmens commentedConfirmed. Patch #6 resolved my issue. Agree with KarenS; ready to commit.
Comment #18
d.cox commentedConfirm here also patch #6 solved my issue also.
My issue was slightly different as I have a multilingual site.
When a node is created, using i18n_auto to create the draft nodes in the other enabled languages, I would receive the error. Even though the date is past to the nodes with the CCK translation and Synchronize translations modules.
Comment #19
tomogden commentedI wish I could say the same, but I have RC6 installed (Signup 6.x-1.0-rc6), and I still get the warnings, and my date field goes to NULL.
warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /sites/all/modules/signup/includes/date.inc on line 485.
warning: date_modify() expects parameter 1 to be DateTime, null given in /sites/all/modules/signup/includes/date.inc on line 488.
warning: date_format() expects parameter 1 to be DateTime, null given in /sites/all/modules/signup/includes/date.inc on line 489.
warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /sites/all/modules/signup/includes/date.inc on line 485.
warning: date_modify() expects parameter 1 to be DateTime, null given in /sites/all/modules/signup/includes/date.inc on line 488.
warning: date_format() expects parameter 1 to be DateTime, null given in /sites/all/modules/signup/includes/date.inc on line 489.
Comment #20
dww@tomogden: rc6 doesn't contain the fix. Did you apply the patch in comment #6 above?
Comment #21
tomogden commentedMy misunderstanding, sorry. Confused between RC6 and Patch 6.
Comment #22
ezra-g commentedThis is committed. Thanks!
http://drupal.org/cvs?commit=470414
Comment #23
ezra-g commented