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


PHP CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity方法代码示例

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


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

示例1: preProcess

 /**
  * Pre-processing for the form.
  *
  * @throws \Exception
  */
 public function preProcess()
 {
     $this->setAction(CRM_Core_Action::UPDATE);
     $this->contributionRecurID = CRM_Utils_Request::retrieve('crid', 'Integer', $this, FALSE);
     if ($this->contributionRecurID) {
         $this->_paymentProcessor = CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor($this->contributionRecurID);
         if (!$this->_paymentProcessor) {
             CRM_Core_Error::statusBounce(ts('There is no valid processor for this subscription so it cannot be edited.'));
         }
         $this->_paymentProcessorObj = $this->_paymentProcessor['object'];
         $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->contributionRecurID);
     }
     $this->_coid = CRM_Utils_Request::retrieve('coid', 'Integer', $this, FALSE);
     if ($this->_coid) {
         $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'info');
         $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'obj');
         $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_coid, 'contribution');
         $this->contributionRecurID = $this->_subscriptionDetails->recur_id;
     } elseif ($this->contributionRecurID) {
         $this->_coid = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $this->contributionRecurID, 'id', 'contribution_recur_id');
     }
     if (!$this->contributionRecurID || $this->_subscriptionDetails == CRM_Core_DAO::$_nullObject) {
         CRM_Core_Error::fatal('Required information missing.');
     }
     if ($this->_subscriptionDetails->membership_id && $this->_subscriptionDetails->auto_renew) {
         CRM_Core_Error::fatal(ts('You cannot update the subscription.'));
     }
     if (!CRM_Core_Permission::check('edit contributions')) {
         $userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this, FALSE);
         if (!CRM_Contact_BAO_Contact_Utils::validChecksum($this->_subscriptionDetails->contact_id, $userChecksum)) {
             CRM_Core_Error::fatal(ts('You do not have permission to update subscription.'));
         }
         $this->_selfService = TRUE;
     }
     $this->assign('self_service', $this->_selfService);
     $this->editableScheduleFields = $this->_paymentProcessorObj->getEditableRecurringScheduleFields();
     $changeHelpText = $this->_paymentProcessorObj->getRecurringScheduleUpdateHelpText();
     if (!in_array('amount', $this->editableScheduleFields)) {
         // Not sure if this is good behaviour - maintaining this existing behaviour for now.
         CRM_Core_Session::setStatus($changeHelpText, ts('Warning'), 'alert');
     } else {
         $this->assign('changeHelpText', $changeHelpText);
     }
     $alreadyHardCodedFields = array('amount', 'installments');
     foreach ($this->editableScheduleFields as $editableScheduleField) {
         if (!in_array($editableScheduleField, $alreadyHardCodedFields)) {
             $this->addField($editableScheduleField, array('entity' => 'ContributionRecur'));
         }
     }
     $this->assign('editableScheduleFields', array_diff($this->editableScheduleFields, $alreadyHardCodedFields));
     $this->assign('paymentProcessor', $this->_paymentProcessor);
     $this->assign('frequency_unit', $this->_subscriptionDetails->frequency_unit);
     $this->assign('frequency_interval', $this->_subscriptionDetails->frequency_interval);
     if ($this->_subscriptionDetails->contact_id) {
         list($this->_donorDisplayName, $this->_donorEmail) = CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id);
     }
     CRM_Utils_System::setTitle(ts('Update Recurring Contribution'));
     // Handle context redirection.
     CRM_Contribute_BAO_ContributionRecur::setSubscriptionContext();
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:65,代码来源:UpdateSubscription.php

