當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Contribute_BAO_Contribution::getValuesWithMappings方法代碼示例

本文整理匯總了PHP中CRM_Contribute_BAO_Contribution::getValuesWithMappings方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Contribute_BAO_Contribution::getValuesWithMappings方法的具體用法?PHP CRM_Contribute_BAO_Contribution::getValuesWithMappings怎麽用?PHP CRM_Contribute_BAO_Contribution::getValuesWithMappings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Contribute_BAO_Contribution的用法示例。


在下文中一共展示了CRM_Contribute_BAO_Contribution::getValuesWithMappings方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: preProcess

 /**
  * Set variables up before form is built.
  */
 public function preProcess()
 {
     $id = $this->get('id');
     $params = array('id' => $id);
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->assign('context', $context);
     $values = CRM_Contribute_BAO_Contribution::getValuesWithMappings($params);
     if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && $this->_action & CRM_Core_Action::VIEW) {
         $financialTypeID = CRM_Contribute_PseudoConstant::financialType($values['financial_type_id']);
         CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($id, 'view');
         if (CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($id, 'edit', FALSE)) {
             $this->assign('canEdit', TRUE);
         }
         if (CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($id, 'delete', FALSE)) {
             $this->assign('canDelete', TRUE);
         }
         if (!CRM_Core_Permission::check('view contributions of type ' . $financialTypeID)) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
         }
     } elseif ($this->_action & CRM_Core_Action::VIEW) {
         $this->assign('noACL', TRUE);
     }
     CRM_Contribute_BAO_Contribution::resolveDefaults($values);
     // @todo - I believe this cancelledStatus is unused - if someone reaches the same conclusion
     // by grepping then the next few lines can go.
     $cancelledStatus = TRUE;
     $status = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     if (CRM_Utils_Array::value('contribution_status_id', $values) == array_search('Cancelled', $status)) {
         $cancelledStatus = FALSE;
     }
     $this->assign('cancelledStatus', $cancelledStatus);
     if (!empty($values['contribution_page_id'])) {
         $contribPages = CRM_Contribute_PseudoConstant::contributionPage(NULL, TRUE);
         $values['contribution_page_title'] = CRM_Utils_Array::value(CRM_Utils_Array::value('contribution_page_id', $values), $contribPages);
     }
     // get received into i.e to_financial_account_id from last trxn
     $financialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($values['contribution_id'], 'DESC');
     $values['to_financial_account'] = '';
     if (!empty($financialTrxnId['financialTrxnId'])) {
         $values['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $financialTrxnId['financialTrxnId'], 'to_financial_account_id');
         if ($values['to_financial_account_id']) {
             $values['to_financial_account'] = CRM_Contribute_PseudoConstant::financialAccount($values['to_financial_account_id']);
         }
         $values['payment_processor_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $financialTrxnId['financialTrxnId'], 'payment_processor_id');
         if ($values['payment_processor_id']) {
             $values['payment_processor_name'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor', $values['payment_processor_id'], 'name');
         }
     }
     if (!empty($values['contribution_recur_id'])) {
         $sql = "SELECT  installments, frequency_interval, frequency_unit FROM civicrm_contribution_recur WHERE id = %1";
         $params = array(1 => array($values['contribution_recur_id'], 'Integer'));
         $dao = CRM_Core_DAO::executeQuery($sql, $params);
         if ($dao->fetch()) {
             $values['recur_installments'] = $dao->installments;
             $values['recur_frequency_unit'] = $dao->frequency_unit;
             $values['recur_frequency_interval'] = $dao->frequency_interval;
         }
     }
     $groupTree = CRM_Core_BAO_CustomGroup::getTree('Contribution', $this, $id, 0, CRM_Utils_Array::value('financial_type_id', $values));
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $id);
     $premiumId = NULL;
     if ($id) {
         $dao = new CRM_Contribute_DAO_ContributionProduct();
         $dao->contribution_id = $id;
         if ($dao->find(TRUE)) {
             $premiumId = $dao->id;
             $productID = $dao->product_id;
         }
     }
     if ($premiumId) {
         $productDAO = new CRM_Contribute_DAO_Product();
         $productDAO->id = $productID;
         $productDAO->find(TRUE);
         $this->assign('premium', $productDAO->name);
         $this->assign('option', $dao->product_option);
         $this->assign('fulfilled', $dao->fulfilled_date);
     }
     // Get Note
     $noteValue = CRM_Core_BAO_Note::getNote(CRM_Utils_Array::value('id', $values), 'civicrm_contribution');
     $values['note'] = array_values($noteValue);
     // show billing address location details, if exists
     if (!empty($values['address_id'])) {
         $addressParams = array('id' => CRM_Utils_Array::value('address_id', $values));
         $addressDetails = CRM_Core_BAO_Address::getValues($addressParams, FALSE, 'id');
         $addressDetails = array_values($addressDetails);
         $values['billing_address'] = $addressDetails[0]['display'];
     }
     //assign soft credit record if exists.
     $SCRecords = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($values['contribution_id'], TRUE);
     if (!empty($SCRecords['soft_credit'])) {
         $this->assign('softContributions', $SCRecords['soft_credit']);
         unset($SCRecords['soft_credit']);
     }
     //assign pcp record if exists
     foreach ($SCRecords as $name => $value) {
         $this->assign($name, $value);
     }
//.........這裏部分代碼省略.........
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:101,代碼來源:ContributionView.php


注:本文中的CRM_Contribute_BAO_Contribution::getValuesWithMappings方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。