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


PHP CRM_Contribute_BAO_ContributionRecur::getCount方法代码示例

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


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

示例1: buildQuickForm

 /**
  * Build the form
  *
  * @access public
  * @return void
  */
 public function buildQuickForm()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         // Check if any contributions created for the recurring record
         $recurringIds = array($this->_id);
         $contributionCount = CRM_Contribute_BAO_ContributionRecur::getCount($recurringIds);
         if (isset($contributionCount[$this->_id]) && $contributionCount[$this->_id] > 0) {
             $this->assign('contributionCount', $contributionCount[$this->_id]);
         }
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'spacing' => '         ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     //need to assign custom data type to the template
     $this->assign('customDataType', 'ContributionRecur');
     $this->assign('entityID', $this->_id);
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionRecur');
     $cid = CRM_Utils_Request::retrieve('cid', 'Integer', $this);
     $id = CRM_Utils_Request::retrieve('crid', 'Integer', $this);
     $this->_paymentProcessors = $this->getValidProcessors();
     $offlineRecurPaymentProcessors = array();
     foreach ($this->_paymentProcessors as $processor) {
         if (!empty($processor['is_recur']) && !empty($processor['object']) && $processor['object']->supports('EditRecurringContribution') && $processor['is_test'] == 0) {
             $offlineRecurPaymentProcessors[$processor['id']] = $processor['name'];
         }
     }
     $paymentProcessor = $this->add('select', 'payment_processor_id', ts('Payment Processor'), array('' => ts('- select -')) + $offlineRecurPaymentProcessors, TRUE, NULL);
     $trxnId = $this->add('text', 'trxn_id', ts('Transaction ID'), array('class' => 'twelve'));
     $processorid = $this->add('text', 'processor_id', ts('Processor ID'), array('class' => 'twelve'));
     $financialType = $this->add('select', 'financial_type_id', ts('Financial Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(), TRUE, NULL);
     $contributionStatus = $this->add('select', 'contribution_status_id', ts('Status'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionStatus(), TRUE, NULL);
     // Get contact memberships
     $contactMembershipsList = $contactMemberships = array();
     $memParams = array('contact_id' => $this->_contactID);
     CRM_Member_BAO_Membership::getValues($memParams, $contactMembershipsList, TRUE);
     if (count($contactMembershipsList) > 0) {
         foreach ($contactMembershipsList as $memid => $mem) {
             $statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeValues($memid);
             $contactMemberships[$memid] = $statusANDType[$memid]['membership_type'] . ' / ' . $statusANDType[$memid]['status'] . ' / ' . $mem['start_date'] . ' / ' . $mem['end_date'];
         }
     }
     if ($this->_action == 1) {
         $memberships = $this->add('select', 'membership_id', ts('Membership'), array('' => ts('- select -')) + $contactMemberships, FALSE, NULL);
     }
     $totalAmount = $this->addMoney('amount', ts('Amount'), TRUE, NULL, TRUE, 'currency', NULL, FALSE);
     $paymentInstrument = $this->add('select', 'payment_instrument_id', ts('Paid By'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), TRUE, NULL);
     $frequencyUnit = $this->add('select', 'frequency_unit', NULL, array('' => ts('- select -')) + CRM_Core_OptionGroup::values('recur_frequency_units', FALSE, FALSE, FALSE, NULL, 'name'), TRUE, NULL);
     $frequencyInterval = $this->add('text', 'frequency_interval', ts('Every'), array('maxlength' => 2, 'size' => 2), TRUE);
     // add dates
     $this->addDateTime('start_date', ts('Start Date'), TRUE, array('formatType' => 'activityDateTime'));
     $this->addDateTime('end_date', ts('End Date'), FALSE, array('formatType' => 'activityDateTime'));
     $this->addDateTime('cancel_date', ts('Cancel Date'), FALSE, array('formatType' => 'activityDateTime'));
     $this->addDateTime('next_sched_contribution_date', ts('Next Scheduled Contribution Date'), FALSE, array('formatType' => 'activityDateTime'));
     $cycleDay = $this->add('text', 'cycle_day', ts('Cycle day'), array('maxlength' => 2, 'size' => 2), TRUE);
     // Move recurring record to another contact/membership
     // Field for moving contribution to another contact/membership
     if (!empty($this->_id)) {
         $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE);
         $this->addElement('text', 'contact_name', 'Contact', array('size' => 50, 'maxlength' => 255));
         $this->addElement('hidden', 'selected_cid', 'selected_cid');
         $this->addElement('checkbox', 'move_recurring_record', ts('Move Recurring Record?'));
         $this->addElement('checkbox', 'move_existing_contributions', ts('Move Existing Contributions?'));
         // Get memberships of the contact
         // This will allow the recur record to be attached to a different membership of the same contact
         $existingMemberships = array('' => ts('- select -')) + $contactMemberships;
         // Remove current membership during move
         if ($existingMemberships[$this->_membershipID]) {
             unset($existingMemberships[$this->_membershipID]);
         }
         $this->add('select', 'membership_record', ts('Membership'), $existingMemberships, FALSE);
         $this->assign('show_move_membership_field', 1);
     }
     // build associated contributions
     $associatedContributions = array();
     $contributions = new CRM_Contribute_DAO_Contribution();
     $contributions->contribution_recur_id = $this->_id;
     while ($contributions->find(TRUE)) {
         $associatedContributions[$contributions->id]['total_amount'] = $contributions->total_amount;
         $associatedContributions[$contributions->id]['financial_type'] = CRM_Contribute_PseudoConstant::financialType($contributions->financial_type_id);
         $associatedContributions[$contributions->id]['contribution_source'] = $contributions->source;
         $associatedContributions[$contributions->id]['receive_date'] = $contributions->receive_date;
         $associatedContributions[$contributions->id]['contribution_status'] = CRM_Contribute_PseudoConstant::contributionStatus($contributions->contribution_status_id);
     }
     $this->assign('associatedContributions', $associatedContributions);
     $this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
开发者ID:Kajakaran,项目名称:uk.co.vedaconsulting.offlinerecurringcontributions,代码行数:91,代码来源:ContributionRecur.php

示例2: listContribution

 /**
  * called when action is browse.
  */
 public function listContribution()
 {
     $controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), NULL, FALSE, FALSE, TRUE, FALSE);
     $controller->setEmbedded(TRUE);
     $controller->reset();
     $controller->set('limit', 12);
     $controller->set('cid', $this->_contactId);
     $controller->set('context', 'user');
     $controller->set('force', 1);
     $controller->process();
     $controller->run();
     //add honor block
     $params = CRM_Contribute_BAO_Contribution::getHonorContacts($this->_contactId);
     if (!empty($params)) {
         // assign vars to templates
         $this->assign('honorRows', $params);
         $this->assign('honor', TRUE);
     }
     $recur = new CRM_Contribute_DAO_ContributionRecur();
     $recur->contact_id = $this->_contactId;
     $recur->is_test = 0;
     $recur->find();
     $config = CRM_Core_Config::singleton();
     $recurStatus = CRM_Contribute_PseudoConstant::contributionStatus();
     $recurRow = array();
     $recurIDs = array();
     while ($recur->fetch()) {
         $mode = $recur->is_test ? 'test' : 'live';
         $paymentProcessor = CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor($recur->id, $mode);
         if (!$paymentProcessor) {
             continue;
         }
         require_once 'api/v3/utils.php';
         //@todo calling api functions directly is not supported
         _civicrm_api3_object_to_array($recur, $values);
         $values['recur_status'] = $recurStatus[$values['contribution_status_id']];
         $recurRow[$values['id']] = $values;
         $action = array_sum(array_keys(CRM_Contribute_Page_Tab::recurLinks($recur->id, 'dashboard')));
         $details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($recur->id, 'recur');
         $hideUpdate = $details->membership_id & $details->auto_renew;
         if ($hideUpdate) {
             $action -= CRM_Core_Action::UPDATE;
         }
         $recurRow[$values['id']]['action'] = CRM_Core_Action::formLink(CRM_Contribute_Page_Tab::recurLinks($recur->id, 'dashboard'), $action, array('cid' => $this->_contactId, 'crid' => $values['id'], 'cxt' => 'contribution'), ts('more'), FALSE, 'contribution.dashboard.recurring', 'Contribution', $values['id']);
         $recurIDs[] = $values['id'];
         //reset $paymentObject for checking other paymenet processor
         //recurring url
         $paymentObject = NULL;
     }
     if (is_array($recurIDs) && !empty($recurIDs)) {
         $getCount = CRM_Contribute_BAO_ContributionRecur::getCount($recurIDs);
         foreach ($getCount as $key => $val) {
             $recurRow[$key]['completed'] = $val;
             $recurRow[$key]['link'] = CRM_Utils_System::url('civicrm/contribute/search', "reset=1&force=1&recur={$key}");
         }
     }
     $this->assign('recurRows', $recurRow);
     if (!empty($recurRow)) {
         $this->assign('recur', TRUE);
     } else {
         $this->assign('recur', FALSE);
     }
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:66,代码来源:UserDashboard.php

示例3: listContribution

 /**
  * This function is called when action is browse
  * 
  * return null
  * @access public
  */
 function listContribution()
 {
     $controller =& new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), null);
     $controller->setEmbedded(true);
     $controller->reset();
     $controller->set('limit', 12);
     $controller->set('cid', $this->_contactId);
     $controller->set('context', 'user');
     $controller->set('force', 1);
     $controller->process();
     $controller->run();
     //add honor block
     require_once 'CRM/Contribute/BAO/Contribution.php';
     $params = array();
     $params = CRM_Contribute_BAO_Contribution::getHonorContacts($this->_contactId);
     if (!empty($params)) {
         // assign vars to templates
         $this->assign('honorRows', $params);
         $this->assign('honor', true);
     }
     require_once 'CRM/Contribute/Form/ContributionBase.php';
     require_once 'CRM/Contribute/BAO/ContributionRecur.php';
     $recur =& new CRM_Contribute_DAO_ContributionRecur();
     $recur->contact_id = $this->_contactId;
     $recur->is_test = 0;
     $recur->find();
     $config =& CRM_Core_Config::singleton();
     $recurStatus = CRM_Contribute_PseudoConstant::contributionStatus();
     require_once 'CRM/Core/Payment.php';
     require_once 'api/v2/utils.php';
     $recurRow = array();
     $recurIDs = array();
     while ($recur->fetch()) {
         $mode = $recur->is_test ? 'test' : 'live';
         $paymentProcessor = CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor($recur->id, $mode);
         if (!$paymentProcessor) {
             continue;
         }
         // note that we are passing a CRM_Core_Page object ($this) as if it were a form here:
         $paymentObject =& CRM_Core_Payment::singleton($mode, 'Contribute', $paymentProcessor, $this);
         _civicrm_object_to_array($recur, $values);
         $values['cancelSubscriptionUrl'] = $paymentObject->cancelSubscriptionURL();
         $values['recur_status'] = $recurStatus[$values['contribution_status_id']];
         $recurRow[$values['id']] = $values;
         $recurIDs[] = $values['id'];
         //reset $paymentObject for checking other paymenet processor
         //recurring url
         $paymentObject = null;
     }
     if (is_array($recurIDs) && !empty($recurIDs)) {
         $getCount = CRM_Contribute_BAO_ContributionRecur::getCount($recurIDs);
         foreach ($getCount as $key => $val) {
             $recurRow[$key]['completed'] = $val;
             $recurRow[$key]['link'] = CRM_Utils_System::url('civicrm/contribute/search', "reset=1&force=1&recur={$key}");
         }
     }
     $this->assign('recurRows', $recurRow);
     if (!empty($recurRow)) {
         $this->assign('recur', true);
     } else {
         $this->assign('recur', false);
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:69,代码来源:UserDashboard.php


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