示例2: preProcess

 /**
  * Set variables up before form is built.
  */
 public function preProcess()
 {
     $this->_mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE);
     $this->_crid = CRM_Utils_Request::retrieve('crid', 'Integer', $this, FALSE);
     if ($this->_crid) {
         $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_crid, 'recur', 'obj');
         $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_crid);
         $this->assign('frequency_unit', $this->_subscriptionDetails->frequency_unit);
         $this->assign('frequency_interval', $this->_subscriptionDetails->frequency_interval);
         $this->assign('amount', $this->_subscriptionDetails->amount);
         $this->assign('installments', $this->_subscriptionDetails->installments);
         // Are we cancelling a recurring contribution that is linked to an auto-renew membership?
         if ($this->_subscriptionDetails->membership_id) {
             $this->_mid = $this->_subscriptionDetails->membership_id;
         }
     }
     if ($this->_mid) {
         $this->_mode = 'auto_renew';
         // CRM-18468: crid is more accurate than mid for getting
         // subscriptionDetails, so don't get them again.
         if (!$this->_crid) {
             $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'obj');
             $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_mid, 'membership');
         }
         $membershipTypes = CRM_Member_PseudoConstant::membershipType();
         $membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_mid, 'membership_type_id');
         $this->assign('membershipType', CRM_Utils_Array::value($membershipTypeId, $membershipTypes));
     }
     $this->_coid = CRM_Utils_Request::retrieve('coid', 'Integer', $this, FALSE);
     if ($this->_coid) {
         if (CRM_Contribute_BAO_Contribution::isSubscriptionCancelled($this->_coid)) {
             CRM_Core_Error::fatal(ts('The recurring contribution looks to have been cancelled already.'));
         }
         $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'obj');
         $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_coid, 'contribution');
         $this->assign('frequency_unit', $this->_subscriptionDetails->frequency_unit);
         $this->assign('frequency_interval', $this->_subscriptionDetails->frequency_interval);
         $this->assign('amount', $this->_subscriptionDetails->amount);
         $this->assign('installments', $this->_subscriptionDetails->installments);
     }
     if (!$this->_crid && !$this->_coid && !$this->_mid || $this->_subscriptionDetails == CRM_Core_DAO::$_nullObject) {
         CRM_Core_Error::fatal('Required information missing.');
     }
     if (!CRM_Core_Permission::check('edit contributions')) {
         $userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this, FALSE);
         if (!CRM_Contact_BAO_Contact_Utils::validChecksum($this->_subscriptionDetails->contact_id, $userChecksum)) {
             CRM_Core_Error::fatal(ts('You do not have permission to cancel this recurring contribution.'));
         }
         $this->_selfService = TRUE;
     }
     $this->assign('self_service', $this->_selfService);
     // handle context redirection
     CRM_Contribute_BAO_ContributionRecur::setSubscriptionContext();
     CRM_Utils_System::setTitle($this->_mid ? ts('Cancel Auto-renewal') : ts('Cancel Recurring Contribution'));
     $this->assign('mode', $this->_mode);
     if ($this->_subscriptionDetails->contact_id) {
         list($this->_donorDisplayName, $this->_donorEmail) = CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id);
     }
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:62,代码来源:CancelSubscription.php

示例3: preProcess

 /**
  * Set variables up before form is built.
  *
  * @return void
  */
 public function preProcess()
 {
     $this->_mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE);
     $this->_crid = CRM_Utils_Request::retrieve('crid', 'Integer', $this, FALSE);
     if ($this->_crid) {
         $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_crid, 'recur', 'info');
         $this->_paymentProcessor['object'] = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_crid, 'recur', 'obj');
         $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_crid);
         // Are we cancelling a recurring contribution that is linked to an auto-renew membership?
         if ($this->_subscriptionDetails->membership_id) {
             $this->_mid = $this->_subscriptionDetails->membership_id;
         }
     }
     $this->_coid = CRM_Utils_Request::retrieve('coid', 'Integer', $this, FALSE);
     if ($this->_coid) {
         $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'info');
         $this->_paymentProcessor['object'] = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'obj');
         $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_coid, 'contribution');
     }
     if ($this->_mid) {
         $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'info');
         $this->_paymentProcessor['object'] = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'obj');
         $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_mid, 'membership');
         $membershipTypes = CRM_Member_PseudoConstant::membershipType();
         $membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_mid, 'membership_type_id');
         $this->assign('membershipType', CRM_Utils_Array::value($membershipTypeId, $membershipTypes));
         $this->_mode = 'auto_renew';
     }
     $this->_paymentProcessorObj = CRM_Utils_Array::value('object', $this->_paymentProcessor);
     if (!$this->_crid && !$this->_coid && !$this->_mid || $this->_subscriptionDetails == CRM_Core_DAO::$_nullObject) {
         CRM_Core_Error::fatal('Required information missing.');
     }
     if (!CRM_Core_Permission::check('edit contributions')) {
         $userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this, FALSE);
         if (!CRM_Contact_BAO_Contact_Utils::validChecksum($this->_subscriptionDetails->contact_id, $userChecksum)) {
             CRM_Core_Error::fatal(ts('You do not have permission to cancel subscription.'));
         }
         $this->_selfService = TRUE;
     }
     if (!$this->_paymentProcessor['object']->isSupported('updateSubscriptionBillingInfo')) {
         CRM_Core_Error::fatal(ts("%1 processor doesn't support updating subscription billing details.", array(1 => $this->_paymentProcessor['object']->_processorName)));
     }
     $this->assign('paymentProcessor', $this->_paymentProcessor);
     // get the billing location type
     $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
     $this->_bltID = array_search('Billing', $locationTypes);
     $this->assign('bltID', $this->_bltID);
     if (!$this->_bltID) {
         CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
     }
     $this->assign('frequency_unit', $this->_subscriptionDetails->frequency_unit);
     $this->assign('frequency_interval', $this->_subscriptionDetails->frequency_interval);
     $this->assign('amount', $this->_subscriptionDetails->amount);
     $this->assign('installments', $this->_subscriptionDetails->installments);
     $this->assign('mode', $this->_mode);
     // handle context redirection
     CRM_Contribute_BAO_ContributionRecur::setSubscriptionContext();
 }
