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


PHP CRM_Batch_BAO_Batch::getBatchFinancialItems方法代码示例

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


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

示例1: getFinancialTransactionsList

 /**
  * Get output of financial transactions.
  *
  * @param bool $return
  *   Return result. This parameter allows the output to be unit tested.
  *
  * @return string
  */
 public static function getFinancialTransactionsList($return = FALSE)
 {
     $sortMapper = array(0 => '', 1 => '', 2 => 'sort_name', 3 => 'amount', 4 => 'trxn_id', 5 => 'transaction_date', 6 => 'payment_method', 7 => 'status', 8 => 'name');
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $return = isset($_REQUEST['return']) ? CRM_Utils_Type::escape($_REQUEST['return'], 'Boolean') : FALSE;
     $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
     $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
     $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
     $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
     $context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
     $entityID = isset($_REQUEST['entityID']) ? CRM_Utils_Type::escape($_REQUEST['entityID'], 'String') : NULL;
     $notPresent = isset($_REQUEST['notPresent']) ? CRM_Utils_Type::escape($_REQUEST['notPresent'], 'String') : NULL;
     $statusID = isset($_REQUEST['statusID']) ? CRM_Utils_Type::escape($_REQUEST['statusID'], 'String') : NULL;
     $search = isset($_REQUEST['search']) ? TRUE : FALSE;
     $params = $_POST;
     if ($sort && $sortOrder) {
         $params['sortBy'] = $sort . ' ' . $sortOrder;
     }
     $returnvalues = array('civicrm_financial_trxn.payment_instrument_id as payment_method', 'civicrm_contribution.contact_id as contact_id', 'civicrm_contribution.id as contributionID', 'contact_a.sort_name', 'civicrm_financial_trxn.total_amount as amount', 'civicrm_financial_trxn.trxn_id as trxn_id', 'contact_a.contact_type', 'contact_a.contact_sub_type', 'civicrm_financial_trxn.trxn_date as transaction_date', 'name', 'civicrm_contribution.currency as currency', 'civicrm_financial_trxn.status_id as status', 'civicrm_financial_trxn.check_number as check_number');
     $columnHeader = array('contact_type' => '', 'sort_name' => ts('Contact Name'), 'amount' => ts('Amount'), 'trxn_id' => ts('Trxn ID'), 'transaction_date' => ts('Received'), 'payment_method' => ts('Payment Method'), 'status' => ts('Status'), 'name' => ts('Type'));
     if ($sort && $sortOrder) {
         $params['sortBy'] = $sort . ' ' . $sortOrder;
     }
     $params['page'] = $offset / $rowCount + 1;
     $params['rp'] = $rowCount;
     $params['context'] = $context;
     $params['offset'] = ($params['page'] - 1) * $params['rp'];
     $params['rowCount'] = $params['rp'];
     $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
     $params['total'] = 0;
     // get batch list
     if (isset($notPresent)) {
         $financialItem = CRM_Batch_BAO_Batch::getBatchFinancialItems($entityID, $returnvalues, $notPresent, $params);
         if ($search) {
             $unassignedTransactions = CRM_Batch_BAO_Batch::getBatchFinancialItems($entityID, $returnvalues, $notPresent, $params, TRUE);
         } else {
             $unassignedTransactions = CRM_Batch_BAO_Batch::getBatchFinancialItems($entityID, $returnvalues, $notPresent, NULL, TRUE);
         }
         while ($unassignedTransactions->fetch()) {
             $unassignedTransactionsCount[] = $unassignedTransactions->id;
         }
         if (!empty($unassignedTransactionsCount)) {
             $params['total'] = count($unassignedTransactionsCount);
         }
     } else {
         $financialItem = CRM_Batch_BAO_Batch::getBatchFinancialItems($entityID, $returnvalues, NULL, $params);
         $assignedTransactions = CRM_Batch_BAO_Batch::getBatchFinancialItems($entityID, $returnvalues);
         while ($assignedTransactions->fetch()) {
             $assignedTransactionsCount[] = $assignedTransactions->id;
         }
         if (!empty($assignedTransactionsCount)) {
             $params['total'] = count($assignedTransactionsCount);
         }
     }
     $financialitems = array();
     while ($financialItem->fetch()) {
         $row[$financialItem->id] = array();
         foreach ($columnHeader as $columnKey => $columnValue) {
             if ($financialItem->contact_sub_type && $columnKey == 'contact_type') {
                 $row[$financialItem->id][$columnKey] = $financialItem->contact_sub_type;
                 continue;
             }
             $row[$financialItem->id][$columnKey] = $financialItem->{$columnKey};
             if ($columnKey == 'sort_name' && $financialItem->{$columnKey}) {
                 $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid=" . $financialItem->contact_id);
                 $row[$financialItem->id][$columnKey] = '<a href=' . $url . '>' . $financialItem->{$columnKey} . '</a>';
             } elseif ($columnKey == 'payment_method' && $financialItem->{$columnKey}) {
                 $row[$financialItem->id][$columnKey] = CRM_Core_PseudoConstant::getLabel('CRM_Batch_BAO_Batch', 'payment_instrument_id', $financialItem->{$columnKey});
                 if ($row[$financialItem->id][$columnKey] == 'Check') {
                     $checkNumber = $financialItem->check_number ? ' (' . $financialItem->check_number . ')' : '';
                     $row[$financialItem->id][$columnKey] = $row[$financialItem->id][$columnKey] . $checkNumber;
                 }
             } elseif ($columnKey == 'amount' && $financialItem->{$columnKey}) {
                 $row[$financialItem->id][$columnKey] = CRM_Utils_Money::format($financialItem->{$columnKey}, $financialItem->currency);
             } elseif ($columnKey == 'transaction_date' && $financialItem->{$columnKey}) {
                 $row[$financialItem->id][$columnKey] = CRM_Utils_Date::customFormat($financialItem->{$columnKey});
             } elseif ($columnKey == 'status' && $financialItem->{$columnKey}) {
                 $row[$financialItem->id][$columnKey] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $financialItem->{$columnKey});
             }
         }
         if ($statusID == CRM_Core_OptionGroup::getValue('batch_status', 'Open')) {
             if (isset($notPresent)) {
                 $js = "enableActions('x')";
                 $row[$financialItem->id]['check'] = "<input type='checkbox' id='mark_x_" . $financialItem->id . "' name='mark_x_" . $financialItem->id . "' value='1' onclick={$js}></input>";
                 $row[$financialItem->id]['action'] = CRM_Core_Action::formLink(CRM_Financial_Form_BatchTransaction::links(), NULL, array('id' => $financialItem->id, 'contid' => $financialItem->contributionID, 'cid' => $financialItem->contact_id), ts('more'), FALSE, 'financialItem.batch.row', 'FinancialItem', $financialItem->id);
             } else {
                 $js = "enableActions('y')";
                 $row[$financialItem->id]['check'] = "<input type='checkbox' id='mark_y_" . $financialItem->id . "' name='mark_y_" . $financialItem->id . "' value='1' onclick={$js}></input>";
                 $row[$financialItem->id]['action'] = CRM_Core_Action::formLink(CRM_Financial_Page_BatchTransaction::links(), NULL, array('id' => $financialItem->id, 'contid' => $financialItem->contributionID, 'cid' => $financialItem->contact_id), ts('more'), FALSE, 'financialItem.batch.row', 'FinancialItem', $financialItem->id);
             }
         } else {
             $row[$financialItem->id]['check'] = NULL;
//.........这里部分代码省略.........
开发者ID:rollox,项目名称:civicrm-core,代码行数:101,代码来源:AJAX.php


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