本文整理汇总了PHP中CRM_Financial_DAO_FinancialType::copyValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Financial_DAO_FinancialType::copyValues方法的具体用法?PHP CRM_Financial_DAO_FinancialType::copyValues怎么用?PHP CRM_Financial_DAO_FinancialType::copyValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Financial_DAO_FinancialType
的用法示例。
在下文中一共展示了CRM_Financial_DAO_FinancialType::copyValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* function to add the financial types
*
* @param array $params reference array contains the values submitted by the form
* @param array $ids reference array contains the id
*
* @access public
* @static
* @return object
*/
static function add(&$params, &$ids)
{
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
$params['is_deductible'] = CRM_Utils_Array::value('is_deductible', $params, false);
$params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, false);
// action is taken depending upon the mode
$financialType = new CRM_Financial_DAO_FinancialType();
$financialType->copyValues($params);
if (CRM_Utils_Array::value('financialType', $ids)) {
$financialType->id = CRM_Utils_Array::value('financialType', $ids);
}
$financialType->save();
// CRM-12470
if (!CRM_Utils_Array::value('financialType', $ids)) {
$titles = CRM_Financial_BAO_FinancialTypeAccount::createDefaultFinancialAccounts($financialType);
$financialType->titles = $titles;
}
return $financialType;
}
示例2: add
/**
* Add the financial types.
*
* @param array $params
* Reference array contains the values submitted by the form.
* @param array $ids
* Reference array contains the id.
*
* @return object
*/
public static function add(&$params, &$ids = array())
{
if (empty($params['id'])) {
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_deductible'] = CRM_Utils_Array::value('is_deductible', $params, FALSE);
$params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
}
// action is taken depending upon the mode
$financialType = new CRM_Financial_DAO_FinancialType();
$financialType->copyValues($params);
if (!empty($ids['financialType'])) {
$financialType->id = CRM_Utils_Array::value('financialType', $ids);
if (self::isACLFinancialTypeStatus()) {
$prevName = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $financialType->id, 'name');
if ($prevName != $params['name']) {
CRM_Core_Session::setStatus(ts("Changing the name of a Financial Type will result in losing the current permissions associated with that Financial Type.\n Before making this change you should likely note the existing permissions at Administer > Users and Permissions > Permissions (Access Control),\n then clicking the Access Control link for your Content Management System, then noting down the permissions for 'CiviCRM: {financial type name} view', etc.\n Then after making the change of name, reset the permissions to the way they were."), ts('Warning'), 'warning');
}
}
}
$financialType->save();
// CRM-12470
if (empty($ids['financialType']) && empty($params['id'])) {
$titles = CRM_Financial_BAO_FinancialTypeAccount::createDefaultFinancialAccounts($financialType);
$financialType->titles = $titles;
}
return $financialType;
}