/** * Function to process the form * * @access public * @return None */ function postProcess() { if ($this->_action & CRM_CORE_ACTION_DELETE) { CRM_Contact_BAO_RelationshipType::del($this->_id); CRM_Core_Session::setStatus(ts('Selected Relationship type has been deleted.')); } else { $params = array(); $ids = array(); // store the submitted values in an array $params = $this->exportValues(); $params['is_active'] = CRM_Utils_Array::value('is_active', $params, false); if ($this->_action & CRM_CORE_ACTION_UPDATE) { $ids['relationshipType'] = $this->_id; } CRM_Contact_BAO_RelationshipType::add($params, $ids); CRM_Core_Session::setStatus(ts('The Relationship Type has been saved.')); } }
/** * Function to process the form * * @access public * @return None */ public function postProcess() { if ($this->_action & CRM_Core_Action::DELETE) { CRM_Contact_BAO_RelationshipType::del($this->_id); CRM_Core_Session::setStatus(ts('Selected Relationship type has been deleted.')); } else { $params = array(); $ids = array(); // store the submitted values in an array $params = $this->exportValues(); $params['is_active'] = CRM_Utils_Array::value('is_active', $params, false); if ($this->_action & CRM_Core_Action::UPDATE) { $ids['relationshipType'] = $this->_id; } $cTypeA = CRM_Utils_System::explode(CRM_Core_DAO::VALUE_SEPARATOR, $params['contact_types_a'], 2); $cTypeB = CRM_Utils_System::explode(CRM_Core_DAO::VALUE_SEPARATOR, $params['contact_types_b'], 2); $params['contact_type_a'] = $cTypeA[0]; $params['contact_type_b'] = $cTypeB[0]; $params['contact_sub_type_a'] = $cTypeA[1] ? $cTypeA[1] : 'NULL'; $params['contact_sub_type_b'] = $cTypeB[1] ? $cTypeB[1] : 'NULL'; CRM_Contact_BAO_RelationshipType::add($params, $ids); CRM_Core_Session::setStatus(ts('The Relationship Type has been saved.')); } }
/** * Delete a relationship type delete * * @param id of relationship type $id * * @return boolean true if success, else false * @static void * @access public */ function civicrm_relationship_type_delete(&$params) { if (!CRM_Utils_Array::value('id', $params)) { return civicrm_create_error('Missing required parameter'); } require_once 'CRM/Utils/Rule.php'; if ($params['id'] != null && !CRM_Utils_Rule::integer($params['id'])) { return civicrm_create_error('Invalid value for relationship type ID'); } $relationTypeBAO = new CRM_Contact_BAO_RelationshipType(); return $relationTypeBAO->del($params['id']) ? civicrm_create_success(ts('Deleted relationship type successfully')) : civicrm_create_error(ts('Could not delete relationship type')); }
/** * Delete a relationship type delete * * @param id of relationship type $id * * @return array API Result Array * {@getfields RelationshipType_delete} * @static void * @access public */ function civicrm_api3_relationship_type_delete($params) { require_once 'CRM/Utils/Rule.php'; if ($params['id'] != NULL && !CRM_Utils_Rule::integer($params['id'])) { return civicrm_api3_create_error('Invalid value for relationship type ID'); } $relationTypeBAO = new CRM_Contact_BAO_RelationshipType(); $result = $relationTypeBAO->del($params['id']); if (!$result) { return civicrm_api3_create_error('Could not delete relationship type'); } return civicrm_api3_create_success($result, $params, 'relationship_type', 'delete', $relationTypeBAO); }