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


PHP CRM_Core_BAO_OptionValue::ensureOptionValueExists方法代码示例

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


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

示例1: testEnsureOptionValueExistsDisabled

 /**
  * Ensure only one option value copes with disabled.
  *
  * (Our expectation is no change - ie. currently we are respecting 'someone's
  * decision to disable it & leaving it in that state.
  */
 public function testEnsureOptionValueExistsDisabled()
 {
     CRM_Core_BAO_OptionValue::ensureOptionValueExists(array('name' => 'Crashed', 'option_group_id' => 'contribution_status', 'is_active' => 0));
     $value = $this->callAPISuccessGetSingle('OptionValue', array('name' => 'Crashed', 'option_group_id' => 'contribution_status'));
     $this->assertEquals(0, $value['is_active']);
     CRM_Core_BAO_OptionValue::ensureOptionValueExists(array('name' => 'Crashed', 'option_group_id' => 'contribution_status'));
     $value = $this->callAPISuccessGetSingle('OptionValue', array('name' => 'Crashed', 'option_group_id' => 'contribution_status'));
     $this->assertEquals(0, $value['is_active']);
 }
开发者ID:sdekok,项目名称:civicrm-core,代码行数:15,代码来源:OptionValueTest.php

示例2: addRefundAndChargeBackAccountsIfNotExist

 /**
  * CRM-17951 Add accounts option values for refund and chargeback.
  *
  * Add Chargeback contribution status and Chargeback and Contra account relationships,
  * checking first if one exists.
  */
 public function addRefundAndChargeBackAccountsIfNotExist()
 {
     // First we enable and edit the record for Credit contra - this exists but is disabled for most sites.
     // Using the ensure function (below) will not enabled a disabled option (by design).
     CRM_Core_DAO::executeQuery("UPDATE civicrm_option_value v\n     INNER JOIN civicrm_option_group g on v.option_group_id=g.id and g.name='account_relationship'\n     SET v.is_active=1, v.label='Credit/Contra Revenue Account is', v.name='Credit/Contra Revenue Account is', v.description='Credit/Contra Revenue Account is'\n     WHERE v.name = 'Credit/Contra Account is';");
     CRM_Core_BAO_OptionValue::ensureOptionValueExists(array('option_group_id' => 'account_relationship', 'name' => 'Chargeback Account is', 'label' => ts('Chargeback Account is'), 'is_active' => TRUE, 'component_id' => 'CiviContribute'));
     CRM_Core_BAO_OptionValue::ensureOptionValueExists(array('option_group_id' => 'contribution_status', 'name' => 'Chargeback', 'label' => ts('Chargeback'), 'is_active' => TRUE, 'component_id' => 'CiviContribute'));
     return TRUE;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:15,代码来源:FourSeven.php

示例3: addDeletedByMergeActivityType

 /**
  * CRM-18124 Add index to civicrm_contribution.total_amount.
  *
  * Note that I made this a combined index with receive_date because the issue included
  * both criteria and they seemed likely to be used in conjunction to me in other cases.
  *
  * @param \CRM_Queue_TaskContext $ctx
  *
  * @return bool
  */
 public function addDeletedByMergeActivityType(CRM_Queue_TaskContext $ctx)
 {
     CRM_Core_BAO_OptionValue::ensureOptionValueExists(array('option_group_id' => 'activity_type', 'name' => 'Contact Deleted by Merge', 'label' => ts('Contact Deleted by Merge'), 'description' => ts('Contact was merged into another contact'), 'is_active' => TRUE, 'filter' => 1));
     return TRUE;
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:15,代码来源:FourSeven.php


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