开发者ID:indydas,项目名称:civi-demo,代码行数:63,代码来源:UpdateBilling.php

示例4: preProcess

 public function preProcess()
 {
     $this->_crid = CRM_Utils_Request::retrieve('crid', 'Integer', $this, FALSE);
     if ($this->_crid) {
         $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_crid, 'recur', 'info');
         $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_crid, 'recur', 'obj');
         $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_crid);
     }
     $this->_coid = CRM_Utils_Request::retrieve('coid', 'Integer', $this, FALSE);
     if ($this->_coid) {
         $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'info');
         $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'obj');
         $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_coid, 'contribution');
         $this->_crid = $this->_subscriptionDetails->recur_id;
     } elseif ($this->_crid) {
         $this->_coid = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $this->_crid, 'id', 'contribution_recur_id');
     }
     if (!$this->_crid || $this->_subscriptionDetails == CRM_Core_DAO::$_nullObject) {
         CRM_Core_Error::fatal('Required information missing.');
     }
     if ($this->_subscriptionDetails->membership_id && $this->_subscriptionDetails->auto_renew) {
         CRM_Core_Error::fatal(ts('You cannot update the subscription.'));
     }
     if (!CRM_Core_Permission::check('edit contributions')) {
         $userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this, FALSE);
         if (!CRM_Contact_BAO_Contact_Utils::validChecksum($this->_subscriptionDetails->contact_id, $userChecksum)) {
             CRM_Core_Error::fatal(ts('You do not have permission to update subscription.'));
         }
         $this->_selfService = TRUE;
     }
     $this->assign('self_service', $this->_selfService);
     if (!$this->_paymentProcessorObj->isSupported('changeSubscriptionAmount')) {
         $userAlert = ts('Updates made using this form will change the recurring contribution information stored in your CiviCRM database, but will NOT be sent to the payment processor. You must enter the same changes using the payment processor web site.');
         CRM_Core_Session::setStatus($userAlert, ts('Warning'), 'alert');
     }
     $this->assign('isChangeSupported', $this->_paymentProcessorObj->isSupported('changeSubscriptionAmount'));
     $this->assign('paymentProcessor', $this->_paymentProcessor);
     $this->assign('frequency_unit', $this->_subscriptionDetails->frequency_unit);
     $this->assign('frequency_interval', $this->_subscriptionDetails->frequency_interval);
     if ($this->_subscriptionDetails->contact_id) {
         list($this->_donorDisplayName, $this->_donorEmail) = CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id);
     }
     CRM_Utils_System::setTitle(ts('Update Recurring Contribution'));
     // handle context redirection
     CRM_Contribute_BAO_ContributionRecur::setSubscriptionContext();
 }
开发者ID:wdecraene,项目名称:civicrm-core,代码行数:46,代码来源:UpdateSubscription.php

