当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount方法代码示例

本文整理汇总了PHP中CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount方法的具体用法?PHP CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount怎么用?PHP CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Financial_BAO_FinancialTypeAccount的用法示例。


在下文中一共展示了CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetFinancialAccount

 /**
  * Check method getFinancialAccount()
  */
 public function testGetFinancialAccount()
 {
     list($financialAccount, $financialType, $financialAccountType) = $this->createFinancialAccount('Asset');
     $params = array('financial_account_id' => $financialAccount->id, 'payment_processor_type_id' => 1, 'domain_id' => 1, 'billing_mode' => 1, 'name' => 'paymentProcessor');
     $processor = CRM_Financial_BAO_PaymentProcessor::create($params);
     $account = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($processor->id, 'civicrm_payment_processor');
     $this->assertEquals($account, $financialAccount->name, 'Verify Financial Account Name');
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:11,代码来源:FinancialTypeAccountTest.php

示例2: recordFinancialAccounts

 /**
  * Create all financial accounts entry.
  *
  * @param array $params
  *   Contribution object, line item array and params for trxn.
  *
  *
  * @param array $financialTrxnValues
  *
  * @return null|object
  */
 public static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL)
 {
     $skipRecords = $update = $return = $isRelatedId = FALSE;
     $additionalParticipantId = array();
     $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     if (CRM_Utils_Array::value('contribution_mode', $params) == 'participant') {
         $entityId = $params['participant_id'];
         $entityTable = 'civicrm_participant';
         $additionalParticipantId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($entityId);
     } elseif (!empty($params['membership_id'])) {
         //so far $params['membership_id'] should only be set coming in from membershipBAO::create so the situation where multiple memberships
         // are created off one contribution should be handled elsewhere
         $entityId = $params['membership_id'];
         $entityTable = 'civicrm_membership';
     } else {
         $entityId = $params['contribution']->id;
         $entityTable = 'civicrm_contribution';
     }
     if (CRM_Utils_Array::value('contribution_mode', $params) == 'membership') {
         $isRelatedId = TRUE;
     }
     $entityID[] = $entityId;
     if (!empty($additionalParticipantId)) {
         $entityID += $additionalParticipantId;
     }
     // prevContribution appears to mean - original contribution object- ie copy of contribution from before the update started that is being updated
     if (empty($params['prevContribution'])) {
         $entityID = NULL;
     } else {
         $update = TRUE;
     }
     $statusId = $params['contribution']->contribution_status_id;
     // CRM-13964 partial payment
     if (CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Partially paid', $contributionStatuses) && !empty($params['partial_payment_total']) && !empty($params['partial_amount_pay'])) {
         $partialAmtPay = $params['partial_amount_pay'];
         $partialAmtTotal = $params['partial_payment_total'];
         $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
         $fromFinancialAccountId = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
         $statusId = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name');
         $params['total_amount'] = $partialAmtPay;
         $balanceTrxnInfo = CRM_Core_BAO_FinancialTrxn::getBalanceTrxnAmt($params['contribution']->id, $params['financial_type_id']);
         if (empty($balanceTrxnInfo['trxn_id'])) {
             // create new balance transaction record
             $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
             $toFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
             $balanceTrxnParams['total_amount'] = $partialAmtTotal;
             $balanceTrxnParams['to_financial_account_id'] = $toFinancialAccount;
             $balanceTrxnParams['contribution_id'] = $params['contribution']->id;
             $balanceTrxnParams['trxn_date'] = !empty($params['contribution']->receive_date) ? $params['contribution']->receive_date : date('YmdHis');
             $balanceTrxnParams['fee_amount'] = CRM_Utils_Array::value('fee_amount', $params);
             $balanceTrxnParams['net_amount'] = CRM_Utils_Array::value('net_amount', $params);
             $balanceTrxnParams['currency'] = $params['contribution']->currency;
             $balanceTrxnParams['trxn_id'] = $params['contribution']->trxn_id;
             $balanceTrxnParams['status_id'] = $statusId;
             $balanceTrxnParams['payment_instrument_id'] = $params['contribution']->payment_instrument_id;
             $balanceTrxnParams['check_number'] = CRM_Utils_Array::value('check_number', $params);
             if (!empty($params['payment_processor'])) {
                 $balanceTrxnParams['payment_processor_id'] = $params['payment_processor'];
             }
             $financialTxn = CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams);
         }
     }
     // build line item array if its not set in $params
     if (empty($params['line_item']) || $additionalParticipantId) {
         CRM_Price_BAO_LineItem::getLineItemArray($params, $entityID, str_replace('civicrm_', '', $entityTable), $isRelatedId);
     }
     if (CRM_Utils_Array::value('contribution_status_id', $params) != array_search('Failed', $contributionStatuses) && !(CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Pending', $contributionStatuses) && !$params['contribution']->is_pay_later)) {
         $skipRecords = TRUE;
         $pendingStatus = array(array_search('Pending', $contributionStatuses), array_search('In Progress', $contributionStatuses));
         if (in_array(CRM_Utils_Array::value('contribution_status_id', $params), $pendingStatus)) {
             $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
             $params['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
         } elseif (!empty($params['payment_processor'])) {
             $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($params['payment_processor'], 'civicrm_payment_processor', 'financial_account_id');
         } elseif (!empty($params['payment_instrument_id'])) {
             $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($params['payment_instrument_id']);
         } else {
             $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name LIKE 'Asset' "));
             $queryParams = array(1 => array($relationTypeId, 'Integer'));
             $params['to_financial_account_id'] = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_financial_account WHERE is_default = 1 AND financial_account_type_id = %1", $queryParams);
         }
         $totalAmount = CRM_Utils_Array::value('total_amount', $params);
         if (!isset($totalAmount) && !empty($params['prevContribution'])) {
             $totalAmount = $params['total_amount'] = $params['prevContribution']->total_amount;
         }
         //build financial transaction params
         $trxnParams = array('contribution_id' => $params['contribution']->id, 'to_financial_account_id' => $params['to_financial_account_id'], 'trxn_date' => !empty($params['contribution']->receive_date) ? $params['contribution']->receive_date : date('YmdHis'), 'total_amount' => $totalAmount, 'fee_amount' => CRM_Utils_Array::value('fee_amount', $params), 'net_amount' => CRM_Utils_Array::value('net_amount', $params, $totalAmount), 'currency' => $params['contribution']->currency, 'trxn_id' => $params['contribution']->trxn_id, 'status_id' => $statusId, 'payment_instrument_id' => $params['contribution']->payment_instrument_id, 'check_number' => CRM_Utils_Array::value('check_number', $params));
         if (!empty($params['payment_processor'])) {
             $trxnParams['payment_processor_id'] = $params['payment_processor'];
//.........这里部分代码省略.........
开发者ID:nganivet,项目名称:civicrm-core,代码行数:101,代码来源:Contribution.php

示例3: setDefaultValues

 /**
  * @return array
  */
 public function setDefaultValues()
 {
     $defaults = array();
     if ($this->_ppType) {
         $defaults['payment_processor_type_id'] = $this->_ppType;
     }
     if (!$this->_id) {
         $defaults['is_active'] = $defaults['is_default'] = 1;
         $defaults['url_site'] = $this->_ppDAO->url_site_default;
         $defaults['url_api'] = $this->_ppDAO->url_api_default;
         $defaults['url_recur'] = $this->_ppDAO->url_recur_default;
         $defaults['url_button'] = $this->_ppDAO->url_button_default;
         $defaults['test_url_site'] = $this->_ppDAO->url_site_test_default;
         $defaults['test_url_api'] = $this->_ppDAO->url_api_test_default;
         $defaults['test_url_recur'] = $this->_ppDAO->url_recur_test_default;
         $defaults['test_url_button'] = $this->_ppDAO->url_button_test_default;
         return $defaults;
     }
     $domainID = CRM_Core_Config::domainID();
     $dao = new CRM_Financial_DAO_PaymentProcessor();
     $dao->id = $this->_id;
     $dao->domain_id = $domainID;
     if (!$dao->find(TRUE)) {
         return $defaults;
     }
     CRM_Core_DAO::storeValues($dao, $defaults);
     // now get testID
     $testDAO = new CRM_Financial_DAO_PaymentProcessor();
     $testDAO->name = $dao->name;
     $testDAO->is_test = 1;
     $testDAO->domain_id = $domainID;
     if ($testDAO->find(TRUE)) {
         $this->_testID = $testDAO->id;
         foreach ($this->_fields as $field) {
             $testName = "test_{$field['name']}";
             $defaults[$testName] = $testDAO->{$field['name']};
         }
     }
     $defaults['financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($dao->id, 'civicrm_payment_processor', 'financial_account_id');
     return $defaults;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:44,代码来源:PaymentProcessor.php

示例4: setDefaultValues

 /**
  * @return array
  */
 public function setDefaultValues()
 {
     $defaults = array();
     if (!$this->_id) {
         $defaults['is_active'] = $defaults['is_default'] = 1;
         $defaults['url_site'] = $this->_ppDAO->url_site_default;
         $defaults['url_api'] = $this->_ppDAO->url_api_default;
         $defaults['url_recur'] = $this->_ppDAO->url_recur_default;
         $defaults['url_button'] = $this->_ppDAO->url_button_default;
         $defaults['test_url_site'] = $this->_ppDAO->url_site_test_default;
         $defaults['test_url_api'] = $this->_ppDAO->url_api_test_default;
         $defaults['test_url_recur'] = $this->_ppDAO->url_recur_test_default;
         $defaults['test_url_button'] = $this->_ppDAO->url_button_test_default;
         $defaults['payment_instrument_id'] = $this->_ppDAO->payment_instrument_id;
         // When user changes payment processor type, it is passed in via $this->_ppType so update defaults array.
         if ($this->_ppType) {
             $defaults['payment_processor_type_id'] = $this->_ppType;
         }
         return $defaults;
     }
     $domainID = CRM_Core_Config::domainID();
     $dao = new CRM_Financial_DAO_PaymentProcessor();
     $dao->id = $this->_id;
     $dao->domain_id = $domainID;
     if (!$dao->find(TRUE)) {
         return $defaults;
     }
     CRM_Core_DAO::storeValues($dao, $defaults);
     // When user changes payment processor type, it is passed in via $this->_ppType so update defaults array.
     if ($this->_ppType) {
         $defaults['payment_processor_type_id'] = $this->_ppType;
     }
     $cards = json_decode(CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor', $this->_id, 'accepted_credit_cards'), TRUE);
     $acceptedCards = array();
     if (!empty($cards)) {
         foreach ($cards as $card => $val) {
             $acceptedCards[$card] = 1;
         }
     }
     $defaults['accept_credit_cards'] = $acceptedCards;
     unset($defaults['accepted_credit_cards']);
     // now get testID
     $testDAO = new CRM_Financial_DAO_PaymentProcessor();
     $testDAO->name = $dao->name;
     $testDAO->is_test = 1;
     $testDAO->domain_id = $domainID;
     if ($testDAO->find(TRUE)) {
         $this->_testID = $testDAO->id;
         foreach ($this->_fields as $field) {
             $testName = "test_{$field['name']}";
             $defaults[$testName] = $testDAO->{$field['name']};
         }
     }
     $defaults['financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($dao->id, 'civicrm_payment_processor', 'financial_account_id');
     return $defaults;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:59,代码来源:PaymentProcessor.php

示例5: testGetFinancialAccount

 /**
  * check method getFinancialAccount()
  */
 function testGetFinancialAccount()
 {
     $params = array('name' => 'TestFinancialAccount', 'accounting_code' => 4800, 'is_deductible' => 0, 'is_active' => 1, 'is_reserved' => 0);
     $ids = array();
     $financialAccount = CRM_Financial_BAO_FinancialAccount::add($params, $ids);
     $params = array('financial_account_id' => $financialAccount->id, 'payment_processor_type_id' => 1, 'domain_id' => 1, 'billing_mode' => 1, 'name' => 'paymentProcessor');
     $processor = CRM_Financial_BAO_PaymentProcessor::create($params);
     $account = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($processor->id, 'civicrm_payment_processor');
     $this->assertEquals($account, 'TestFinancialAccount', 'Verify Financial Account Name');
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:13,代码来源:FinancialTypeAccountTest.php

示例6: setDefaultValues

 /**
  * Set default values for the form.
  */
 public function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     // Default weight & value
     $fieldValues = array('option_group_id' => $this->_gid);
     foreach (array('weight', 'value') as $field) {
         if (empty($defaults[$field])) {
             $defaults[$field] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues, $field);
         }
     }
     //setDefault of contact types for email greeting, postal greeting, addressee, CRM-4575
     if (in_array($this->_gName, array('email_greeting', 'postal_greeting', 'addressee'))) {
         $defaults['contactOptions'] = CRM_Utils_Array::value('filter', $defaults) ? $defaults['filter'] : NULL;
     }
     // CRM-11516
     if ($this->_gName == 'payment_instrument' && $this->_id) {
         $defaults['financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($this->_id, 'civicrm_option_value', 'financial_account_id');
     }
     return $defaults;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:23,代码来源:Options.php

示例7: recordPartialPayment

 /**
  * This function is used to record partial payments for contribution
  *
  * @param array $contribution
  *
  * @param array $params
  *
  * @return object
  */
 public static function recordPartialPayment($contribution, $params)
 {
     $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     $pendingStatus = array(array_search('Pending', $contributionStatuses), array_search('In Progress', $contributionStatuses));
     $statusId = array_search('Completed', $contributionStatuses);
     if (in_array(CRM_Utils_Array::value('contribution_status_id', $contribution), $pendingStatus)) {
         $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
         $balanceTrxnParams['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($contribution['financial_type_id'], $relationTypeId);
     } elseif (!empty($params['payment_processor'])) {
         $balanceTrxnParams['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($contribution['payment_processor'], 'civicrm_payment_processor', 'financial_account_id');
     } elseif (!empty($params['payment_instrument_id'])) {
         $balanceTrxnParams['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($contribution['payment_instrument_id']);
     } else {
         $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name LIKE 'Asset' "));
         $queryParams = array(1 => array($relationTypeId, 'Integer'));
         $balanceTrxnParams['to_financial_account_id'] = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_financial_account WHERE is_default = 1 AND financial_account_type_id = %1", $queryParams);
     }
     $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
     $fromFinancialAccountId = CRM_Contribute_PseudoConstant::financialAccountType($contribution['financial_type_id'], $relationTypeId);
     $balanceTrxnParams['from_financial_account_id'] = $fromFinancialAccountId;
     $balanceTrxnParams['total_amount'] = $params['total_amount'];
     $balanceTrxnParams['contribution_id'] = $params['contribution_id'];
     $balanceTrxnParams['trxn_date'] = !empty($params['contribution_receive_date']) ? $params['contribution_receive_date'] : date('YmdHis');
     $balanceTrxnParams['fee_amount'] = CRM_Utils_Array::value('fee_amount', $params);
     $balanceTrxnParams['net_amount'] = CRM_Utils_Array::value('total_amount', $params);
     $balanceTrxnParams['currency'] = $contribution['currency'];
     $balanceTrxnParams['trxn_id'] = CRM_Utils_Array::value('contribution_trxn_id', $params, NULL);
     $balanceTrxnParams['status_id'] = $statusId;
     $balanceTrxnParams['payment_instrument_id'] = CRM_Utils_Array::value('payment_instrument_id', $params, $contribution['payment_instrument_id']);
     $balanceTrxnParams['check_number'] = CRM_Utils_Array::value('check_number', $params);
     if ($fromFinancialAccountId != NULL && ($statusId == array_search('Completed', $contributionStatuses) || $statusId == array_search('Partially paid', $contributionStatuses))) {
         $balanceTrxnParams['is_payment'] = 1;
     }
     if (!empty($params['payment_processor'])) {
         $balanceTrxnParams['payment_processor_id'] = $params['payment_processor'];
     }
     return CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams);
 }
开发者ID:joshgowans,项目名称:civicrm-core,代码行数:47,代码来源:Contribution.php

示例8: browse

 /**
  * Browse all payment processors.
  *
  * @param null $action
  *
  * @return void
  * @access public
  * @static
  */
 function browse($action = NULL)
 {
     // get all custom groups sorted by weight
     $paymentProcessor = array();
     $dao = new CRM_Financial_DAO_PaymentProcessor();
     $dao->is_test = 0;
     $dao->domain_id = CRM_Core_Config::domainID();
     $dao->orderBy('name');
     $dao->find();
     while ($dao->fetch()) {
         $paymentProcessor[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $paymentProcessor[$dao->id]);
         $paymentProcessor[$dao->id]['payment_processor_type'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessorType', $paymentProcessor[$dao->id]['payment_processor_type_id']);
         // form all action links
         $action = array_sum(array_keys($this->links()));
         // update enable/disable links.
         if ($dao->is_active) {
             $action -= CRM_Core_Action::ENABLE;
         } else {
             $action -= CRM_Core_Action::DISABLE;
         }
         $paymentProcessor[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id), ts('more'), FALSE, 'paymentProcessor.manage.action', 'PaymentProcessor', $dao->id);
         $paymentProcessor[$dao->id]['financialAccount'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($dao->id, 'civicrm_payment_processor');
     }
     $this->assign('rows', $paymentProcessor);
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:35,代码来源:PaymentProcessor.php

示例9: browse

 /**
  * Browse all options
  *
  *
  * @return void
  * @access public
  * @static
  */
 function browse()
 {
     if (!self::$_gName) {
         return parent::browse();
     }
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
     $groupParams = array('name' => self::$_gName);
     $optionValue = CRM_Core_OptionValue::getRows($groupParams, $this->links(), 'component_id,weight');
     $gName = self::$_gName;
     $returnURL = CRM_Utils_System::url("civicrm/admin/options/{$gName}", "reset=1&group={$gName}");
     $filter = "option_group_id = " . self::$_gId;
     CRM_Utils_Weight::addOrder($optionValue, 'CRM_Core_DAO_OptionValue', 'id', $returnURL, $filter);
     // retrieve financial account name for the payment instrument page
     if ($gName = "payment_instrument") {
         foreach ($optionValue as $key => $option) {
             $optionValue[$key]['financial_account'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($key, 'civicrm_option_value');
         }
     }
     $this->assign('includeWysiwygEditor', TRUE);
     $this->assign('rows', $optionValue);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:29,代码来源:Options.php

示例10: browse

 /**
  * Browse all options.
  *
  *
  * @return void
  */
 public function browse()
 {
     if (!self::$_gName) {
         return parent::browse();
     }
     $groupParams = array('name' => self::$_gName);
     $optionValue = CRM_Core_OptionValue::getRows($groupParams, $this->links(), 'component_id,weight');
     $gName = self::$_gName;
     $returnURL = CRM_Utils_System::url("civicrm/admin/options/{$gName}", "reset=1&group={$gName}");
     $filter = "option_group_id = " . self::$_gId;
     CRM_Utils_Weight::addOrder($optionValue, 'CRM_Core_DAO_OptionValue', 'id', $returnURL, $filter);
     // retrieve financial account name for the payment method page
     if ($gName = "payment_instrument") {
         foreach ($optionValue as $key => $option) {
             $optionValue[$key]['financial_account'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($key, 'civicrm_option_value');
         }
     }
     $this->assign('rows', $optionValue);
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:25,代码来源:Options.php

示例11: setDefaultValues

 /**
  * This function sets the default values for the form.
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues()
 {
     $defaults = array();
     $defaults = parent::setDefaultValues();
     if (!CRM_Utils_Array::value('weight', $defaults)) {
         $query = "SELECT max( `weight` ) as weight FROM `civicrm_option_value` where option_group_id=" . $this->_gid;
         $dao = new CRM_Core_DAO();
         $dao->query($query);
         $dao->fetch();
         $defaults['weight'] = $dao->weight + 1;
     }
     // CRM-11516
     if ($this->_gName == 'payment_instrument' && $this->_id) {
         $defaults['financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($this->_id, 'civicrm_option_value', 'financial_account_id');
     }
     //setDefault of contact types for email greeting, postal greeting, addressee, CRM-4575
     if (in_array($this->_gName, array('email_greeting', 'postal_greeting', 'addressee'))) {
         $defaults['contactOptions'] = CRM_Utils_Array::value('filter', $defaults);
     }
     return $defaults;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:29,代码来源:OptionValue.php


注:本文中的CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。