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


PHP CRM_Contact_BAO_RelationshipType::free方法代码示例

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


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

示例1: buildMappingForm


//.........这里部分代码省略.........
         if ($k) {
             foreach ($mapperFields[$k] as $key => $value) {
                 if (isset($hasLocationTypes[$k][$key])) {
                     $sel3[$k][$key] = $locationTypes;
                 } else {
                     $sel3[$key] = NULL;
                 }
             }
         }
     }
     // Array for core fields and relationship custom data
     $relationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, NULL, TRUE);
     if ($mappingType == 'Export') {
         foreach ($sel1 as $k => $sel) {
             if ($k) {
                 foreach ($mapperFields[$k] as $field => $dontCare) {
                     if (isset($hasRelationTypes[$k][$field])) {
                         list($id, $first, $second) = explode('_', $field);
                         // FIX ME: For now let's not expose custom data related to relationship
                         $relationshipCustomFields = array();
                         //$relationshipCustomFields    = self::getRelationTypeCustomGroupData( $id );
                         //asort($relationshipCustomFields);
                         $relationshipType = new CRM_Contact_BAO_RelationshipType();
                         $relationshipType->id = $id;
                         if ($relationshipType->find(TRUE)) {
                             $direction = "contact_sub_type_{$second}";
                             if (isset($relationshipType->{$direction})) {
                                 $relatedFields = array_merge((array) $relatedMapperFields[$relationshipType->{$direction}], (array) $relationshipCustomFields);
                             } else {
                                 $target_type = 'contact_type_' . $second;
                                 $relatedFields = array_merge((array) $relatedMapperFields[$relationshipType->{$target_type}], (array) $relationshipCustomFields);
                             }
                         }
                         $relationshipType->free();
                         asort($relatedFields);
                         $sel5[$k][$field] = $relatedFields;
                     }
                 }
             }
         }
         //Location Type for relationship fields
         foreach ($sel5 as $k => $v) {
             if ($v) {
                 foreach ($v as $rel => $fields) {
                     foreach ($fields as $field => $fieldLabel) {
                         if (isset($hasLocationTypes[$k][$field])) {
                             $sel6[$k][$rel][$field] = $locationTypes;
                         }
                     }
                 }
             }
         }
         //PhoneTypes for  relationship fields
         $sel7[''] = NULL;
         foreach ($sel6 as $k => $rel) {
             if ($k) {
                 foreach ($rel as $phonekey => $phonevalue) {
                     foreach ($locationTypes as $locType => $loc) {
                         if (trim($locType) != '') {
                             $sel7[$k][$phonekey]['phone'][$locType] =& $phoneTypes;
                             $sel7[$k][$phonekey]['im'][$locType] =& $imProviders;
                         }
                     }
                 }
             }
         }
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:67,代码来源:Mapping.php

示例2: isErrorInCustomData


//.........这里部分代码省略.........
                 }
                 // need not check for label filed import
                 $htmlType = array('CheckBox', 'Multi-Select', 'AdvMulti-Select', 'Select', 'Radio', 'Multi-Select State/Province', 'Multi-Select Country');
                 if (!in_array($customFields[$customFieldID]['html_type'], $htmlType) || $customFields[$customFieldID]['data_type'] == 'Boolean' || $customFields[$customFieldID]['data_type'] == 'ContactReference') {
                     $valid = CRM_Core_BAO_CustomValue::typecheck($customFields[$customFieldID]['data_type'], $value);
                     if (!$valid) {
                         self::addToErrorMsg($customFields[$customFieldID]['label'], $errorMessage);
                     }
                 }
                 // check for values for custom fields for checkboxes and multiselect
                 if ($customFields[$customFieldID]['html_type'] == 'CheckBox' || $customFields[$customFieldID]['html_type'] == 'AdvMulti-Select' || $customFields[$customFieldID]['html_type'] == 'Multi-Select') {
                     $value = trim($value);
                     $value = str_replace('|', ',', $value);
                     $mulValues = explode(',', $value);
                     $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE);
                     foreach ($mulValues as $v1) {
                         if (strlen($v1) == 0) {
                             continue;
                         }
                         $flag = FALSE;
                         foreach ($customOption as $v2) {
                             if (strtolower(trim($v2['label'])) == strtolower(trim($v1)) || strtolower(trim($v2['value'])) == strtolower(trim($v1))) {
                                 $flag = TRUE;
                             }
                         }
                         if (!$flag) {
                             self::addToErrorMsg($customFields[$customFieldID]['label'], $errorMessage);
                         }
                     }
                 } elseif ($customFields[$customFieldID]['html_type'] == 'Select' || $customFields[$customFieldID]['html_type'] == 'Radio' && $customFields[$customFieldID]['data_type'] != 'Boolean') {
                     $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE);
                     $flag = FALSE;
                     foreach ($customOption as $v2) {
                         if (strtolower(trim($v2['label'])) == strtolower(trim($value)) || strtolower(trim($v2['value'])) == strtolower(trim($value))) {
                             $flag = TRUE;
                         }
                     }
                     if (!$flag) {
                         self::addToErrorMsg($customFields[$customFieldID]['label'], $errorMessage);
                     }
                 } elseif ($customFields[$customFieldID]['html_type'] == 'Multi-Select State/Province') {
                     $mulValues = explode(',', $value);
                     foreach ($mulValues as $stateValue) {
                         if ($stateValue) {
                             if (self::in_value(trim($stateValue), CRM_Core_PseudoConstant::stateProvinceAbbreviation()) || self::in_value(trim($stateValue), CRM_Core_PseudoConstant::stateProvince())) {
                                 continue;
                             } else {
                                 self::addToErrorMsg($customFields[$customFieldID]['label'], $errorMessage);
                             }
                         }
                     }
                 } elseif ($customFields[$customFieldID]['html_type'] == 'Multi-Select Country') {
                     $mulValues = explode(',', $value);
                     foreach ($mulValues as $countryValue) {
                         if ($countryValue) {
                             CRM_Core_PseudoConstant::populate($countryNames, 'CRM_Core_DAO_Country', TRUE, 'name', 'is_active');
                             CRM_Core_PseudoConstant::populate($countryIsoCodes, 'CRM_Core_DAO_Country', TRUE, 'iso_code');
                             $config = CRM_Core_Config::singleton();
                             $limitCodes = $config->countryLimit();
                             $error = TRUE;
                             foreach (array($countryNames, $countryIsoCodes, $limitCodes) as $values) {
                                 if (in_array(trim($countryValue), $values)) {
                                     $error = FALSE;
                                     break;
                                 }
                             }
                             if ($error) {
                                 self::addToErrorMsg($customFields[$customFieldID]['label'], $errorMessage);
                             }
                         }
                     }
                 }
             }
         } elseif (is_array($params[$key]) && isset($params[$key]["contact_type"])) {
             //CRM-5125
             //supporting custom data of related contact subtypes
             $relation = NULL;
             if ($relationships) {
                 if (array_key_exists($key, $relationships)) {
                     $relation = $key;
                 } elseif (CRM_Utils_Array::key($key, $relationships)) {
                     $relation = CRM_Utils_Array::key($key, $relationships);
                 }
             }
             if (!empty($relation)) {
                 list($id, $first, $second) = CRM_Utils_System::explode('_', $relation, 3);
                 $direction = "contact_sub_type_{$second}";
                 $relationshipType = new CRM_Contact_BAO_RelationshipType();
                 $relationshipType->id = $id;
                 if ($relationshipType->find(TRUE)) {
                     if (isset($relationshipType->{$direction})) {
                         $params[$key]['contact_sub_type'] = $relationshipType->{$direction};
                     }
                 }
                 $relationshipType->free();
             }
             self::isErrorInCustomData($params[$key], $errorMessage, $csType, $relationships);
         }
     }
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:101,代码来源:Contact.php


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