示例5: array

 /**
  * This method returns the links that are given for recur search row.
  * currently the links added for each row are:
  * - View
  * - Edit
  * - Cancel
  *
  * @return array
  * @access public
  *
  */
 static function &recurLinks($recurID = FALSE, $context = 'contribution')
 {
     if (!self::$_links) {
         self::$_links = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'title' => ts('View Recurring Payment'), 'url' => 'civicrm/contact/view/contributionrecur', 'qs' => "reset=1&id=%%crid%%&cid=%%cid%%&context={$context}"), CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'title' => ts('Edit Recurring Payment'), 'url' => 'civicrm/contribute/updaterecur', 'qs' => "reset=1&action=update&crid=%%crid%%&cid=%%cid%%&context={$context}"), CRM_Core_Action::DISABLE => array('name' => ts('Cancel'), 'title' => ts('Cancel'), 'ref' => 'crm-enable-disable'));
     }
     if ($recurID) {
         $paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($recurID, 'recur', 'obj');
         if (is_object($paymentProcessorObj) && $paymentProcessorObj->isSupported('cancelSubscription')) {
             unset(self::$_links[CRM_Core_Action::DISABLE]['extra'], self::$_links[CRM_Core_Action::DISABLE]['ref']);
             self::$_links[CRM_Core_Action::DISABLE]['url'] = "civicrm/contribute/unsubscribe";
             self::$_links[CRM_Core_Action::DISABLE]['qs'] = "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}";
         }
         if (is_object($paymentProcessorObj) && $paymentProcessorObj->isSupported('updateSubscriptionBillingInfo')) {
             self::$_links[CRM_Core_Action::RENEW] = array('name' => ts('Change Billing Details'), 'title' => ts('Change Billing Details'), 'url' => 'civicrm/contribute/updatebilling', 'qs' => "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}");
         }
     }
     return self::$_links;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:29,代码来源:Tab.php

