When event is dragged and dropped to a new date on Fullcalendar, the Drupal node updates, but the CiviEvent date remains unchanged. Is this expected behavior? Thanks!

Comments

kreynen’s picture

Status: Active » Needs work

The Drupal node is not getting updated... the civicrm_multiday_session field in the field_collection entity is updated. The link to CiviCRM is in the hook_node_presave().

http://drupalcode.org/project/civicrm_multiday_event.git/blob/refs/heads...

I need to add some code to force a node_save when the entity is updated. Will update later today.

bcobin’s picture

You rock - thanks.

kreynen’s picture

This is actually turning out to be more complicated than I thought because of...

#1275686: FullCalendar drag-and-drop doesn't trigger node_validate()

bcobin’s picture

AHA! Nice sleuthing..

Even without the drag and drop feature, the module is still cooler thank anything. I will stay tuned... thanks!

kreynen’s picture

Status: Needs work » Needs review
bcobin’s picture

Thanks, Kevin - yes, the date changes... but so does the title! It re-saves the title as per your specified protocol.

So node_save is working at least! Nice work...

kreynen’s picture

Sorry. There is now an option in the config to control how the title updates.

bcobin’s picture

Status: Needs review » Reviewed & tested by the community

Client reported the date didn't change, but it checks out fine for me... great work!

You are a true rockstar.

Calendar looks awesome - expect to launch the site Monday and will report back. Have a great weekend!

bcobin’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta3
Status: Reviewed & tested by the community » Needs work

Drag and drop is no longer working after beta3 update. Tried clearing caches, all the usual. Drat!

To elaborate: there used to be a .js alert that appears at the top of the screen advising the change had been saved - that no longer appears and the change isn't saved.

kreynen’s picture

Is there an error in Admin -> Reports -> Recent log messages?

I don't think I'm doing anything that's core version specific, but what version of core, FullCalendar, and FieldCollection are you using?

bcobin’s picture

Is there an error in Admin -> Reports -> Recent log messages?

Yes, actually:

Warning: rename(,/home/[site]/public_html/sites/default/files/civicrm/custom/) [function.rename]: No such file or directory in CRM_Core_BAO_CustomField::formatCustomField() (line 1650 of /home/suffolk/public_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomField.php).

Versions are:

Core 7:15, FullCalendar 7.x-2.0-rc1 (this is a recent update - like yesterday - about when drag and drop stopped working, in fact) and Field collection 7.x-1.0-beta4.

bcobin’s picture

Reviving this after a long hiatus to try to get CCMDE working again - CiviEvent date does not update with latest FullCalendar version. Suggest disabling drag and drop in FullCalendar view settings for admin calendar until this gets sorted.

bcobin’s picture

Gradually sorting out issues here and I'm wondering if this has something to do with custom fields. Same error results when trying to create Drupal nodes via CiviEvent ID as reported at http://drupal.org/node/1856408

Unfortunately, the custom fields I'm using in CiviEvent can't be removed without losing important data, so I can't easily test this. The beat goes on...

kreynen’s picture

Title: Drag and drop calendar does not update CiviEvent » Drag and drop calendar does not update when custom fields are added to CiviEvent

This is likely a CiviCRM version issue. I made some notes about this in the code.

http://drupalcode.org/project/civicrm_multiday_event.git/blob/refs/heads...

/**
 * Lookup CiviCRM Event by ID.
 */
function civicrm_multiday_event_lookup($id, $is_template = NULL) {
  // API DOES NOT RETURN TEMPLATES in 4.1 W/O http://issues.civicrm.org/jira/browse/CRM-10540  
  // We attempt to load template using the API, if that doesn't work we use a custom
  // function, but that doesn't not return everything the API does
    
  if (!civicrm_initialize()) {
    drupal_set_message(t('Failed to initialize CiviCRM'));
    return;
  }
  
  $params = array();
   
  $params['version'] = 3;
  $params['sequential'] = 1;
  $params['id'] = $id;
  $params['is_template'] = $is_template;
  $result = civicrm_api("Event", "get", $params);
  
  if ($result['is_error'] || !$result['count']) {
    $params = db_query('SELECT * FROM {civicrm_event} WHERE id = :id', array(':id' => $id))->fetchAssoc();
  } else {
    $params = $result['values'][0];       
  }
  
  // priceset_id is not returned by the API nor will the API added it, so we are manually 
  // inserting the priceset after the event. Need to get this fixed in 4.2
    
  require_once 'CRM/Price/BAO/Set.php';
  $params['price_set_id'] = CRM_Price_BAO_Set::getFor( 'civicrm_event', $id ); 
  
  return $params; 
}
bcobin’s picture

Currently running 4.2.4 - do you think an upgrade to 4.2.6 might do the trick? In any event, it's time, although I don't think I can get to it before the weekend. Will report back... thank you eversomuch...

bcobin’s picture

Version: 7.x-1.0-beta3 » 7.x-1.x-dev

OK - I did the upgrade to 4.2.6 - no change. Again, here's the error message that arrears in the logs (there's no error indication on the page), this time with the location and referrer:

LOCATION http://[site]/fullcalendar/ajax/update/drop/85

REFERRER http://[site]/admin/civicrm-multiday-events/manage

MESSAGE Warning: rename(,/home/[site]/public_html/sites/default/files/civicrm/custom/) [function.rename]: No such file or directory in CRM_Core_BAO_CustomField::formatCustomField() (line 1650 of /home/[site]/public_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomField.php).

Cleared all caches, etc. Any ideas here? Will disable drag-and-drop for admin calendar for now and will not try to create Drupal nodes from existing CiviEvents... thanks!

bcobin’s picture

Status: Needs work » Reviewed & tested by the community

Drag and drop now seems to work with beta4 - great! Setting this to reviewed and tested by the community - thanks much!

coderdan’s picture

Status: Reviewed & tested by the community » Fixed

Cleaning up the issue queue.

Status: Fixed » Closed (fixed)

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