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


PHP CRM_Member_BAO_Membership::createRelatedMemberships方法代码示例

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


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

示例1: addMembershipToRealtedContacts

 /**
  * Added for CRM-12695
  * Based on the contactID provided
  * add/update membership(s) to related contacts
  *
  * @param int $contactID
  */
 public static function addMembershipToRealtedContacts($contactID)
 {
     $dao = new CRM_Member_DAO_Membership();
     $dao->contact_id = $contactID;
     $dao->is_test = 0;
     $dao->find();
     //checks membership of contact itself
     while ($dao->fetch()) {
         $relationshipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $dao->membership_type_id, 'relationship_type_id', 'id');
         if ($relationshipTypeId) {
             $membershipParams = array('id' => $dao->id, 'contact_id' => $dao->contact_id, 'membership_type_id' => $dao->membership_type_id, 'join_date' => CRM_Utils_Date::isoToMysql($dao->join_date), 'start_date' => CRM_Utils_Date::isoToMysql($dao->start_date), 'end_date' => CRM_Utils_Date::isoToMysql($dao->end_date), 'source' => $dao->source, 'status_id' => $dao->status_id);
             // create/update membership(s) for related contact(s)
             CRM_Member_BAO_Membership::createRelatedMemberships($membershipParams, $dao);
         }
         // end of if relationshipTypeId
     }
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:24,代码来源:Merger.php

示例2: completeOrder


//.........这里部分代码省略.........
                     $currentMembership = CRM_Member_BAO_Membership::getContactMembership($membershipParams['contact_id'], $membershipParams['membership_type_id'], $membershipParams['is_test'], $membershipParams['id']);
                     // CRM-8141 update the membership type with the value recorded in log when membership created/renewed
                     // this picks up membership type changes during renewals
                     $sql = "\nSELECT    membership_type_id\nFROM      civicrm_membership_log\nWHERE     membership_id={$membershipParams['id']}\nORDER BY  id DESC\nLIMIT 1;";
                     $dao = CRM_Core_DAO::executeQuery($sql);
                     if ($dao->fetch()) {
                         if (!empty($dao->membership_type_id)) {
                             $membershipParams['membership_type_id'] = $dao->membership_type_id;
                         }
                     }
                     $dao->free();
                     $membershipParams['num_terms'] = $contribution->getNumTermsByContributionAndMembershipType($membershipParams['membership_type_id'], $primaryContributionID);
                     $dates = array_fill_keys(array('join_date', 'start_date', 'end_date'), NULL);
                     if ($currentMembership) {
                         /*
                          * Fixed FOR CRM-4433
                          * In BAO/Membership.php(renewMembership function), we skip the extend membership date and status
                          * when Contribution mode is notify and membership is for renewal )
                          */
                         CRM_Member_BAO_Membership::fixMembershipStatusBeforeRenew($currentMembership, $changeDate);
                         // @todo - we should pass membership_type_id instead of null here but not
                         // adding as not sure of testing
                         $dates = CRM_Member_BAO_MembershipType::getRenewalDatesForMembershipType($membershipParams['id'], $changeDate, NULL, $membershipParams['num_terms']);
                         $dates['join_date'] = $currentMembership['join_date'];
                     }
                     //get the status for membership.
                     $calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($dates['start_date'], $dates['end_date'], $dates['join_date'], 'today', TRUE, $membershipParams['membership_type_id'], $membershipParams);
                     $membershipParams['status_id'] = CRM_Utils_Array::value('id', $calcStatus, 'New');
                     //we might be renewing membership,
                     //so make status override false.
                     $membershipParams['is_override'] = FALSE;
                     //CRM-17723 - reset static $relatedContactIds array()
                     $var = TRUE;
                     CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE);
                     civicrm_api3('Membership', 'create', $membershipParams);
                 }
             }
         }
     } else {
         if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) {
             if ($event->is_email_confirm) {
                 // @todo this should be set by the function that sends the mail after sending.
                 $contributionParams['receipt_date'] = $changeDate;
             }
             $participantParams['id'] = $participant->id;
             $participantParams['status_id'] = 'Registered';
             civicrm_api3('Participant', 'create', $participantParams);
         }
     }
     $contributionParams['id'] = $contribution->id;
     civicrm_api3('Contribution', 'create', $contributionParams);
     // Add new soft credit against current $contribution.
     if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id) {
         CRM_Contribute_BAO_ContributionRecur::addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id);
     }
     $paymentProcessorId = '';
     if (isset($objects['paymentProcessor'])) {
         if (is_array($objects['paymentProcessor'])) {
             $paymentProcessorId = $objects['paymentProcessor']['id'];
         } else {
             $paymentProcessorId = $objects['paymentProcessor']->id;
         }
     }
     $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array('labelColumn' => 'name', 'flip' => 1));
     if (empty($input['prevContribution']) && $paymentProcessorId || !$input['prevContribution']->is_pay_later && $input['prevContribution']->contribution_status_id == $contributionStatuses['Pending']) {
         $input['payment_processor'] = $paymentProcessorId;
开发者ID:joshgowans,项目名称:civicrm-core,代码行数:67,代码来源:Contribution.php

示例3: quickCleanUpFinancialEntities

 /**
  * Clean up financial entities after financial tests (so we remember to get all the tables :-))
  */
 public function quickCleanUpFinancialEntities()
 {
     $tablesToTruncate = array('civicrm_activity', 'civicrm_activity_contact', 'civicrm_contribution', 'civicrm_contribution_soft', 'civicrm_contribution_product', 'civicrm_financial_trxn', 'civicrm_financial_item', 'civicrm_contribution_recur', 'civicrm_line_item', 'civicrm_contribution_page', 'civicrm_payment_processor', 'civicrm_entity_financial_trxn', 'civicrm_membership', 'civicrm_membership_type', 'civicrm_membership_payment', 'civicrm_membership_log', 'civicrm_membership_block', 'civicrm_event', 'civicrm_participant', 'civicrm_participant_payment', 'civicrm_pledge', 'civicrm_pledge_payment', 'civicrm_price_set_entity', 'civicrm_price_field_value', 'civicrm_price_field');
     $this->quickCleanup($tablesToTruncate);
     CRM_Core_DAO::executeQuery("DELETE FROM civicrm_membership_status WHERE name NOT IN('New', 'Current', 'Grace', 'Expired', 'Pending', 'Cancelled', 'Deceased')");
     $this->restoreDefaultPriceSetConfig();
     $var = TRUE;
     CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE);
     System::singleton()->flushProcessors();
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:13,代码来源:CiviUnitTestCase.php


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