public function postProcess() { $config = CRM_Chapters_AutomatchConfig::singelton(); if ($this->_action & CRM_Core_Action::DELETE) { CRM_Core_BAO_CustomValue::deleteCustomValue($this->id, $config->getCustomGroup('id')); $this->updateAllContacts(); return; } $cg = 'custom_'; $id = ':-1'; if ($this->id) { $id = ':' . $this->id; } $data['entity_id'] = $this->contact_id; $data[$cg . $config->getMatchTypeField('id') . $id] = $this->_submitValues['type']; $data[$cg . $config->getCountryField('id') . $id] = $this->_submitValues['country']; $data[$cg . $config->getZipCodeRangeFromField('id') . $id] = $this->_submitValues['zipcode_from']; $data[$cg . $config->getZipCodeRangeToField('id') . $id] = $this->_submitValues['zipcode_to']; civicrm_api3('CustomValue', 'create', $data); $this->updateAllContacts(); }
/** * Delete custom value. */ public static function deleteCustomValue() { CRM_Utils_System::setHttpHeader('Content-Type', 'text/plain'); $customValueID = CRM_Utils_Type::escape($_REQUEST['valueID'], 'Positive'); $customGroupID = CRM_Utils_Type::escape($_REQUEST['groupID'], 'Positive'); $contactId = CRM_Utils_Request::retrieve('contactId', 'Positive', CRM_Core_DAO::$_nullObject); CRM_Core_BAO_CustomValue::deleteCustomValue($customValueID, $customGroupID); if ($contactId) { echo CRM_Contact_BAO_Contact::getCountComponent('custom_' . $customGroupID, $contactId); } CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush(); CRM_Utils_System::civiExit(); }
/** * Function to delete custom value * */ function deleteCustomValue(&$config) { $customValueID = CRM_Utils_Type::escape($_POST['valueID'], 'Positive'); $customGroupID = CRM_Utils_Type::escape($_POST['groupID'], 'Positive'); require_once "CRM/Core/BAO/CustomValue.php"; CRM_Core_BAO_CustomValue::deleteCustomValue($customValueID, $customGroupID); if ($contactId = CRM_Utils_Array::value('contactId', $_POST)) { require_once 'CRM/Contact/BAO/Contact.php'; echo CRM_Contact_BAO_Contact::getCountComponent('custom_' . $_POST['groupID'], $contactId); } // reset the group contact cache for this group require_once 'CRM/Contact/BAO/GroupContactCache.php'; CRM_Contact_BAO_GroupContactCache::remove(); }
/** * Function to delete custom value * */ static function deleteCustomValue() { $customValueID = CRM_Utils_Type::escape($_POST['valueID'], 'Positive'); $customGroupID = CRM_Utils_Type::escape($_POST['groupID'], 'Positive'); CRM_Core_BAO_CustomValue::deleteCustomValue($customValueID, $customGroupID); if ($contactId = CRM_Utils_Array::value('contactId', $_POST)) { echo CRM_Contact_BAO_Contact::getCountComponent('custom_' . $_POST['groupID'], $contactId); } // reset the group contact cache for this group CRM_Contact_BAO_GroupContactCache::remove(); CRM_Utils_System::civiExit(); }
/** * Function to delete custom value * */ static function deleteCustomValue() { header('Content-Type: text/plain'); $customValueID = CRM_Utils_Type::escape($_REQUEST['valueID'], 'Positive'); $customGroupID = CRM_Utils_Type::escape($_REQUEST['groupID'], 'Positive'); $contactId = CRM_Utils_Request::retrieve('contactId', 'Positive', CRM_Core_DAO::$_nullObject); CRM_Core_BAO_CustomValue::deleteCustomValue($customValueID, $customGroupID); if ($contactId) { echo CRM_Contact_BAO_Contact::getCountComponent('custom_' . $customGroupID, $contactId); } // reset the group contact cache for this group CRM_Contact_BAO_GroupContactCache::remove(); CRM_Utils_System::civiExit(); }