/** * @return CRM_Chapters_ChapterConfig */ public static function singleton() { if (!self::$singleton) { self::$singleton = new CRM_Chapters_ChapterConfig(); } return self::$singleton; }
/** * Implements hook_civicrm_custom(). * * @link http://wiki.civicrm.org/confluence/display/CRMDOC44/hook_civicrm_custom */ function chapters_civicrm_custom($op, $groupID, $entityID, &$params) { $config = CRM_Chapters_ChapterConfig::singleton(); if ($config->getCustomGroup('id') == $groupID) { foreach ($params as $field) { if ($field['custom_field_id'] == $config->getManualField('id') && empty($field['value'])) { $matcher = CRM_Chapters_Matcher::singleton(); $matcher->updateContact($entityID); } } } }
public function hasContactAutomaticMatching($contact_id) { $config = CRM_Chapters_ChapterConfig::singleton(); $sql = "SELECT `" . $config->getManualField('column_name') . "` AS `manual` FROM `" . $config->getCustomGroup('table_name') . "` WHERE `entity_id` = %1"; $params[1] = array($contact_id, 'Integer'); $dao = CRM_Core_DAO::executeQuery($sql, $params); if ($dao->fetch()) { if ($dao->manual) { return false; } } return true; }