示例6: isCancelSubscriptionSupported

 /**
  * Check whether payment processor supports cancellation of membership subscription.
  *
  * @param int $mid
  *   Membership id.
  *
  * @param bool $isNotCancelled
  *
  * @return bool
  */
 public static function isCancelSubscriptionSupported($mid, $isNotCancelled = TRUE)
 {
     $cacheKeyString = "{$mid}";
     $cacheKeyString .= $isNotCancelled ? '_1' : '_0';
     static $supportsCancel = array();
     if (!array_key_exists($cacheKeyString, $supportsCancel)) {
         $supportsCancel[$cacheKeyString] = FALSE;
         $isCancelled = FALSE;
         if ($isNotCancelled) {
             $isCancelled = self::isSubscriptionCancelled($mid);
         }
         $paymentObject = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($mid, 'membership', 'obj');
         if (!empty($paymentObject)) {
             $supportsCancel[$cacheKeyString] = $paymentObject->supports('cancelRecurring') && !$isCancelled;
         }
     }
     return $supportsCancel[$cacheKeyString];
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:28,代码来源:Membership.php

示例7: browse

 /**
  * called when action is browse.
  */
 public function browse()
 {
     $links = self::links('all', $this->_isPaymentProcessor, $this->_accessContribution);
     $membership = array();
     $dao = new CRM_Member_DAO_Membership();
     $dao->contact_id = $this->_contactId;
     $dao->is_test = 0;
     //$dao->orderBy('name');
     $dao->find();
     //CRM--4418, check for view, edit, delete
     $permissions = array(CRM_Core_Permission::VIEW);
     if (CRM_Core_Permission::check('edit memberships')) {
         $permissions[] = CRM_Core_Permission::EDIT;
     }
     if (CRM_Core_Permission::check('delete in CiviMember')) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     // get deceased status id
     $allStatus = CRM_Member_PseudoConstant::membershipStatus();
     $deceasedStatusId = array_search('Deceased', $allStatus);
     //get all campaigns.
     $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
     //checks membership of contact itself
     while ($dao->fetch()) {
         $membership[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $membership[$dao->id]);
         //carry campaign.
         $membership[$dao->id]['campaign'] = CRM_Utils_Array::value($dao->campaign_id, $allCampaigns);
         //get the membership status and type values.
         $statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeValues($dao->id);
         foreach (array('status', 'membership_type') as $fld) {
             $membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
         }
         if (!empty($statusANDType[$dao->id]['is_current_member'])) {
             $membership[$dao->id]['active'] = TRUE;
         }
         if (empty($dao->owner_membership_id)) {
             // unset renew and followup link for deceased membership
             $currentMask = $mask;
             if ($dao->status_id == $deceasedStatusId) {
                 $currentMask = $currentMask & ~CRM_Core_Action::RENEW & ~CRM_Core_Action::FOLLOWUP;
             }
             $isUpdateBilling = FALSE;
             $paymentObject = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($membership[$dao->id]['membership_id'], 'membership', 'obj');
             if (!empty($paymentObject)) {
                 $isUpdateBilling = $paymentObject->isSupported('updateSubscriptionBillingInfo');
             }
             $isCancelSupported = CRM_Member_BAO_Membership::isCancelSubscriptionSupported($membership[$dao->id]['membership_id']);
             $membership[$dao->id]['action'] = CRM_Core_Action::formLink(self::links('all', NULL, NULL, $isCancelSupported, $isUpdateBilling), $currentMask, array('id' => $dao->id, 'cid' => $this->_contactId), ts('more'), FALSE, 'membership.tab.row', 'Membership', $dao->id);
         } else {
             $membership[$dao->id]['action'] = CRM_Core_Action::formLink(self::links('view'), $mask, array('id' => $dao->id, 'cid' => $this->_contactId), ts('more'), FALSE, 'membership.tab.row', 'Membership', $dao->id);
         }
         //does membership have auto renew CRM-7137.
         if (!empty($membership[$dao->id]['contribution_recur_id']) && !CRM_Member_BAO_Membership::isSubscriptionCancelled($membership[$dao->id]['membership_id'])) {
             $membership[$dao->id]['auto_renew'] = 1;
         } else {
             $membership[$dao->id]['auto_renew'] = 0;
         }
         // if relevant, count related memberships
         if (CRM_Utils_Array::value('is_current_member', $statusANDType[$dao->id]) && CRM_Utils_Array::value('relationship_type_id', $statusANDType[$dao->id]) && empty($dao->owner_membership_id)) {
             // not an related membership
             $query = "\n SELECT COUNT(m.id)\n   FROM civicrm_membership m\n     LEFT JOIN civicrm_membership_status ms ON ms.id = m.status_id\n     LEFT JOIN civicrm_contact ct ON ct.id = m.contact_id\n  WHERE m.owner_membership_id = {$dao->id} AND m.is_test = 0 AND ms.is_current_member = 1 AND ct.is_deleted = 0";
             $num_related = CRM_Core_DAO::singleValueQuery($query);
             $max_related = CRM_Utils_Array::value('max_related', $membership[$dao->id]);
             $membership[$dao->id]['related_count'] = $max_related == '' ? ts('%1 created', array(1 => $num_related)) : ts('%1 out of %2', array(1 => $num_related, 2 => $max_related));
         } else {
             $membership[$dao->id]['related_count'] = ts('N/A');
         }
     }
     //Below code gives list of all Membership Types associated
     //with an Organization(CRM-2016)
     $membershipTypes = CRM_Member_BAO_MembershipType::getMembershipTypesByOrg($this->_contactId);
     foreach ($membershipTypes as $key => $value) {
         $membershipTypes[$key]['action'] = CRM_Core_Action::formLink(self::membershipTypeslinks(), $mask, array('id' => $value['id'], 'cid' => $this->_contactId), ts('more'), FALSE, 'membershipType.organization.action', 'MembershipType', $value['id']);
     }
     $activeMembers = CRM_Member_BAO_Membership::activeMembers($membership);
     $inActiveMembers = CRM_Member_BAO_Membership::activeMembers($membership, 'inactive');
     $this->assign('activeMembers', $activeMembers);
     $this->assign('inActiveMembers', $inActiveMembers);
     $this->assign('membershipTypes', $membershipTypes);
     if ($this->_contactId) {
         $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
         $this->assign('displayName', $displayName);
         $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('membership', $this->_contactId);
         // Refresh other tabs with related data
         $this->ajaxResponse['updateTabs'] = array('#tab_activity' => CRM_Contact_BAO_Contact::getCountComponent('activity', $this->_contactId), '#tab_rel' => CRM_Contact_BAO_Contact::getCountComponent('rel', $this->_contactId));
         if (CRM_Core_Permission::access('CiviContribute')) {
             $this->ajaxResponse['updateTabs']['#tab_contribute'] = CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId);
         }
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:95,代码来源:Tab.php

示例8: recurringNotify

 /**
  * Send the emails for Recurring Contribution Notication.
  *
  * @param string $type
  *   TxnType.
  * @param int $contactID
  *   Contact id for contributor.
  * @param int $pageID
  *   Contribution page id.
  * @param object $recur
  *   Object of recurring contribution table.
  * @param bool|object $autoRenewMembership is it a auto renew membership.
  *
  * @return void
  */
 public static function recurringNotify($type, $contactID, $pageID, $recur, $autoRenewMembership = FALSE)
 {
     $value = array();
     if ($pageID) {
         CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_ContributionPage', 'id', $pageID, $value, array('title', 'is_email_receipt', 'receipt_from_name', 'receipt_from_email', 'cc_receipt', 'bcc_receipt'));
     }
     $isEmailReceipt = CRM_Utils_Array::value('is_email_receipt', $value[$pageID]);
     $isOfflineRecur = FALSE;
     if (!$pageID && $recur->id) {
         $isOfflineRecur = TRUE;
     }
     if ($isEmailReceipt || $isOfflineRecur) {
         if ($pageID) {
             $receiptFrom = '"' . CRM_Utils_Array::value('receipt_from_name', $value[$pageID]) . '" <' . $value[$pageID]['receipt_from_email'] . '>';
             $receiptFromName = $value[$pageID]['receipt_from_name'];
             $receiptFromEmail = $value[$pageID]['receipt_from_email'];
         } else {
             $domainValues = CRM_Core_BAO_Domain::getNameAndEmail();
             $receiptFrom = "{$domainValues['0']} <{$domainValues['1']}>";
             $receiptFromName = $domainValues[0];
             $receiptFromEmail = $domainValues[1];
         }
         list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID, FALSE);
         $templatesParams = array('groupName' => 'msg_tpl_workflow_contribution', 'valueName' => 'contribution_recurring_notify', 'contactId' => $contactID, 'tplParams' => array('recur_frequency_interval' => $recur->frequency_interval, 'recur_frequency_unit' => $recur->frequency_unit, 'recur_installments' => $recur->installments, 'recur_start_date' => $recur->start_date, 'recur_end_date' => $recur->end_date, 'recur_amount' => $recur->amount, 'recur_txnType' => $type, 'displayName' => $displayName, 'receipt_from_name' => $receiptFromName, 'receipt_from_email' => $receiptFromEmail, 'auto_renew_membership' => $autoRenewMembership), 'from' => $receiptFrom, 'toName' => $displayName, 'toEmail' => $email);
         //CRM-13811
         if ($pageID) {
             $templatesParams['cc'] = CRM_Utils_Array::value('cc_receipt', $value[$pageID]);
             $templatesParams['bcc'] = CRM_Utils_Array::value('bcc_receipt', $value[$pageID]);
         }
         if ($recur->id) {
             // in some cases its just recurringNotify() thats called for the first time and these urls don't get set.
             // like in PaypalPro, & therefore we set it here additionally.
             $template = CRM_Core_Smarty::singleton();
             $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($recur->id, 'recur', 'obj');
             $url = $paymentProcessor->subscriptionURL($recur->id, 'recur');
             $template->assign('cancelSubscriptionUrl', $url);
             $url = $paymentProcessor->subscriptionURL($recur->id, 'recur', 'billing');
             $template->assign('updateSubscriptionBillingUrl', $url);
             $url = $paymentProcessor->subscriptionURL($recur->id, 'recur', 'update');
             $template->assign('updateSubscriptionUrl', $url);
         }
         list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($templatesParams);
         if ($sent) {
             CRM_Core_Error::debug_log_message('Success: mail sent for recurring notification.');
         } else {
             CRM_Core_Error::debug_log_message('Failure: mail not sent for recurring notification.');
         }
     }
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:64,代码来源:ContributionPage.php


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