本文整理汇总了PHP中CRM_Financial_BAO_FinancialAccount::validateTogglingDeferredRevenue方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Financial_BAO_FinancialAccount::validateTogglingDeferredRevenue方法的具体用法?PHP CRM_Financial_BAO_FinancialAccount::validateTogglingDeferredRevenue怎么用?PHP CRM_Financial_BAO_FinancialAccount::validateTogglingDeferredRevenue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Financial_BAO_FinancialAccount
的用法示例。
在下文中一共展示了CRM_Financial_BAO_FinancialAccount::validateTogglingDeferredRevenue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testValidateTogglingDeferredRevenue
/**
* Test Validate if Deferred Account is set for Financial Type.
*/
public function testValidateTogglingDeferredRevenue()
{
$orgContactID = $this->organizationCreate();
//create relationship
$params = array('name_a_b' => 'Relation 1', 'name_b_a' => 'Relation 2', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Organization', 'is_reserved' => 1, 'is_active' => 1);
$relationshipTypeId = $this->relationshipTypeCreate($params);
$ids = array();
$params = array('name' => 'test type', 'domain_id' => 1, 'description' => NULL, 'minimum_fee' => 10, 'duration_unit' => 'year', 'member_of_contact_id' => $orgContactID, 'relationship_type_id' => $relationshipTypeId, 'period_type' => 'fixed', 'duration_interval' => 1, 'financial_type_id' => 1, 'visibility' => 'Public', 'is_active' => 1);
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
$membership = $this->assertDBNotNull('CRM_Member_BAO_MembershipType', $orgContactID, 'name', 'member_of_contact_id', 'Database check on updated membership record.');
$error = CRM_Financial_BAO_FinancialAccount::validateTogglingDeferredRevenue();
$this->assertTrue(!empty($error), "Error message did not appear");
$this->membershipTypeDelete(array('id' => $membershipType->id));
}
示例2: formRule
/**
* Global validation rules for the form.
*
* @param array $values
* posted values of the form
* @param $files
* @param $self
*
* @return array
* list of errors to be posted back to the form
*/
public static function formRule($values, $files, $self)
{
$errors = array();
if (CRM_Utils_Array::value('deferred_revenue_enabled', $values)) {
$errorMessage = CRM_Financial_BAO_FinancialAccount::validateTogglingDeferredRevenue();
if ($errorMessage) {
// Since the error msg is too long and
// takes the whole space to display inline
// therefore setting blank text to highlight the field
// setting actual error msg to _qf_default to show in pop-up screen
$errors['deferred_revenue_enabled'] = ' ';
$errors['_qf_default'] = $errorMessage;
}
}
return $errors;
}