You are here

function salesforce_mapping_object_table_form_submit in Salesforce Suite 7.3

Submit handle for the bulk operations form.

File

modules/salesforce_mapping/includes/salesforce_mapping_object.admin.inc, line 485

Code

function salesforce_mapping_object_table_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  if ($values['operations'] && count($values['entities']) > 0) {

    // @TODO switch to using the Batch API for processing.
    foreach ($values['entities'] as $value) {
      list($mapping_id) = explode('-', $value);
      $mapping = entity_load_single('salesforce_mapping_object', $mapping_id);

      // Set entity_updated to now to ensure push occurs.
      $mapping->entity_updated = REQUEST_TIME;
      $wrapper = entity_metadata_wrapper('salesforce_mapping_object', $mapping);
      salesforce_push_entity_crud($mapping->entity_type, $wrapper->entity
        ->value(), SALESFORCE_MAPPING_SYNC_DRUPAL_UPDATE);
    }
  }
}