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


PHP CRM_Core_BAO_OptionValue::retrieve方法代码示例

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


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

示例1: exportDAO

 /**
  * @param string $objectName
  *   Business-entity/xml-tag name.
  * @param CRM_Core_DAO $object
  * @param $mappedFields
  *
  * @return array
  */
 public function exportDAO($objectName, $object, $mappedFields)
 {
     $dbFields =& $object->fields();
     // Filter the list of keys and values so that we only export interesting stuff
     $keyValues = array();
     foreach ($dbFields as $name => $dontCare) {
         // ignore all ids
         if ($name == 'id' || substr($name, -3, 3) == '_id') {
             continue;
         }
         if (isset($object->{$name}) && $object->{$name} !== NULL) {
             // hack for extends_entity_column_value
             if ($name == 'extends_entity_column_value') {
                 if (in_array($object->extends, array('Event', 'Activity', 'Relationship', 'Individual', 'Organization', 'Household', 'Case'))) {
                     if ($object->extends == 'Event') {
                         $key = 'event_type';
                     } elseif ($object->extends == 'Activity') {
                         $key = 'activity_type';
                     } elseif ($object->extends == 'Relationship') {
                         $key = 'relationship_type';
                     } elseif ($object->extends == 'Case') {
                         $key = 'case_type';
                     }
                     $types = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($object->{$name}, 1, -1));
                     $values = array();
                     if (in_array($object->extends, array('Individual', 'Organization', 'Household'))) {
                         $key = 'contact_type';
                         $values = $types;
                     } else {
                         foreach ($types as $type) {
                             if (in_array($key, array('activity_type', 'event_type', 'case_type'))) {
                                 $ogID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $key, 'id', 'name');
                                 $ovParams = array('option_group_id' => $ogID, 'value' => $type);
                                 CRM_Core_BAO_OptionValue::retrieve($ovParams, $oValue);
                                 $values[] = $oValue['name'];
                             } else {
                                 $relTypeName = CRM_Core_DAO::getFieldValue('CRM_Contact_BAO_RelationshipType', $type, 'name_a_b', 'id');
                                 $values[] = $relTypeName;
                             }
                         }
                     }
                     $keyValues['extends_entity_column_value_option_group'] = $key;
                     $value = implode(',', $values);
                     $object->extends_entity_column_value = $value;
                 } else {
                     echo "This extension: {$object->extends} is not yet handled";
                     exit;
                 }
             }
             $value = $object->{$name};
             if ($name == 'field_name') {
                 // hack for profile field_name
                 if (substr($value, 0, 7) == 'custom_') {
                     $cfID = substr($value, 7);
                     list($tableName, $columnName, $groupID) = CRM_Core_BAO_CustomField::getTableColumnGroup($cfID);
                     $value = "custom.{$tableName}.{$columnName}";
                 }
             }
             $keyValues[$name] = $value;
         }
     }
     $keyValues += $this->computeMappedFields($mappedFields, $object);
     return $keyValues;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:72,代码来源:Export.php

示例2: testGetInstrumentFinancialAccount

 /**
  * check method getInstrumentFinancialAccount()
  */
 function testGetInstrumentFinancialAccount()
 {
     $paymentInstrumentValue = 1;
     $params = array('name' => 'Donations', 'is_deductible' => 0, 'is_active' => 1);
     $ids = array();
     $financialAccount = CRM_Financial_BAO_FinancialAccount::add($params, $ids);
     $optionParams = array('name' => 'Credit Card', 'value' => $paymentInstrumentValue);
     $optionValue = CRM_Core_BAO_OptionValue::retrieve($optionParams, $defaults);
     $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
     $financialParams = array('entity_table' => 'civicrm_option_value', 'entity_id' => $optionValue->id, 'account_relationship' => $relationTypeId, 'financial_account_id' => $financialAccount->id);
     CRM_Financial_BAO_FinancialTypeAccount::add($financialParams, $ids);
     $financialAccountId = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($paymentInstrumentValue);
     $this->assertEquals($financialAccountId, $financialAccount->id, 'Verify Payment Instrument');
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:17,代码来源:FinancialTypeAccountTest.php

示例3: hrui_civicrm_uninstall

/**
 * Implementation of hook_civicrm_uninstall
 */
function hrui_civicrm_uninstall()
{
    //Enable Individual sub types
    _hrui_toggleContactSubType(TRUE);
    // get a list of all tab options
    $options = CRM_Core_OptionGroup::values('contact_view_options', TRUE, FALSE);
    $tabsToSet = array($options['Activities'], $options['Tags']);
    // get tab options from DB
    $options = hrui_getViewOptionsSetting();
    // set activity & tag tab options
    foreach ($tabsToSet as $key) {
        $options[$key] = 1;
    }
    $options = array_keys($options);
    // set modified options in the DB
    hrui_setViewOptionsSetting($options);
    _hrui_setActiveFields(TRUE);
    // show communication preferences block
    $groupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'contact_edit_options', 'id', 'name');
    $params = array('option_group_id' => $groupID, 'name' => 'CommunicationPreferences');
    CRM_Core_BAO_OptionValue::retrieve($params, $defaults);
    $defaults['is_active'] = 1;
    CRM_Core_BAO_OptionValue::create($defaults);
    _hrui_wordReplacement(TRUE);
    return _hrui_civix_civicrm_uninstall();
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:29,代码来源:hrui.php


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