When trying to deploy an 'event' node which contains two date cck fields I get the following error in the logs

First parameter must either be an object or the name of an existing class in /var/www/html/drupal-6/sites/all/modules/deploy/modules/date_deploy/date_deploy.module on line 45.

When trying to do the operation I also get this failed error message from the Deployment module

There are errors in Event Start:The dates are invalid.

I have deployed a basic 'page' successfully but the date cck stuff fails.

Any help would be great!

Thanks,

md2

CommentFileSizeAuthor
#7 date_deploy.patch1.61 KBAnonymous (not verified)
#2 deploy_date.diff2 KBnatmchugh

Comments

Anonymous’s picture

It looks like the node passed into function date_node_deploy(&$node) has an nid of NULL, so node_load() fails, and then property_exists() fails.

natmchugh’s picture

StatusFileSize
new2 KB

Ok I had this issue and managed to fix it with the attached patch. I found 2 separate problems.

1) Node deploy was getting called with the remote node id therefore why it was NULL for heckacopter213. I have added an extra prameter to the invocation of hook_node_deploy to add in the local nid allowing adding the correct date valuess.

2) date_deploy_get_date_fields was not finding my date fields as they were of type datetime not date. I have added datetime to the list of field types considered dates.

Other than this the module works really well

Anonymous’s picture

First of all, thanks for the patch!

Unfortunately, it's not working quite right for me, but I'm probably an edge case. After applying the patch, the error went away, but I get empty date values on my destination server. I am using a date with start and end dates. I can see it's being passed over the wire like so:

<member><name>field_check_point_date</name><value><array><data>
  <value><struct>
  <member><name>value</name><value><struct>
  <member><name>year</name><value><int>2009</int></value></member>
  <member><name>month</name><value><int>12</int></value></member>
  <member><name>day</name><value><int>3</int></value></member>
  <member><name>hour</name><value><int>0</int></value></member>
  <member><name>minute</name><value><int>30</int></value></member>
  <member><name>second</name><value><int>0</int></value></member>
</struct></value></member>

But nothing is saved on the destination server for field_check_point_date. Any clues?

Thanks!

Anonymous’s picture

I've implemented a fix that pushes all date values across the wire (value and value2), but it's still not saving for some reason. Hopefully I get it figured out and I'll post my patch.

gdd’s picture

So there are two issues here. One is the problem shown in #2, which needs to be fixed although I'll probably do it slightly differently.

The second is that Date fields are extremely hard to deal with through drupal_execute() (which is what Services uses.) This is related to the fact that values coming through FAPI are reliant on widget settings, and Date has a wide array of widget and value combinations. Currently Date is only tested with Date field types using select widgets. To see how harsh this is refer to this thread form the Node Import module where they are fighting similar problems

#374346: Can't import date values into Date module fields

I've opened a new issue related to Date fields in Deploy for the record (#655964: Some combinations of Date field widgets don't work) and if anyone wants to start chasing this problem that is fine, but I am not going to be spending much time trying to sort all that out for the time being. It's just too gnarly and I've got other problems to solve.

gdd’s picture

Status: Active » Fixed

Here is the patch I ended up committing. In order to manage the node->nid problem, I simply moved the code which replaces client nid with server nid to after the hook_deploy() call. This has the advantage of not changing any existing function signatures and just makes sense regardless.

Thanks!

Anonymous’s picture

StatusFileSize
new1.61 KB

Heyrocker, thanks. I changed my widget to select list on the destination server and now it works fine.

I'm attaching a patch to date_deploy that picks up end-dates as well as start dates.

Anonymous’s picture

I'm sure this is a bug in services, but if you leave minute set to 00, you get an error that "Illegal choice 0 in field_check_point_date element." If you set it to '00' in a debugger, it goes through fine.

I fixed it in date_deploy with the following:

if ($node->{$field_name}[$key][$date_key]['minute']) $node->{$field_name}[$key][$date_key]['minute'] = $date_parts['minute'];

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sagar ramgade’s picture

Hi,
I tried the patch above and suggestion comment #8, i am trying to deploy it with datetime and it is not working.
Obviously it is stated in the documentation that it won't work. Can anyone help in this.

Regards
Sagar

snehi’s picture

Any progress on this issue