/** * Function to process the form * * @access public * @return None */ function postProcess() { if ($this->_action & CRM_CORE_ACTION_VIEW) { return; } if ($this->_action & CRM_CORE_ACTION_DELETE) { CRM_Core_BAO_Meeting::del($this->_id); CRM_Core_Session::setStatus(ts("Selected Meeting is deleted sucessfully.")); return; } // store the submitted values in an array $params = $this->controller->exportValues($this->_name); $ids = array(); $dateTime = $params['scheduled_date_time']; $dateTime = CRM_Utils_Date::format($dateTime); // store the date with proper format $params['scheduled_date_time'] = $dateTime; // store the contact id and current drupal user id $params['source_contact_id'] = $this->_userId; $params['target_entity_id'] = $this->_contactId; $params['target_entity_table'] = 'civicrm_contact'; //set parent id if exists for follow up activities if ($this->_pid) { $params['parent_id'] = $this->_pid; } if ($this->_action & CRM_CORE_ACTION_UPDATE) { $ids['meeting'] = $this->_id; } $meeting = CRM_Core_BAO_Meeting::add($params, $ids); CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $params); // do the updates/inserts CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, 'Meeting', $meeting->id); if ($meeting->status == 'Completed') { // we need to insert an activity history record here $params = array('entity_table' => 'civicrm_contact', 'entity_id' => $this->_contactId, 'activity_type' => ts('Meeting'), 'module' => 'CiviCRM', 'callback' => 'CRM_Activity_Form_Meeting::showMeetingDetails', 'activity_id' => $meeting->id, 'activity_summary' => $meeting->subject, 'activity_date' => $meeting->scheduled_date_time); if (is_a(crm_create_activity_history($params), 'CRM_Core_Error')) { return false; } } if ($meeting->status == 'Completed') { CRM_Core_Session::setStatus(ts('Meeting "%1" has been logged to Activity History.', array(1 => $meeting->subject))); } else { CRM_Core_Session::setStatus(ts('Meeting "%1" has been saved.', array(1 => $meeting->subject))); } }