You are here

function sf_notifications_check_condition in Salesforce Suite 6.2

Helper function to check condition of a fieldmap. Adapted from drupal_eval() since we need to pass a couple variables along to the eval() call.

1 call to sf_notifications_check_condition()
_sf_notifications_handle_message in sf_notifications/sf_notifications.module
Loop through an array of SObjects from SalesForce and save them according to any existing sf fieldmaps, notification settings, and data.

File

sf_notifications/sf_notifications.module, line 343

Code

function sf_notifications_check_condition($operation, $notification_data, $map) {
  $settings = variable_get('sf_notifications_settings', array());
  $setting = $settings[$map->name];
  if (empty($setting['condition'])) {
    return TRUE;
  }
  $code = $setting['condition'];
  unset($setting, $settings);
  ob_start();
  print eval('?><?php ' . $code);
  $output = ob_get_contents();
  ob_end_clean();
  return $output;
}