From: eileen Date: Mon, 5 Aug 2013 08:08:37 +0000 (+1200) Subject: CRM-13148 update another place to get contact id from url/ checksum/ session as appro... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5b757295230a146231071b1581dcd0e0678e21d8;p=civicrm-core.git CRM-13148 update another place to get contact id from url/ checksum/ session as appropriate. Change function signature in the few places it is called to make contact id mandatory, it was only optional because it was the last param --- diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 1c8d3a901c..f106eb78b9 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -415,10 +415,10 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr ) { CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, + $this->_membershipContactID, FALSE, $params['selectMembership'], - FALSE, NULL, - $this->_membershipContactID + FALSE ); } else { diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index cb0ded878a..59d1ebf111 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -437,8 +437,9 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $this->_separateMembershipPayment = CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, + $this->_membershipContactID, TRUE, NULL, FALSE, - $isTest, $this->_membershipContactID + $isTest ); } $this->set('separateMembershipPayment', $this->_separateMembershipPayment); diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index 8ff020b5c1..a44723c12b 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -162,10 +162,11 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, + $this->_membershipContactID, FALSE, $membershipTypeID, - TRUE, NULL, - $this->_membershipContactID + TRUE, + NULL ); } diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index c45e1d5a98..2118a03de5 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -152,6 +152,13 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { */ public $_pcpInfo; + /** + * The contact id of the person for whom membership is being added or renewed based on the cid in the url, + * checksum, or session + * @var unknown_type + */ + protected $_contactID; + protected $_userID; /** @@ -204,10 +211,12 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { else { $session->set('pastContributionID', $this->_id); } - + // this was used prior to the cleverer this_>getContactID - unsure now $this->_userID = $session->get('userID'); + + $this->_contactID = $this->_membershipContactID = $this->getContactID(); $this->_mid = NULL; - if ($this->_userID) { + if ($this->_contactID) { $this->_mid = CRM_Utils_Request::retrieve('mid', 'Positive', $this); if ($this->_mid) { $membership = new CRM_Member_DAO_Membership(); @@ -215,7 +224,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { if ($membership->find(TRUE)) { $this->_defaultMemTypeId = $membership->membership_type_id; - if ($membership->contact_id != $this->_userID) { + if ($membership->contact_id != $this->_contactID) { $employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($this->_userID); if (array_key_exists($membership->contact_id, $employers)) { $this->_membershipContactID = $membership->contact_id; diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index e3cd1b2770..1ec61981d2 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -709,23 +709,16 @@ INNER JOIN civicrm_membership_type type ON ( type.id = membership.membership_ty */ static function buildMembershipBlock(&$form, $pageID, + $cid, $formItems = FALSE, $selectedMembershipTypeID = NULL, $thankPage = FALSE, - $isTest = NULL, - $memberContactId = NULL + $isTest = NULL ) { $separateMembershipPayment = FALSE; if ($form->_membershipBlock) { $form->_currentMemberships = array(); - if (!$memberContactId) { - $session = CRM_Core_Session::singleton(); - $cid = $session->get('userID'); - } - else { - $cid = $memberContactId; - } $membershipBlock = $form->_membershipBlock; $membershipTypeIds = $membershipTypes = $radio = array();