當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。