当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Dedupe_BAO_RuleGroup::supportedFields方法代码示例

本文整理汇总了PHP中CRM_Dedupe_BAO_RuleGroup::supportedFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Dedupe_BAO_RuleGroup::supportedFields方法的具体用法?PHP CRM_Dedupe_BAO_RuleGroup::supportedFields怎么用?PHP CRM_Dedupe_BAO_RuleGroup::supportedFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Dedupe_BAO_RuleGroup的用法示例。


在下文中一共展示了CRM_Dedupe_BAO_RuleGroup::supportedFields方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preProcess

 /**
  * Function to pre processing
  *
  * @return None
  * @access public
  */
 function preProcess()
 {
     $this->_rgid = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0);
     $this->_contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, false, 0);
     if ($this->_rgid) {
         $rgDao =& new CRM_Dedupe_DAO_RuleGroup();
         $rgDao->id = $this->_rgid;
         $rgDao->find(true);
         $this->_defaults['threshold'] = $rgDao->threshold;
         $this->_contactType = $rgDao->contact_type;
         $this->_defaults['level'] = $rgDao->level;
         $this->_defaults['name'] = $rgDao->name;
         $ruleDao =& new CRM_Dedupe_DAO_Rule();
         $ruleDao->dedupe_rule_group_id = $this->_rgid;
         $ruleDao->find();
         $count = 0;
         while ($ruleDao->fetch()) {
             $this->_defaults["where_{$count}"] = "{$ruleDao->rule_table}.{$ruleDao->rule_field}";
             $this->_defaults["length_{$count}"] = $ruleDao->rule_length;
             $this->_defaults["weight_{$count}"] = $ruleDao->rule_weight;
             $count++;
         }
     }
     $supported =& CRM_Dedupe_BAO_RuleGroup::supportedFields($this->_contactType);
     if (is_array($supported)) {
         foreach ($supported as $table => $fields) {
             foreach ($fields as $field => $title) {
                 $this->_fields["{$table}.{$field}"] = $title;
             }
         }
     }
     asort($this->_fields);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:39,代码来源:DedupeRules.php

示例2: preProcess

 /**
  * Pre processing.
  *
  * @return void
  */
 public function preProcess()
 {
     // Ensure user has permission to be here
     if (!CRM_Core_Permission::check('administer dedupe rules')) {
         CRM_Utils_System::permissionDenied();
         CRM_Utils_System::civiExit();
     }
     $this->_options = CRM_Core_SelectValues::getDedupeRuleTypes();
     $this->_rgid = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
     $this->_contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, FALSE, 0);
     if ($this->_rgid) {
         $rgDao = new CRM_Dedupe_DAO_RuleGroup();
         $rgDao->id = $this->_rgid;
         $rgDao->find(TRUE);
         $this->_defaults['threshold'] = $rgDao->threshold;
         $this->_contactType = $rgDao->contact_type;
         $this->_defaults['used'] = CRM_Utils_Array::key($rgDao->used, $this->_options);
         $this->_defaults['title'] = $rgDao->title;
         $this->_defaults['name'] = $rgDao->name;
         $this->_defaults['is_reserved'] = $rgDao->is_reserved;
         $this->assign('isReserved', $rgDao->is_reserved);
         $this->assign('ruleName', $rgDao->name);
         $ruleDao = new CRM_Dedupe_DAO_Rule();
         $ruleDao->dedupe_rule_group_id = $this->_rgid;
         $ruleDao->find();
         $count = 0;
         while ($ruleDao->fetch()) {
             $this->_defaults["where_{$count}"] = "{$ruleDao->rule_table}.{$ruleDao->rule_field}";
             $this->_defaults["length_{$count}"] = $ruleDao->rule_length;
             $this->_defaults["weight_{$count}"] = $ruleDao->rule_weight;
             $count++;
         }
     }
     $supported = CRM_Dedupe_BAO_RuleGroup::supportedFields($this->_contactType);
     if (is_array($supported)) {
         foreach ($supported as $table => $fields) {
             foreach ($fields as $field => $title) {
                 $this->_fields["{$table}.{$field}"] = $title;
             }
         }
     }
     asort($this->_fields);
 }
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:48,代码来源:DedupeRules.php

示例3: preProcess

 /**
  * Function to pre processing
  *
  * @return None
  * @access public
  */
 function preProcess()
 {
     // Ensure user has permission to be here
     require_once 'CRM/Core/Permission.php';
     if (!CRM_Core_Permission::check('administer dedupe rules')) {
         CRM_Utils_System::permissionDenied();
         CRM_Utils_System::civiExit();
     }
     $this->_rgid = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0);
     $this->_contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, false, 0);
     if ($this->_rgid) {
         $rgDao = new CRM_Dedupe_DAO_RuleGroup();
         $rgDao->id = $this->_rgid;
         $rgDao->find(true);
         $this->_defaults['threshold'] = $rgDao->threshold;
         $this->_contactType = $rgDao->contact_type;
         $this->_defaults['level'] = $rgDao->level;
         $this->_defaults['name'] = $rgDao->name;
         $this->_defaults['is_default'] = $rgDao->is_default;
         $ruleDao = new CRM_Dedupe_DAO_Rule();
         $ruleDao->dedupe_rule_group_id = $this->_rgid;
         $ruleDao->find();
         $count = 0;
         while ($ruleDao->fetch()) {
             $this->_defaults["where_{$count}"] = "{$ruleDao->rule_table}.{$ruleDao->rule_field}";
             $this->_defaults["length_{$count}"] = $ruleDao->rule_length;
             $this->_defaults["weight_{$count}"] = $ruleDao->rule_weight;
             $count++;
         }
     }
     $supported =& CRM_Dedupe_BAO_RuleGroup::supportedFields($this->_contactType);
     if (is_array($supported)) {
         foreach ($supported as $table => $fields) {
             foreach ($fields as $field => $title) {
                 $this->_fields["{$table}.{$field}"] = $title;
             }
         }
     }
     asort($this->_fields);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:46,代码来源:DedupeRules.php

