/**
* Class constructor
*/
- public function __construct( ) {
+ public function __construct() {
parent::__construct( );
}
*
* @static
*/
- public static function del($financialTypeAccountId, $accountId = null) {
+ public static function del($financialTypeAccountId, $accountId = NULL) {
//checking if financial type is present
- $check = false;
+ $check = FALSE;
$relationValues = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
$financialTypeId = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_EntityFinancialAccount', $financialTypeAccountId, 'entity_id' );
$daoString = 'CRM_' . $name[0] . '_DAO_' . $name[1];
$dao = new $daoString();
$dao->financial_type_id = $financialTypeId;
- if ($dao->find(true)) {
- $check = true;
+ if ($dao->find(TRUE)) {
+ $check = TRUE;
break;
}
}
}
else {
$accountRelationShipId = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_EntityFinancialAccount', $financialTypeAccountId, 'account_relationship');
- CRM_Core_Session::setStatus(ts('You cannot remove an account with a %1 relationship because it is being referenced by one or more of the following types of records: Contributions, Contribution Pages, or Membership Types. Consider disabling this type instead if you no longer want it used.', array(1 => $relationValues[$accountRelationShipId])), NUll, 'error');
+ CRM_Core_Session::setStatus(ts('You cannot remove an account with a %1 relationship because it is being referenced by one or more of the following types of records: Contributions, Contribution Pages, or Membership Types. Consider disabling this type instead if you no longer want it used.', array(1 => $relationValues[$accountRelationShipId])), NULL, 'error');
}
return CRM_Utils_System::redirect( CRM_Utils_System::url( 'civicrm/admin/financial/financialType/accounts', "reset=1&action=browse&aid={$accountId}" ));
}
$titles = array();
$financialAccountTypeID = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type');
$accountRelationship = CRM_Core_PseudoConstant::accountOptionValues('account_relationship');
- $relationships = array (
+ $relationships = array(
array_search('Accounts Receivable Account is', $accountRelationship) => array_search('Asset', $financialAccountTypeID),
array_search('Expense Account is', $accountRelationship) => array_search('Expenses', $financialAccountTypeID),
array_search('Cost of Sales Account is', $accountRelationship) => array_search('Cost of Sales', $financialAccountTypeID),
array_search('Income Account is', $accountRelationship) => array_search('Revenue', $financialAccountTypeID),
);
- $dao = CRM_Core_DAO::executeQuery('SELECT id, financial_account_type_id FROM civicrm_financial_account WHERE name LIKE %1',
+ $dao = CRM_Core_DAO::executeQuery('SELECT id, financial_account_type_id FROM civicrm_financial_account WHERE name LIKE %1',
array(1 => array($financialType->name, 'String'))
);
$dao->fetch();
else {
$existingFinancialAccount[$dao->financial_account_type_id] = $dao->id;
}
- $params = array (
+ $params = array(
'entity_table' => 'civicrm_financial_type',
'entity_id' => $financialType->id,
);
}
}
else {
- $params['financial_account_id'] = $existingFinancialAccount[$value];
- $titles[] = $financialType->name;
+ $params['financial_account_id'] = $existingFinancialAccount[$value];
+ $titles[] = $financialType->name;
}
$params['account_relationship'] = $key;
self::add($params);