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


PHP CRM_Batch_BAO_Batch类代码示例

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


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

示例1: __construct

 /**
  */
 public function __construct()
 {
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array('CiviCampaign', $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'first_name' => array('title' => ts('First Name'), 'no_repeat' => TRUE), 'last_name' => array('title' => ts('Last Name'), 'no_repeat' => TRUE), 'contact_type' => array('title' => ts('Contact Type'), 'no_repeat' => TRUE), 'contact_sub_type' => array('title' => ts('Contact Subtype'), 'no_repeat' => TRUE), 'do_not_email' => array('title' => ts('Do Not Email'), 'no_repeat' => TRUE), 'is_opt_out' => array('title' => ts('No Bulk Email(Is Opt Out)'), 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE, 'csv_display' => TRUE, 'title' => ts('Contact ID'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Donor Email'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Donor Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'first_donation' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('first_donation_date' => array('title' => ts('First Contribution Date'), 'base_field' => 'receive_date', 'no_repeat' => TRUE), 'first_donation_amount' => array('title' => ts('First Contribution Amount'), 'base_field' => 'total_amount', 'no_repeat' => TRUE))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE, 'csv_display' => TRUE, 'title' => ts('Contribution ID')), 'financial_type_id' => array('title' => ts('Financial Type'), 'default' => TRUE), 'contribution_recur_id' => array('title' => ts('Recurring Contribution Id'), 'name' => 'contribution_recur_id', 'required' => TRUE, 'no_display' => TRUE, 'csv_display' => TRUE), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'contribution_source' => array('name' => 'source', 'title' => ts('Contribution Source')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'receive_date' => array('default' => TRUE), 'receipt_date' => NULL, 'fee_amount' => NULL, 'net_amount' => NULL, 'total_amount' => array('title' => ts('Amount'), 'required' => TRUE)), 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1)), 'total_amount' => array('title' => ts('Contribution Amount'))), 'grouping' => 'contri-fields'), 'civicrm_product' => array('dao' => 'CRM_Contribute_DAO_Product', 'fields' => array('product_name' => array('name' => 'name', 'title' => ts('Premium')))), 'civicrm_contribution_product' => array('dao' => 'CRM_Contribute_DAO_ContributionProduct', 'fields' => array('product_id' => array('no_display' => TRUE), 'product_option' => array('title' => ts('Premium Option')), 'fulfilled_date' => array('title' => ts('Premium Fulfilled Date')), 'contribution_id' => array('no_display' => TRUE))), 'civicrm_contribution_ordinality' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'alias' => 'cordinality', 'filters' => array('ordinality' => array('title' => ts('Contribution Ordinality'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => array(0 => 'First by Contributor', 1 => 'Second or Later by Contributor')))), 'civicrm_membership' => array('dao' => 'CRM_Member_DAO_Membership', 'fields' => array('membership_type_id' => array('title' => ts('Membership Type'), 'required' => TRUE, 'no_repeat' => TRUE), 'membership_start_date' => array('title' => ts('Start Date'), 'default' => TRUE), 'membership_end_date' => array('title' => ts('End Date'), 'default' => TRUE), 'join_date' => array('title' => ts('Join Date'), 'default' => TRUE), 'source' => array('title' => ts('Membership Source'))), 'filters' => array('join_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'membership_start_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'membership_end_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'owner_membership_id' => array('title' => ts('Membership Owner ID'), 'operatorType' => CRM_Report_Form::OP_INT), 'tid' => array('name' => 'membership_type_id', 'title' => ts('Membership Types'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipType())), 'grouping' => 'member-fields'), 'civicrm_membership_status' => array('dao' => 'CRM_Member_DAO_MembershipStatus', 'alias' => 'mem_status', 'fields' => array('membership_status_name' => array('name' => 'name', 'title' => ts('Membership Status'), 'default' => TRUE)), 'filters' => array('sid' => array('name' => 'id', 'title' => ts('Membership Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'))), 'grouping' => 'member-fields'), 'civicrm_note' => array('dao' => 'CRM_Core_DAO_Note', 'fields' => array('contribution_note' => array('name' => 'note', 'title' => ts('Contribution Note'))), 'filters' => array('note' => array('name' => 'note', 'title' => ts('Contribution Note'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING)))) + $this->addAddressFields(FALSE);
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     // Don't show Batch display column and filter unless batches are being used
     $this->_allBatches = CRM_Batch_BAO_Batch::getBatches();
     if (!empty($this->_allBatches)) {
         $this->_columns['civicrm_batch']['dao'] = 'CRM_Batch_DAO_Batch';
         $this->_columns['civicrm_batch']['fields']['batch_id'] = array('name' => 'id', 'title' => ts('Batch Name'));
         $this->_columns['civicrm_batch']['filters']['bid'] = array('name' => 'id', 'title' => ts('Batch Name'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->_allBatches);
         $this->_columns['civicrm_entity_batch']['dao'] = 'CRM_Batch_DAO_EntityBatch';
         $this->_columns['civicrm_entity_batch']['fields']['entity_batch_id'] = array('name' => 'batch_id', 'default' => TRUE, 'no_display' => TRUE);
     }
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_contribution']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:31,代码来源:ContributionDetail.php

示例2: __construct

 /**
  */
 public function __construct()
 {
     $this->_autoIncludeIndexedFieldsAsOrderBys = 1;
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE), 'first_name' => array('title' => ts('First Name')), 'middle_name' => array('title' => ts('Middle Name')), 'last_name' => array('title' => ts('Last Name')), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'gender_id' => array('title' => ts('Gender')), 'birth_date' => array('title' => ts('Birth Date')), 'age' => array('title' => ts('Age'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())'), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE, 'type' => CRM_Utils_Type::T_INT), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Donor Email'), 'default' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Donor Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'list_contri_id' => array('name' => 'id', 'title' => ts('Contribution ID')), 'financial_type_id' => array('title' => ts('Financial Type'), 'default' => TRUE), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'contribution_page_id' => array('title' => ts('Contribution Page')), 'source' => array('title' => ts('Source')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'check_number' => array('title' => ts('Check Number')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'receive_date' => array('default' => TRUE), 'receipt_date' => NULL, 'total_amount' => array('title' => ts('Amount'), 'required' => TRUE, 'statistics' => array('sum' => ts('Amount'))), 'fee_amount' => NULL, 'net_amount' => NULL, 'contribution_or_soft' => array('title' => ts('Contribution OR Soft Credit?'), 'dbAlias' => "'Contribution'"), 'soft_credits' => array('title' => ts('Soft Credits'), 'dbAlias' => "NULL"), 'soft_credit_for' => array('title' => ts('Soft Credit For'), 'dbAlias' => "NULL")), 'filters' => array('contribution_or_soft' => array('title' => ts('Contribution OR Soft Credit?'), 'clause' => "(1)", 'operatorType' => CRM_Report_Form::OP_SELECT, 'type' => CRM_Utils_Type::T_STRING, 'options' => array('both' => ts('Both'), 'contributions_only' => ts('Contributions Only'), 'soft_credits_only' => ts('Soft Credits Only'))), 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType(), 'type' => CRM_Utils_Type::T_INT), 'contribution_page_id' => array('title' => ts('Contribution Page'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionPage(), 'type' => CRM_Utils_Type::T_INT), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument(), 'type' => CRM_Utils_Type::T_INT), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1), 'type' => CRM_Utils_Type::T_INT), 'total_amount' => array('title' => ts('Contribution Amount'))), 'order_bys' => array('financial_type_id' => array('title' => ts('Financial Type')), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Instrument')), 'receive_date' => array('title' => ts('Receive Date'))), 'grouping' => 'contri-fields'), 'civicrm_contribution_soft' => array('dao' => 'CRM_Contribute_DAO_ContributionSoft', 'fields' => array('soft_credit_type_id' => array('title' => ts('Soft Credit Type'))), 'filters' => array('soft_credit_type_id' => array('title' => 'Soft Credit Type', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('soft_credit_type'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING))), 'civicrm_contribution_ordinality' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'alias' => 'cordinality', 'filters' => array('ordinality' => array('title' => ts('Contribution Ordinality'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => array(0 => 'First by Contributor', 1 => 'Second or Later by Contributor'), 'type' => CRM_Utils_Type::T_INT))), 'civicrm_note' => array('dao' => 'CRM_Core_DAO_Note', 'fields' => array('contribution_note' => array('name' => 'note', 'title' => ts('Contribution Note'))), 'filters' => array('note' => array('name' => 'note', 'title' => ts('Contribution Note'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING)))) + $this->addAddressFields(FALSE);
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     // Don't show Batch display column and filter unless batches are being used
     $this->_allBatches = CRM_Batch_BAO_Batch::getBatches();
     if (!empty($this->_allBatches)) {
         $this->_columns['civicrm_batch']['dao'] = 'CRM_Batch_DAO_Batch';
         $this->_columns['civicrm_batch']['fields']['batch_id'] = array('name' => 'id', 'title' => ts('Batch Name'));
         $this->_columns['civicrm_batch']['filters']['bid'] = array('name' => 'id', 'title' => ts('Batch Name'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->_allBatches);
         $this->_columns['civicrm_entity_batch']['dao'] = 'CRM_Batch_DAO_EntityBatch';
         $this->_columns['civicrm_entity_batch']['fields']['entity_batch_id'] = array('name' => 'batch_id', 'default' => TRUE, 'no_display' => TRUE);
     }
     // If we have active campaigns add those elements to both the fields and filters
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_contribution']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
开发者ID:kidaa30,项目名称:yes,代码行数:34,代码来源:Detail.php

示例3: getBatchList

 /**
  * Retrieve records.
  */
 public static function getBatchList()
 {
     $sortMapper = array(0 => 'batch.title', 1 => 'batch.type_id', 2 => '', 3 => 'batch.total', 4 => 'batch.status_id', 5 => '');
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $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;
     $params = $_REQUEST;
     if ($sort && $sortOrder) {
         $params['sortBy'] = $sort . ' ' . $sortOrder;
     }
     $params['page'] = $offset / $rowCount + 1;
     $params['rp'] = $rowCount;
     if ($context != 'financialBatch') {
         // data entry status batches
         $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
     }
     $params['context'] = $context;
     // get batch list
     $batches = CRM_Batch_BAO_Batch::getBatchListSelector($params);
     $iFilteredTotal = $iTotal = $params['total'];
     if ($context == 'financialBatch') {
         $selectorElements = array('check', 'batch_name', 'payment_instrument', 'item_count', 'total', 'status', 'created_by', 'links');
     } else {
         $selectorElements = array('batch_name', 'type', 'item_count', 'total', 'status', 'created_by', 'links');
     }
     CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($batches, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:35,代码来源:AJAX.php

示例4: postProcess

 function postProcess()
 {
     $batchIds = array();
     foreach ($_POST as $key => $value) {
         if (substr($key, 0, 6) == "check_") {
             $batch = explode("_", $key);
             $batchIds[] = $batch[1];
         }
     }
     if (!empty($_POST['batch_update'])) {
         CRM_Batch_BAO_Batch::closeReOpen($batchIds, $_POST['batch_update']);
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:13,代码来源:Search.php

示例5: __construct

 /**
  * Class constructor.
  */
 public function __construct()
 {
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array_merge($this->getBasicContactFields(), array('sort_name' => array('title' => ts('Contact Name'), 'no_repeat' => TRUE))), 'grouping' => 'contact-fields', 'group_bys' => array('id' => array('title' => ts('Contact ID')), 'sort_name' => array('title' => ts('Contact Name')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_financial_type' => array('dao' => 'CRM_Financial_DAO_FinancialType', 'fields' => array('financial_type' => NULL), 'grouping' => 'contri-fields', 'group_bys' => array('financial_type' => array('title' => ts('Financial Type')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_status_id' => array('title' => ts('Contribution Status')), 'contribution_source' => array('title' => ts('Source')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'total_amount' => array('title' => ts('Contribution Amount Stats'), 'default' => TRUE, 'statistics' => array('count' => ts('Contributions'), 'sum' => ts('Contribution Aggregate'), 'avg' => ts('Contribution Avg')))), 'grouping' => 'contri-fields', 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1), 'type' => CRM_Utils_Type::T_INT), 'currency' => array('title' => ts('Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(), 'type' => CRM_Utils_Type::T_INT), 'contribution_page_id' => array('title' => ts('Contribution Page'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionPage(), 'type' => CRM_Utils_Type::T_INT), 'total_amount' => array('title' => ts('Contribution Amount')), 'total_sum' => array('title' => ts('Contribution Aggregate'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_sum', 'having' => TRUE), 'total_count' => array('title' => ts('Contribution Count'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_count', 'having' => TRUE), 'total_avg' => array('title' => ts('Contribution Avg'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_avg', 'having' => TRUE)), 'group_bys' => array('receive_date' => array('frequency' => TRUE, 'default' => TRUE, 'chart' => TRUE), 'contribution_source' => NULL, 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1), 'type' => CRM_Utils_Type::T_INT))), 'civicrm_batch' => array('dao' => 'CRM_Batch_DAO_EntityBatch', 'grouping' => 'contri-fields', 'filters' => array('batch_id' => array('title' => ts('Batch Title'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Batch_BAO_Batch::getBatches(), 'type' => CRM_Utils_Type::T_INT))), 'civicrm_contribution_soft' => array('dao' => 'CRM_Contribute_DAO_ContributionSoft', 'fields' => array('soft_amount' => array('title' => ts('Soft Credit Amount Stats'), 'name' => 'amount', 'statistics' => array('count' => ts('Soft Credits'), 'sum' => ts('Soft Credit Aggregate'), 'avg' => ts('Soft Credit Avg')))), 'grouping' => 'contri-fields', 'filters' => array('amount' => array('title' => ts('Soft Credit Amount')), 'soft_credit_type_id' => array('title' => ts('Soft Credit Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('soft_credit_type'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'soft_sum' => array('title' => ts('Soft Credit Aggregate'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_sum', 'having' => TRUE), 'soft_count' => array('title' => ts('Soft Credits Count'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_count', 'having' => TRUE), 'soft_avg' => array('title' => ts('Soft Credit Avg'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_avg', 'having' => TRUE)))) + $this->addAddressFields();
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_contribution']['group_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_tagFilter = TRUE;
     $this->_groupFilter = TRUE;
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:25,代码来源:Summary.php

示例6: postProcess

 /**
  * Process the form after the input has been submitted and validated.
  *
  *
  * @return void
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $params['actualBatchTotal'] = 0;
     // get the profile information
     $batchTypes = CRM_Core_Pseudoconstant::get('CRM_Batch_DAO_Batch', 'type_id', array('flip' => 1), 'validate');
     if (in_array($this->_batchInfo['type_id'], array($batchTypes['Pledge Payment'], $batchTypes['Contribution']))) {
         $this->processContribution($params);
     } elseif ($this->_batchInfo['type_id'] == $batchTypes['Membership']) {
         $this->processMembership($params);
     }
     // update batch to close status
     $paramValues = array('id' => $this->_batchId, 'status_id' => CRM_Core_OptionGroup::getValue('batch_status', 'Closed', 'name'), 'total' => $params['actualBatchTotal']);
     CRM_Batch_BAO_Batch::create($paramValues);
     // set success status
     CRM_Core_Session::setStatus("", ts("Batch Processed."), "success");
     CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/batch', 'reset=1'));
 }
开发者ID:vakeesan26,项目名称:civicrm-core,代码行数:24,代码来源:Entry.php

示例7: alterDisplay

 /**
  * @param $rows
  */
 public function alterDisplay(&$rows)
 {
     // custom code to alter rows
     $checkList = array();
     $entryFound = FALSE;
     $contributionTypes = CRM_Contribute_PseudoConstant::financialType();
     $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
     $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
     $batches = CRM_Batch_BAO_Batch::getBatches();
     //altering the csv display adding additional fields
     if ($this->_outputMode == 'csv') {
         foreach ($this->_columns as $tableName => $table) {
             if (array_key_exists('fields', $table)) {
                 foreach ($table['fields'] as $fieldName => $field) {
                     if (!empty($field['csv_display']) && !empty($field['no_display'])) {
                         $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
                         $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
                     }
                 }
             }
         }
     }
     // allow repeat for first donation amount and date in csv
     $fAmt = '';
     $fDate = '';
     foreach ($rows as $rowNum => $row) {
         if ($this->_outputMode == 'csv') {
             if (array_key_exists('civicrm_contact_id', $row)) {
                 if ($contactId = $row['civicrm_contact_id']) {
                     if ($rowNum == 0) {
                         $pcid = $contactId;
                         $fAmt = $row['first_donation_first_donation_amount'];
                         $fDate = $row['first_donation_first_donation_date'];
                     } else {
                         if ($pcid == $contactId) {
                             $rows[$rowNum]['first_donation_first_donation_amount'] = $fAmt;
                             $rows[$rowNum]['first_donation_first_donation_date'] = $fDate;
                             $pcid = $contactId;
                         } else {
                             $fAmt = $row['first_donation_first_donation_amount'];
                             $fDate = $row['first_donation_first_donation_date'];
                             $pcid = $contactId;
                         }
                     }
                 }
             }
         }
         if (!empty($this->_noRepeats) && $this->_outputMode != 'csv') {
             $repeatFound = FALSE;
             $display_flag = NULL;
             if (array_key_exists('civicrm_contact_id', $row)) {
                 if ($cid = $row['civicrm_contact_id']) {
                     if ($rowNum == 0) {
                         $prev_cid = $cid;
                     } else {
                         if ($prev_cid == $cid) {
                             $display_flag = 1;
                             $prev_cid = $cid;
                         } else {
                             $display_flag = 0;
                             $prev_cid = $cid;
                         }
                     }
                     if ($display_flag) {
                         foreach ($row as $colName => $colVal) {
                             if (in_array($colName, $this->_noRepeats)) {
                                 unset($rows[$rowNum][$colName]);
                             }
                         }
                     }
                     $entryFound = TRUE;
                 }
             }
         }
         if (array_key_exists('civicrm_membership_membership_type_id', $row)) {
             if ($value = $row['civicrm_membership_membership_type_id']) {
                 $rows[$rowNum]['civicrm_membership_membership_type_id'] = CRM_Member_PseudoConstant::membershipType($value, FALSE);
             }
             $entryFound = TRUE;
         }
         if (!empty($row['civicrm_batch_batch_id'])) {
             $rows[$rowNum]['civicrm_batch_batch_id'] = CRM_Utils_Array::value($row['civicrm_batch_batch_id'], $batches);
             $entryFound = TRUE;
         }
         if (array_key_exists('civicrm_address_state_province_id', $row)) {
             if ($value = $row['civicrm_address_state_province_id']) {
                 $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvince($value, FALSE);
             }
             $entryFound = TRUE;
         }
         if (array_key_exists('civicrm_address_country_id', $row)) {
             if ($value = $row['civicrm_address_country_id']) {
                 $rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($value, FALSE);
             }
             $entryFound = TRUE;
         }
         // convert donor sort name to link
//.........这里部分代码省略.........
开发者ID:nielosz,项目名称:civicrm-core,代码行数:101,代码来源:ContributionDetail.php

示例8: createActivityExport

 /**
  * @param $batchIds
  * @param string $fileName
  *
  * @throws CRM_Core_Exception
  */
 public static function createActivityExport($batchIds, $fileName)
 {
     $session = CRM_Core_Session::singleton();
     $values = array();
     $params = array('id' => $batchIds);
     CRM_Batch_BAO_Batch::retrieve($params, $values);
     $createdBy = CRM_Contact_BAO_Contact::displayName($values['created_id']);
     $modifiedBy = CRM_Contact_BAO_Contact::displayName($values['modified_id']);
     $values['payment_instrument_id'] = '';
     if (isset($values['payment_instrument_id'])) {
         $paymentInstrument = array_flip(CRM_Contribute_PseudoConstant::paymentInstrument('label'));
         $values['payment_instrument_id'] = array_search($values['payment_instrument_id'], $paymentInstrument);
     }
     $details = '<p>' . ts('Record:') . ' ' . $values['title'] . '</p><p>' . ts('Description:') . '</p><p>' . ts('Created By:') . " {$createdBy}" . '</p><p>' . ts('Created Date:') . ' ' . $values['created_date'] . '</p><p>' . ts('Last Modified By:') . ' ' . $modifiedBy . '</p><p>' . ts('Payment Instrument:') . ' ' . $values['payment_instrument_id'] . '</p>';
     $subject = '';
     if (!empty($values['total'])) {
         $subject .= ts('Total') . '[' . CRM_Utils_Money::format($values['total']) . '],';
     }
     if (!empty($values['item_count'])) {
         $subject .= ' ' . ts('Count') . '[' . $values['item_count'] . '],';
     }
     //create activity.
     $subject .= ' ' . ts('Batch') . '[' . $values['title'] . ']';
     $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
     $activityParams = array('activity_type_id' => array_search('Export Accounting Batch', $activityTypes), 'subject' => $subject, 'status_id' => 2, 'activity_date_time' => date('YmdHis'), 'source_contact_id' => $session->get('userID'), 'source_record_id' => $values['id'], 'target_contact_id' => $session->get('userID'), 'details' => $details, 'attachFile_1' => array('uri' => $fileName, 'type' => 'text/csv', 'location' => $fileName, 'upload_date' => date('YmdHis')));
     CRM_Activity_BAO_Activity::create($activityParams);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:33,代码来源:ExportFormat.php

示例9: getBatchSummary

 public static function getBatchSummary()
 {
     $batchID = CRM_Utils_Type::escape($_REQUEST['batchID'], 'String');
     $params = array('id' => $batchID);
     $batchInfo = CRM_Batch_BAO_Batch::retrieve($params, $value);
     $batchTotals = CRM_Batch_BAO_Batch::batchTotals(array($batchID));
     $batchSummary = array('created_by' => CRM_Contact_BAO_Contact::displayName($batchInfo->created_id), 'status' => CRM_Core_OptionGroup::getLabel('batch_status', $batchInfo->status_id), 'description' => $batchInfo->description, 'payment_instrument' => CRM_Core_OptionGroup::getLabel('payment_instrument', $batchInfo->payment_instrument_id), 'item_count' => $batchInfo->item_count, 'assigned_item_count' => $batchTotals[$batchID]['item_count'], 'total' => CRM_Utils_Money::format($batchInfo->total), 'assigned_total' => CRM_Utils_Money::format($batchTotals[$batchID]['total']), 'opened_date' => CRM_Utils_Date::customFormat($batchInfo->created_date));
     CRM_Utils_JSON::output($batchSummary);
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:9,代码来源:AJAX.php

示例10: postProcess

 /**
  * Process the form submission.
  *
  * @return void
  */
 public function postProcess()
 {
     $session = CRM_Core_Session::singleton();
     $ids = array();
     $params = $this->exportValues();
     $batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id');
     if ($this->_id) {
         $ids['batchID'] = $this->_id;
         $params['id'] = $this->_id;
     }
     // store the submitted values in an array
     $params['modified_date'] = date('YmdHis');
     $params['modified_id'] = $session->get('userID');
     if (!empty($params['created_date'])) {
         $params['created_date'] = CRM_Utils_Date::processDate($params['created_date']);
     }
     if ($this->_action & CRM_Core_Action::ADD) {
         $batchMode = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'mode_id', array('labelColumn' => 'name'));
         $params['mode_id'] = CRM_Utils_Array::key('Manual Batch', $batchMode);
         $params['status_id'] = CRM_Utils_Array::key('Open', $batchStatus);
         $params['created_date'] = date('YmdHis');
         $params['created_id'] = $session->get('userID');
         $details = "{$params['title']} batch has been created by this contact.";
         $activityTypeName = 'Create Batch';
     } elseif ($this->_action & CRM_Core_Action::UPDATE && $this->_id) {
         $details = "{$params['title']} batch has been edited by this contact.";
         if (CRM_Utils_Array::value($params['status_id'], $batchStatus) == 'Closed') {
             $details = "{$params['title']} batch has been closed by this contact.";
         }
         $activityTypeName = 'Edit Batch';
     }
     $batch = CRM_Batch_BAO_Batch::create($params, $ids, 'financialBatch');
     $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
     //create activity.
     $activityParams = array('activity_type_id' => array_search($activityTypeName, $activityTypes), 'subject' => $batch->title . "- Batch", 'status_id' => 2, 'priority_id' => 2, 'activity_date_time' => date('YmdHis'), 'source_contact_id' => $session->get('userID'), 'source_contact_qid' => $session->get('userID'), 'details' => $details);
     CRM_Activity_BAO_Activity::create($activityParams);
     $buttonName = $this->controller->getButtonName();
     $context = $this->get("context");
     if ($batch->title) {
         CRM_Core_Session::setStatus(ts("'%1' batch has been saved.", array(1 => $batch->title)), ts('Saved'), 'success');
     }
     if ($buttonName == $this->getButtonName('next', 'new') & $this->_action == CRM_Core_Action::UPDATE) {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/financial/batch', "reset=1&action=add&context=1"));
     } elseif ($buttonName == $this->getButtonName('next', 'new')) {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/financial/batch', "reset=1&action=add"));
     } elseif (CRM_Utils_Array::value($batch->status_id, $batchStatus) == 'Closed') {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm', 'reset=1'));
     } elseif ($buttonName == $this->getButtonName('next') & $this->_action == CRM_Core_Action::UPDATE || $buttonName == $this->getButtonName('next') & $this->_action == CRM_Core_Action::ADD & $context == 1) {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/financial/financialbatches', "reset=1&batchStatus=1"));
     } else {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/batchtransaction', "reset=1&bid={$batch->id}"));
     }
 }
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:58,代码来源:FinancialBatch.php

示例11: makeBatchSummary

 /**
  * Makes an array of the batch's summary and returns array to parent getBatchSummary() function.
  *
  * @param $batchID
  * @param $params
  *
  * @return array
  */
 public static function makeBatchSummary($batchID, $params)
 {
     $batchInfo = CRM_Batch_BAO_Batch::retrieve($params, $value);
     $batchTotals = CRM_Batch_BAO_Batch::batchTotals(array($batchID));
     $batchSummary = array('created_by' => CRM_Contact_BAO_Contact::displayName($batchInfo->created_id), 'status' => CRM_Core_PseudoConstant::getLabel('CRM_Batch_BAO_Batch', 'status_id', $batchInfo->status_id), 'description' => $batchInfo->description, 'payment_instrument' => CRM_Core_PseudoConstant::getLabel('CRM_Batch_BAO_Batch', 'payment_instrument_id', $batchInfo->payment_instrument_id), 'item_count' => $batchInfo->item_count, 'assigned_item_count' => $batchTotals[$batchID]['item_count'], 'total' => CRM_Utils_Money::format($batchInfo->total), 'assigned_total' => CRM_Utils_Money::format($batchTotals[$batchID]['total']), 'opened_date' => CRM_Utils_Date::customFormat($batchInfo->created_date));
     return $batchSummary;
 }
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:15,代码来源:AJAX.php

示例12: postProcess

 /**
  * Process the form after the input has been submitted and validated.
  */
 public function postProcess()
 {
     if (!$this->_exportFormat) {
         $params = $this->exportValues();
         $this->_exportFormat = $params['export_format'];
     }
     if ($this->_id) {
         $batchIds = array($this->_id);
     } elseif (!empty($this->_batchIds)) {
         $batchIds = explode(',', $this->_batchIds);
     }
     // Recalculate totals
     $totals = CRM_Batch_BAO_Batch::batchTotals($batchIds);
     // build batch params
     $session = CRM_Core_Session::singleton();
     $batchParams['modified_date'] = date('YmdHis');
     $batchParams['modified_id'] = $session->get('userID');
     $batchParams['status_id'] = $this->_exportStatusId;
     $ids = array();
     foreach ($batchIds as $batchId) {
         $batchParams['id'] = $ids['batchID'] = $batchId;
         // Update totals
         $batchParams = array_merge($batchParams, $totals[$batchId]);
         CRM_Batch_BAO_Batch::create($batchParams, $ids, 'financialBatch');
     }
     CRM_Batch_BAO_Batch::exportFinancialBatch($batchIds, $this->_exportFormat);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:30,代码来源:Export.php

示例13: alterDisplay

 /**
  * Alter display of rows.
  *
  * Iterate through the rows retrieved via SQL and make changes for display purposes,
  * such as rendering contacts as links.
  *
  * @param array $rows
  *   Rows generated by SQL, with an array for each row.
  */
 public function alterDisplay(&$rows)
 {
     $checkList = array();
     $entryFound = FALSE;
     $display_flag = $prev_cid = $cid = 0;
     $contributionTypes = CRM_Contribute_PseudoConstant::financialType();
     $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
     $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
     $contributionPages = CRM_Contribute_PseudoConstant::contributionPage();
     $batches = CRM_Batch_BAO_Batch::getBatches();
     foreach ($rows as $rowNum => $row) {
         if (!empty($this->_noRepeats) && $this->_outputMode != 'csv') {
             // don't repeat contact details if its same as the previous row
             if (array_key_exists('civicrm_contact_id', $row)) {
                 if ($cid = $row['civicrm_contact_id']) {
                     if ($rowNum == 0) {
                         $prev_cid = $cid;
                     } else {
                         if ($prev_cid == $cid) {
                             $display_flag = 1;
                             $prev_cid = $cid;
                         } else {
                             $display_flag = 0;
                             $prev_cid = $cid;
                         }
                     }
                     if ($display_flag) {
                         foreach ($row as $colName => $colVal) {
                             // Hide repeats in no-repeat columns, but not if the field's a section header
                             if (in_array($colName, $this->_noRepeats) && !array_key_exists($colName, $this->_sections)) {
                                 unset($rows[$rowNum][$colName]);
                             }
                         }
                     }
                     $entryFound = TRUE;
                 }
             }
         }
         if (CRM_Utils_Array::value('civicrm_contribution_contribution_or_soft', $rows[$rowNum]) == 'Contribution') {
             unset($rows[$rowNum]['civicrm_contribution_soft_soft_credit_type_id']);
         }
         $entryFound = $this->alterDisplayContactFields($row, $rows, $rowNum, 'contribution/detail', ts('View Contribution Details')) ? TRUE : $entryFound;
         // convert donor sort name to link
         if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) && array_key_exists('civicrm_contact_id', $row)) {
             $url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $row['civicrm_contact_id'], $this->_absoluteUrl);
             $rows[$rowNum]['civicrm_contact_sort_name_link'] = $url;
             $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("View Contact Summary for this Contact.");
         }
         if ($value = CRM_Utils_Array::value('civicrm_contribution_financial_type_id', $row)) {
             $rows[$rowNum]['civicrm_contribution_financial_type_id'] = $contributionTypes[$value];
             $entryFound = TRUE;
         }
         if ($value = CRM_Utils_Array::value('civicrm_contribution_contribution_status_id', $row)) {
             $rows[$rowNum]['civicrm_contribution_contribution_status_id'] = $contributionStatus[$value];
             $entryFound = TRUE;
         }
         if ($value = CRM_Utils_Array::value('civicrm_contribution_contribution_page_id', $row)) {
             $rows[$rowNum]['civicrm_contribution_contribution_page_id'] = $contributionPages[$value];
             $entryFound = TRUE;
         }
         if ($value = CRM_Utils_Array::value('civicrm_contribution_payment_instrument_id', $row)) {
             $rows[$rowNum]['civicrm_contribution_payment_instrument_id'] = $paymentInstruments[$value];
             $entryFound = TRUE;
         }
         if (!empty($row['civicrm_batch_batch_id'])) {
             $rows[$rowNum]['civicrm_batch_batch_id'] = CRM_Utils_Array::value($row['civicrm_batch_batch_id'], $batches);
             $entryFound = TRUE;
         }
         // Contribution amount links to viewing contribution
         if (($value = CRM_Utils_Array::value('civicrm_contribution_total_amount_sum', $row)) && CRM_Core_Permission::check('access CiviContribute')) {
             $url = CRM_Utils_System::url("civicrm/contact/view/contribution", "reset=1&id=" . $row['civicrm_contribution_contribution_id'] . "&cid=" . $row['civicrm_contact_id'] . "&action=view&context=contribution&selectedChild=contribute", $this->_absoluteUrl);
             $rows[$rowNum]['civicrm_contribution_total_amount_sum_link'] = $url;
             $rows[$rowNum]['civicrm_contribution_total_amount_sum_hover'] = ts("View Details of this Contribution.");
             $entryFound = TRUE;
         }
         // convert campaign_id to campaign title
         if (array_key_exists('civicrm_contribution_campaign_id', $row)) {
             if ($value = $row['civicrm_contribution_campaign_id']) {
                 $rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->activeCampaigns[$value];
                 $entryFound = TRUE;
             }
         }
         // soft credits
         if (array_key_exists('civicrm_contribution_soft_credits', $row) && 'Contribution' == CRM_Utils_Array::value('civicrm_contribution_contribution_or_soft', $rows[$rowNum]) && array_key_exists('civicrm_contribution_contribution_id', $row)) {
             $query = "\nSELECT civicrm_contact_id, civicrm_contact_sort_name, civicrm_contribution_total_amount_sum, civicrm_contribution_currency\nFROM   civireport_contribution_detail_temp2\nWHERE  civicrm_contribution_contribution_id={$row['civicrm_contribution_contribution_id']}";
             $dao = CRM_Core_DAO::executeQuery($query);
             $string = '';
             $separator = $this->_outputMode !== 'csv' ? "<br/>" : ' ';
             while ($dao->fetch()) {
                 $url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $dao->civicrm_contact_id);
                 $string = $string . ($string ? $separator : '') . "<a href='{$url}'>{$dao->civicrm_contact_sort_name}</a> " . CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_sum, $dao->civicrm_contribution_currency);
//.........这里部分代码省略.........
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:101,代码来源:Detail.php

示例14: postProcess

 /**
  * Process the form submission.
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Core_Session::setStatus("", ts("Batch Deleted"), "success");
         CRM_Batch_BAO_Batch::deleteBatch($this->_id);
         return;
     }
     if ($this->_id) {
         $params['id'] = $this->_id;
     } else {
         $session = CRM_Core_Session::singleton();
         $params['created_id'] = $session->get('userID');
         $params['created_date'] = CRM_Utils_Date::processDate(date("Y-m-d"), date("H:i:s"));
     }
     // always create with data entry status
     $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
     $batch = CRM_Batch_BAO_Batch::create($params);
     // redirect to batch entry page.
     $session = CRM_Core_Session::singleton();
     if ($this->_action & CRM_Core_Action::ADD) {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/batch/entry', "id={$batch->id}&reset=1&action=add"));
     } else {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/batch/entry', "id={$batch->id}&reset=1"));
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:29,代码来源:Batch.php

示例15: recordFinancialAccounts


//.........这里部分代码省略.........
                 $incomeTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
                 $oldFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['prevContribution']->financial_type_id, $incomeTypeId);
                 $newFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $incomeTypeId);
                 if ($oldFinancialAccount != $newFinancialAccount) {
                     $params['total_amount'] = 0;
                     if (in_array($params['contribution']->contribution_status_id, $pendingStatus)) {
                         $params['trxnParams']['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($params['prevContribution']->financial_type_id, $relationTypeId);
                     } else {
                         $lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['prevContribution']->id, 'DESC');
                         if (!empty($lastFinancialTrxnId['financialTrxnId'])) {
                             $params['trxnParams']['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $lastFinancialTrxnId['financialTrxnId'], 'to_financial_account_id');
                         }
                     }
                     self::updateFinancialAccounts($params, 'changeFinancialType');
                     /* $params['trxnParams']['to_financial_account_id'] = $trxnParams['to_financial_account_id']; */
                     $params['financial_account_id'] = $newFinancialAccount;
                     $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
                     self::updateFinancialAccounts($params);
                     $params['trxnParams']['to_financial_account_id'] = $trxnParams['to_financial_account_id'];
                 }
             }
             //Update contribution status
             $params['trxnParams']['status_id'] = $params['contribution']->contribution_status_id;
             $params['trxnParams']['trxn_id'] = $params['contribution']->trxn_id;
             if (!empty($params['contribution_status_id']) && $params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id) {
                 //Update Financial Records
                 self::updateFinancialAccounts($params, 'changedStatus');
             }
             // change Payment Instrument for a Completed contribution
             // first handle special case when contribution is changed from Pending to Completed status when initial payment
             // instrument is null and now new payment instrument is added along with the payment
             $params['trxnParams']['payment_instrument_id'] = $params['contribution']->payment_instrument_id;
             $params['trxnParams']['check_number'] = CRM_Utils_Array::value('check_number', $params);
             if (array_key_exists('payment_instrument_id', $params)) {
                 $params['trxnParams']['total_amount'] = -$trxnParams['total_amount'];
                 if (CRM_Utils_System::isNull($params['prevContribution']->payment_instrument_id) && !CRM_Utils_System::isNull($params['contribution']->payment_instrument_id)) {
                     //check if status is changed from Pending to Completed
                     // do not update payment instrument changes for Pending to Completed
                     if (!($params['contribution']->contribution_status_id == array_search('Completed', $contributionStatuses) && in_array($params['prevContribution']->contribution_status_id, $pendingStatus))) {
                         // for all other statuses create new financial records
                         self::updateFinancialAccounts($params, 'changePaymentInstrument');
                         $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
                         self::updateFinancialAccounts($params, 'changePaymentInstrument');
                     }
                 } elseif ((!CRM_Utils_System::isNull($params['contribution']->payment_instrument_id) || !CRM_Utils_System::isNull($params['prevContribution']->payment_instrument_id)) && $params['contribution']->payment_instrument_id != $params['prevContribution']->payment_instrument_id) {
                     // for any other payment instrument changes create new financial records
                     self::updateFinancialAccounts($params, 'changePaymentInstrument');
                     $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
                     self::updateFinancialAccounts($params, 'changePaymentInstrument');
                 } elseif (!CRM_Utils_System::isNull($params['contribution']->check_number) && $params['contribution']->check_number != $params['prevContribution']->check_number) {
                     // another special case when check number is changed, create new financial records
                     // create financial trxn with negative amount
                     $params['trxnParams']['check_number'] = $params['prevContribution']->check_number;
                     self::updateFinancialAccounts($params, 'changePaymentInstrument');
                     // create financial trxn with positive amount
                     $params['trxnParams']['check_number'] = $params['contribution']->check_number;
                     $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
                     self::updateFinancialAccounts($params, 'changePaymentInstrument');
                 }
             }
             //if Change contribution amount
             $params['trxnParams']['fee_amount'] = CRM_Utils_Array::value('fee_amount', $params);
             $params['trxnParams']['net_amount'] = CRM_Utils_Array::value('net_amount', $params);
             $params['trxnParams']['total_amount'] = $trxnParams['total_amount'] = $params['total_amount'] = $totalAmount;
             $params['trxnParams']['trxn_id'] = $params['contribution']->trxn_id;
             if (isset($totalAmount) && $totalAmount != $params['prevContribution']->total_amount) {
                 //Update Financial Records
                 $params['trxnParams']['from_financial_account_id'] = NULL;
                 self::updateFinancialAccounts($params, 'changedAmount');
             }
         }
         if (!$update) {
             // records finanical trxn and entity financial trxn
             // also make it available as return value
             $return = $financialTxn = CRM_Core_BAO_FinancialTrxn::create($trxnParams);
             $params['entity_id'] = $financialTxn->id;
         }
     }
     // record line items and financial items
     if (empty($params['skipLineItem'])) {
         CRM_Price_BAO_LineItem::processPriceSet($entityId, CRM_Utils_Array::value('line_item', $params), $params['contribution'], $entityTable, $update);
     }
     // create batch entry if batch_id is passed and
     // ensure no batch entry is been made on 'Pending' or 'Failed' contribution, CRM-16611
     if (!empty($params['batch_id']) && !empty($financialTxn)) {
         $entityParams = array('batch_id' => $params['batch_id'], 'entity_table' => 'civicrm_financial_trxn', 'entity_id' => $financialTxn->id);
         CRM_Batch_BAO_Batch::addBatchEntity($entityParams);
     }
     // when a fee is charged
     if (!empty($params['fee_amount']) && (empty($params['prevContribution']) || $params['contribution']->fee_amount != $params['prevContribution']->fee_amount) && $skipRecords) {
         CRM_Core_BAO_FinancialTrxn::recordFees($params);
     }
     if (!empty($params['prevContribution']) && $entityTable == 'civicrm_participant' && $params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id) {
         $eventID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $entityId, 'event_id');
         $feeLevel[] = str_replace('', '', $params['prevContribution']->amount_level);
         CRM_Event_BAO_Participant::createDiscountTrxn($eventID, $params, $feeLevel);
     }
     unset($params['line_item']);
     return $return;
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:101,代码来源:Contribution.php


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