本文整理汇总了PHP中CRM_Financial_BAO_FinancialType::_statusACLFt方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Financial_BAO_FinancialType::_statusACLFt方法的具体用法?PHP CRM_Financial_BAO_FinancialType::_statusACLFt怎么用?PHP CRM_Financial_BAO_FinancialType::_statusACLFt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Financial_BAO_FinancialType
的用法示例。
在下文中一共展示了CRM_Financial_BAO_FinancialType::_statusACLFt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setACL
public function setACL()
{
CRM_Financial_BAO_FinancialType::$_availableFinancialTypes = array();
CRM_Financial_BAO_FinancialType::$_statusACLFt = array();
$params = array('domain_id' => 1, 'contribution_invoice_settings' => array('acl_financial_type' => 1));
$this->callAPISuccess('setting', 'create', $params);
}
示例2: 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;
}
示例3: testcheckPermissionedLineItems
/**
* Check method testcheckPermissionedLineItems()
*/
public function testcheckPermissionedLineItems()
{
$contactId = Contact::createIndividual();
$paramsSet['title'] = 'Price Set' . substr(sha1(rand()), 0, 4);
$paramsSet['name'] = CRM_Utils_String::titleToVar($paramsSet['title']);
$paramsSet['is_active'] = TRUE;
$paramsSet['financial_type_id'] = 1;
$paramsSet['extends'] = 1;
$priceset = CRM_Price_BAO_PriceSet::create($paramsSet);
$priceSetId = $priceset->id;
//Checking for priceset added in the table.
$this->assertDBCompareValue('CRM_Price_BAO_PriceSet', $priceSetId, 'title', 'id', $paramsSet['title'], 'Check DB for created priceset');
$paramsField = array('label' => 'Price Field', 'name' => CRM_Utils_String::titleToVar('Price Field'), 'html_type' => 'CheckBox', 'option_label' => array('1' => 'Price Field 1', '2' => 'Price Field 2'), 'option_value' => array('1' => 100, '2' => 200), 'option_name' => array('1' => 'Price Field 1', '2' => 'Price Field 2'), 'option_weight' => array('1' => 1, '2' => 2), 'option_amount' => array('1' => 100, '2' => 200), 'is_display_amounts' => 1, 'weight' => 1, 'options_per_line' => 1, 'is_active' => array('1' => 1, '2' => 1), 'price_set_id' => $priceset->id, 'is_enter_qty' => 1, 'financial_type_id' => 1);
$priceField = CRM_Price_BAO_PriceField::create($paramsField);
$priceFields = $this->callAPISuccess('PriceFieldValue', 'get', array('price_field_id' => $priceField->id));
$contributionParams = array('total_amount' => 300, 'currency' => 'USD', 'contact_id' => $contactId, 'financial_type_id' => 1, 'contribution_status_id' => 1);
foreach ($priceFields['values'] as $key => $priceField) {
$lineItems[1][$key] = array('price_field_id' => $priceField['price_field_id'], 'price_field_value_id' => $priceField['id'], 'label' => $priceField['label'], 'field_title' => $priceField['label'], 'qty' => 1, 'unit_price' => $priceField['amount'], 'line_total' => $priceField['amount'], 'financial_type_id' => $priceField['financial_type_id']);
}
$contributionParams['line_item'] = $lineItems;
$contributions = CRM_Contribute_BAO_Contribution::create($contributionParams);
CRM_Financial_BAO_FinancialType::$_statusACLFt = array();
$this->setACL();
$this->setPermissions(array('view contributions of type Member Dues'));
try {
CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($contributions->id, 'view');
$this->fail("Missed expected exception");
} catch (Exception $e) {
$this->assertEquals("A fatal error was triggered: You do not have permission to access this page.", $e->getMessage());
}
$this->setPermissions(array('view contributions of type Donation'));
$perm = CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($contributions->id, 'view');
$this->assertEquals($perm, TRUE, 'Verify that lineitems now have permission.');
}