示例4: formatParams

 /**
  * A hackish function needed to massage CRM_Contact_Form_$ctype::formRule()
  * object into a valid $params array for dedupe
  *
  * @param array $fields  contact structure from formRule()
  * @param string $ctype  contact type of the given contact
  *
  * @return array  valid $params array for dedupe
  */
 static function formatParams($fields, $ctype)
 {
     $flat = array();
     CRM_Utils_Array::flatten($fields, $flat);
     $replace_these = array('individual_prefix' => 'prefix_id', 'individual_suffix' => 'suffix_id', 'gender' => 'gender_id');
     //handle for individual_suffix, individual_prefix, gender
     foreach (array('individual_suffix', 'individual_prefix', 'gender') as $name) {
         if (CRM_Utils_Array::value($name, $fields)) {
             $flat[$replace_these[$name]] = $flat[$name];
             unset($flat[$name]);
         }
     }
     // handle {birth,deceased}_date
     foreach (array('birth_date', 'deceased_date') as $date) {
         if (CRM_Utils_Array::value($date, $fields)) {
             $flat[$date] = $fields[$date];
             if (is_array($flat[$date])) {
                 $flat[$date] = CRM_Utils_Date::format($flat[$date]);
             }
             $flat[$date] = CRM_Utils_Date::processDate($flat[$date]);
         }
     }
     if (CRM_Utils_Array::value('contact_source', $flat)) {
         $flat['source'] = $flat['contact_source'];
         unset($flat['contact_source']);
     }
     // handle preferred_communication_method
     if (array_key_exists('preferred_communication_method', $fields)) {
         $methods = array_intersect($fields['preferred_communication_method'], array('1'));
         $methods = array_keys($methods);
         sort($methods);
         if ($methods) {
             $flat['preferred_communication_method'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $methods) . CRM_Core_DAO::VALUE_SEPARATOR;
         }
     }
     // handle custom data
     $tree = CRM_Core_BAO_CustomGroup::getTree($ctype, CRM_Core_DAO::$_nullObject, NULL, -1);
     CRM_Core_BAO_CustomGroup::postProcess($tree, $fields, TRUE);
     foreach ($tree as $key => $cg) {
         if (!is_int($key)) {
             continue;
         }
         foreach ($cg['fields'] as $cf) {
             $flat[$cf['column_name']] = CRM_Utils_Array::value('data', $cf['customValue']);
         }
     }
     // if the key is dotted, keep just the last part of it
     foreach ($flat as $key => $value) {
         if (substr_count($key, '.')) {
             $last = array_pop(explode('.', $key));
             // make sure the first occurence is kept, not the last
             if (!isset($flat[$last])) {
                 $flat[$last] = $value;
             }
             unset($flat[$key]);
         }
     }
     // drop the -digit (and -Primary, for CRM-3902) postfixes (so event registration's $flat['email-5'] becomes $flat['email'])
     // FIXME: CRM-5026 should be fixed here; the below clobbers all address info; we should split off address fields and match
     // the -digit to civicrm_address.location_type_id and -Primary to civicrm_address.is_primary
     foreach ($flat as $key => $value) {
         $matches = array();
         if (preg_match('/(.*)-(\\d+|Primary)$/', $key, $matches)) {
             $flat[$matches[1]] = $value;
             unset($flat[$key]);
         }
     }
     $params = array();
     $supportedFields = CRM_Dedupe_BAO_RuleGroup::supportedFields($ctype);
     if (is_array($supportedFields)) {
         foreach ($supportedFields as $table => $fields) {
             if ($table == 'civicrm_address') {
                 // for matching on civicrm_address fields, we also need the location_type_id
                 $fields['location_type_id'] = '';
                 // FIXME: we also need to do some hacking for id and name fields, see CRM-3902’s comments
                 $fixes = array('address_name' => 'name', 'country' => 'country_id', 'state_province' => 'state_province_id', 'county' => 'county_id');
                 foreach ($fixes as $orig => $target) {
                     if (CRM_Utils_Array::value($orig, $flat)) {
                         $params[$table][$target] = $flat[$orig];
                     }
                 }
             }
             foreach ($fields as $field => $title) {
                 if (CRM_Utils_Array::value($field, $flat)) {
                     $params[$table][$field] = $flat[$field];
                 }
             }
         }
     }
     return $params;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:100,代码来源:Finder.php


注:本文中的CRM_Dedupe_BAO_RuleGroup::supportedFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。