本文整理汇总了PHP中CRM_Financial_BAO_FinancialType::_availableFinancialTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Financial_BAO_FinancialType::_availableFinancialTypes方法的具体用法?PHP CRM_Financial_BAO_FinancialType::_availableFinancialTypes怎么用?PHP CRM_Financial_BAO_FinancialType::_availableFinancialTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Financial_BAO_FinancialType
的用法示例。
在下文中一共展示了CRM_Financial_BAO_FinancialType::_availableFinancialTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: flushFinancialTypeStatics
/**
* Flush statics relating to financial type.
*/
protected function flushFinancialTypeStatics()
{
if (isset(\Civi::$statics['CRM_Financial_BAO_FinancialType'])) {
unset(\Civi::$statics['CRM_Financial_BAO_FinancialType']);
}
if (isset(\Civi::$statics['CRM_Contribute_PseudoConstant'])) {
unset(\Civi::$statics['CRM_Contribute_PseudoConstant']);
}
CRM_Contribute_PseudoConstant::flush('financialType');
CRM_Contribute_PseudoConstant::flush('membershipType');
// Pseudoconstants may be saved to the cache table.
CRM_Core_DAO::executeQuery("TRUNCATE civicrm_cache");
CRM_Financial_BAO_FinancialType::$_statusACLFt = array();
CRM_Financial_BAO_FinancialType::$_availableFinancialTypes = NULL;
}
示例2: testCreateACLContributionChainedLineItems
/**
* Test checks that passing in line items suppresses the create mechanism.
*/
public function testCreateACLContributionChainedLineItems()
{
$this->setACL();
$params = array('contact_id' => $this->_individualId, 'receive_date' => '20120511', 'total_amount' => 100.0, 'financial_type_id' => $this->_financialTypeId, 'payment_instrument_id' => 1, 'non_deductible_amount' => 10.0, 'fee_amount' => 50.0, 'net_amount' => 90.0, 'source' => 'SSF', 'contribution_status_id' => 1, 'check_permissions' => TRUE, 'api.line_item.create' => array(array('price_field_id' => 1, 'qty' => 2, 'line_total' => '20', 'unit_price' => '10', 'financial_type_id' => 1), array('price_field_id' => 1, 'qty' => 1, 'line_total' => '80', 'unit_price' => '80', 'financial_type_id' => 2)));
$description = "Create Contribution with Nested Line Items.";
$subfile = "CreateWithNestedLineItems";
$config =& CRM_Core_Config::singleton();
$config->userPermissionClass->permissions = array('access CiviCRM', 'access CiviContribute', 'edit contributions', 'delete in CiviContribute', 'add contributions of type Donation', 'delete contributions of type Donation');
$contribution = $this->callAPIFailure('contribution', 'create', $params, 'Error in call to LineItem_create : You do not have permission to create this line item');
// Check that the entire contribution has rolled back.
$contribution = $this->callAPISuccess('contribution', 'get', array());
$this->assertEquals(0, $contribution['count']);
CRM_Financial_BAO_FinancialType::$_availableFinancialTypes = NULL;
$config =& CRM_Core_Config::singleton();
$config->userPermissionClass->permissions = array_merge($config->userPermissionClass->permissions, array('add contributions of type Member Dues', 'view contributions of type Donation', 'view contributions of type Member Dues', 'delete contributions of type Member Dues'));
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
$lineItemParams = array('contribution_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution');
$lineItems = $this->callAPISuccess('LineItem', 'get', $lineItemParams);
$this->assertEquals(3, $lineItems['count']);
$this->assertEquals(100.0, $lineItems['values'][3]['line_total']);
$this->assertEquals(20, $lineItems['values'][4]['line_total']);
$this->assertEquals(80, $lineItems['values'][5]['line_total']);
$this->assertEquals(1, $lineItems['values'][3]['financial_type_id']);
$this->assertEquals(1, $lineItems['values'][4]['financial_type_id']);
$this->assertEquals(2, $lineItems['values'][5]['financial_type_id']);
$this->callAPISuccess('Contribution', 'Delete', array('id' => $contribution['id']));
}
示例3: testbuildPermissionedClause
/**
* Check method testisACLFinancialTypeStatus()
*/
public function testbuildPermissionedClause()
{
$this->setACL();
$config =& CRM_Core_Config::singleton();
$config->userPermissionClass->permissions = array('view contributions of type Donation', 'view contributions of type Member Dues');
CRM_Financial_BAO_FinancialType::buildPermissionedClause($whereClause, 'contribution');
$this->assertEquals($whereClause, ' civicrm_contribution.financial_type_id IN (1,2)');
$config->userPermissionClass->permissions[] = 'view contributions of type Event Fee';
$whereClause = NULL;
CRM_Financial_BAO_FinancialType::$_availableFinancialTypes = array();
CRM_Financial_BAO_FinancialType::buildPermissionedClause($whereClause, 'contribution');
$this->assertEquals($whereClause, ' civicrm_contribution.financial_type_id IN (1,4,2)');
}