public static function buildDedupeRules() { $parent = CRM_Utils_Request::retrieve('parentId', 'Positive', CRM_Core_DAO::$_nullObject); switch ($parent) { case 1: $contactType = 'Individual'; break; case 2: $contactType = 'Household'; break; case 4: $contactType = 'Organization'; break; } $dedupeRules = CRM_Dedupe_BAO_RuleGroup::getByType($contactType); CRM_Utils_JSON::output($dedupeRules); }
static function buildDedupeRules() { $parent = CRM_Utils_Array::value('parentId', $_POST); switch ($parent) { case 1: $contactType = 'Individual'; break; case 2: $contactType = 'Household'; break; case 4: $contactType = 'Organization'; break; } $dedupeRules = CRM_Dedupe_BAO_RuleGroup::getByType($contactType); echo json_encode($dedupeRules); CRM_Utils_System::civiExit(); }
/** * Build the form object. * * @return void */ public function buildQuickForm() { if ($this->_addProfileBottom) { return self::buildMultipleProfileBottom($this, $this->_profileBottomNum); } if ($this->_addProfileBottomAdd) { return self::buildMultipleProfileBottom($this, $this->_profileBottomNumAdd, 'additional_', ts('Profile for Additional Participants')); } $this->applyFilter('__ALL__', 'trim'); $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event'); $this->addElement('checkbox', 'is_online_registration', ts('Allow Online Registration'), NULL, array('onclick' => "return showHideByValue('is_online_registration'," . "''," . "'registration_blocks'," . "'block'," . "'radio'," . "false );")); $this->add('text', 'registration_link_text', ts('Registration Link Text')); if (!$this->_isTemplate) { $this->addDateTime('registration_start_date', ts('Registration Start Date'), FALSE, array('formatType' => 'activityDateTime')); $this->addDateTime('registration_end_date', ts('Registration End Date'), FALSE, array('formatType' => 'activityDateTime')); } $params = array('used' => 'Supervised', 'contact_type' => 'Individual'); $dedupeRuleFields = CRM_Dedupe_BAO_Rule::dedupeRuleFields($params); foreach ($dedupeRuleFields as $key => $fields) { $ruleFields[$key] = ucwords(str_replace('_', ' ', $fields)); } $this->addElement('checkbox', 'is_multiple_registrations', ts('Register multiple participants?')); $this->addElement('checkbox', 'allow_same_participant_emails', ts('Same email address?')); $this->assign('ruleFields', json_encode($ruleFields)); $dedupeRules = array('' => '- Unsupervised rule -'); $dedupeRules += CRM_Dedupe_BAO_RuleGroup::getByType('Individual'); $this->add('select', 'dedupe_rule_group_id', ts('Duplicate matching rule'), $dedupeRules); $participantStatuses = CRM_Event_PseudoConstant::participantStatus(); if (in_array('Awaiting approval', $participantStatuses) and in_array('Pending from approval', $participantStatuses) and in_array('Rejected', $participantStatuses)) { $this->addElement('checkbox', 'requires_approval', ts('Require participant approval?'), NULL, array('onclick' => "return showHideByValue('requires_approval', '', 'id-approval-text', 'table-row', 'radio', false);")); $this->add('textarea', 'approval_req_text', ts('Approval message'), $attributes['approval_req_text']); } $this->add('text', 'expiration_time', ts('Pending participant expiration (hours)')); $this->addRule('expiration_time', ts('Please enter the number of hours (as an integer).'), 'integer'); self::buildRegistrationBlock($this); self::buildConfirmationBlock($this); self::buildMailBlock($this); self::buildThankYouBlock($this); parent::buildQuickForm(); }
static function buildDedupeRules() { $parent = CRM_Utils_Array::value('parentId', $_REQUEST); switch ($parent) { case 1: $contactType = 'Individual'; break; case 2: $contactType = 'Household'; break; case 4: $contactType = 'Organization'; break; } $dedupeRules = CRM_Dedupe_BAO_RuleGroup::getByType($contactType); CRM_Utils_JSON::output($dedupeRules); }