static $_signupActType = NULL;
+ /**
+ * class constructor
+ *
+ * @access public
+ * @return \CRM_Member_DAO_Membership
+ */
+ /**
+ *
+ */
function __construct() {
parent::__construct();
}
/**
* takes an associative array and creates a membership object
*
- * @param array $params (reference ) an assoc array of name/value pairs
- * @param array $ids the array that holds all the db ids
- * @param boolean $callFromAPI Is this function called from API?
+ * @param array $params (reference ) an assoc array of name/value pairs
+ * @param array $ids the array that holds all the db ids
+ * @param bool $skipRedirect
+ * @param string $activityType
+ *
+ * @throws CRM_Core_Exception
+ * @internal param bool $callFromAPI Is this function called from API?
*
* @return object CRM_Member_BAO_Membership object
* @access public
// CRM_Contact_BAO_Relationship::relatedMemberships()
if (isset($params['owner_membership_id'])) {
unset($params['max_related']);
- } else {
+ }
+ else {
// if membership allows related, default max_related to value in membership_type
if (!array_key_exists('max_related', $params) && !empty($params['membership_type_id'])) {
$membershipType = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($params['membership_type_id']);
* Function to check the membership extended through relationship
*
* @param int $membershipId membership id
- * @param int $contactId contact id
+ * @param int $contactId contact id
+ *
+ * @param const $action
*
* @return Array array of contact_id of all related contacts.
* @static
* full featured over a period of time. This is the inverse function of
* create. It also stores all the retrieved values in the default array
*
- * @param array $params (reference ) an assoc array of name/value pairs
+ * @param array $params (reference ) an assoc array of name/value pairs
* @param array $defaults (reference ) an assoc array to hold the name / value pairs
* in a hierarchical manner
- * @param array $ids (reference) the array that holds all the db ids
+ *
+ * @internal param array $ids (reference) the array that holds all the db ids
*
* @return object CRM_Member_BAO_Membership object
* @access public
/**
* Function to build Membership Block in Contribution Pages
*
- * @param object $form form object
- * @param int $pageId contribution page id
+ * @param object $form form object
+ * @param $pageID
+ * @param $cid
* @param boolean $formItems
- * @param int $selectedMembershipTypeID selected membership id
- * @param boolean $thankPage thank you page
- * @param boolean $memContactId contact who is to be
+ * @param int $selectedMembershipTypeID selected membership id
+ * @param boolean $thankPage thank you page
+ * @param null $isTest
+ *
+ * @return bool|mixed
+ * @internal param int $pageId contribution page id
+ * @internal param bool $memContactId contact who is to be
* checked for having a current membership for a particular membership
*
* @static
/**
* Function to return Membership Block info in Contribution Pages
*
- * @param int $pageId contribution page id
+ * @param $pageID
+ *
+ * @return array|null
+ * @internal param int $pageId contribution page id
*
* @static
*/
* Function to return a current membership of given contact
* NB: if more than one membership meets criteria, a randomly selected one is returned.
*
- * @param int $contactID contact id
+ * @param int $contactID contact id
* @param int $memType membership type, null to retrieve all types
* @param int $isTest
- * @param int $membershipID if provided, then determine if it is current
+ * @param null $membershipId
* @param boolean $onlySameParentOrg true if only Memberships with same parent org as the $memType wanted, false otherwise
+ *
+ * @return array|bool
+ * @internal param int $membershipID if provided, then determine if it is current
* @static
*/
static function getContactMembership($contactID, $memType, $isTest, $membershipId = NULL, $onlySameParentOrg = FALSE) {
* Signup" or "Membership Renewal" activity falls in the given date range.
* Dates match the pattern "yyyy-mm-dd".
*
- * @param int $membershipTypeId membership type id
- * @param int $startDate date on which to start counting
- * @param int $endDate date on which to end counting
- * @param bool $isTest if true, membership is for a test site
- * @param bool $isOwner if true, only retrieve membership records for owners //LCD
+ * @param int $membershipTypeId membership type id
+ * @param int $startDate date on which to start counting
+ * @param int $endDate date on which to end counting
+ * @param bool|int $isTest if true, membership is for a test site
+ * @param bool|int $isOwner if true, only retrieve membership records for owners //LCD
*
* @return returns the number of members of type $membershipTypeId whose
* start_date is between $startDate and $endDate
* The second condition takes care of records that have no end_date. These
* are assumed to be lifetime memberships.
*
- * @param int $membershipTypeId membership type id
- * @param string $date the date for which to retrieve the count
- * @param bool $isTest if true, membership is for a test site
- * @param bool $isOwner if true, only retrieve membership records for owners //LCD
+ * @param int $membershipTypeId membership type id
+ * @param string $date the date for which to retrieve the count
+ * @param bool|int $isTest if true, membership is for a test site
+ * @param bool|int $isOwner if true, only retrieve membership records for owners //LCD
*
* @return returns the number of members of type $membershipTypeId as of
* $date.
*
* @param int $contactId contact id
*
- * @return
+ * @return int
*/
static function statusAvailabilty($contactId) {
$membership = new CRM_Member_DAO_MembershipStatus();
/**
* Process the Memberships
*
- * @param array $membershipParams array of membership fields
- * @param int $contactID contact id
- * @param object $form form object
+ * @param array $membershipParams array of membership fields
+ * @param int $contactID contact id
+ * @param object $form form object
*
+ * @param $premiumParams
+ * @param null $customFieldsFormatted
+ * @param null $includeFieldTypes
+ *
+ * @throws CRM_Core_Exception
* @return void
* @access public
*/
/**
* Function for updating a membership record's contribution_recur_id
*
- * @param object CRM_Member_BAO_Membership $membership
+ * @param object CRM_Member_DAO_Membership $membership
* @param object CRM_Contribute_BAO_Contribution $contribution
*
* @return void
* @static
* @access public
*/
- static public function updateRecurMembership(CRM_Member_BAO_Membership &$membership,
+ static public function updateRecurMembership(CRM_Member_DAO_Membership &$membership,
CRM_Contribute_BAO_Contribution &$contribution) {
if (empty($contribution->contribution_recur_id)) {
* whether the given contact has a membership or not. And will add
* the modified dates for membership and in the log table.
*
- * @param int $contactID id of the contact
- * @param int $membershipTypeID id of the new membership type
- * @param boolean $is_test if this is test contribution or live contribution
- * @param object $form form object
- * @param array $ipnParams array of name value pairs, to be used (for e.g source) when $form not present
- * @param int $modifiedID individual contact id in case of On Behalf signup (CRM-4027 )
- * @param int $numRenewTerms how many membership terms are being added to end date (default is 1)
+ * @param int $contactID id of the contact
+ * @param int $membershipTypeID id of the new membership type
+ * @param boolean $is_test if this is test contribution or live contribution
+ * @param object $form form object
+ * @param null $changeToday
+ * @param int $modifiedID individual contact id in case of On Behalf signup (CRM-4027 )
+ * @param null $customFieldsFormatted
+ * @param int $numRenewTerms how many membership terms are being added to end date (default is 1)
*
+ * @internal param array $ipnParams array of name value pairs, to be used (for e.g source) when $form not present
* @return object $membership object of membership
*
* @static
* @access public
*
- **/
+ */
static function renewMembership(
$contactID,
$membershipTypeID,
* For now we only allow custom membership fields to be in
* profile
*
+ * @param null $mode
+ *
* @return return the list of membership fields
* @static
* @access public
* function to create memberships for related contacts
* takes into account the maximum related memberships
*
- * @param array $params array of key - value pairs
- * @param object $membership membership object
+ * @param array $params array of key - value pairs
+ * @param $dao
+ *
+ * @internal param object $membership membership object
*
* @return null|relatedMembership array of memberships if created
* @static
if (($params['status_id'] == $deceasedStatusId) || ($params['status_id'] == $expiredStatusId)) {
// related membership is not active so does not count towards maximum
CRM_Member_BAO_Membership::create($params, $relMemIds);
- } else {
+ }
+ else {
// related membership already exists, so this is just an update
if (isset($params['id'])) {
if ($available > 0) {
return $membesrshipPayment;
}
+ /**
+ * @param $form
+ * @param null $membershipTypeID
+ *
+ * @return array
+ */
static function &buildMembershipTypeValues(&$form, $membershipTypeID = NULL) {
$whereClause = " WHERE domain_id = ". CRM_Core_Config::domainID();
/**
* Function to get membership record count for a Contact
*
- * @param int $contactId Contact ID
+ * @param $contactID
* @param boolean $activeOnly
*
+ * @internal param int $contactId Contact ID
* @return int count of membership records
* @access public
* @static
*
* @param int $mid membership id
*
+ * @param bool $isNotCancelled
+ *
* @return boolean
* @access public
* @static
* join_date and start_date are within a specified date range. Dates match
* the pattern "yyyy-mm-dd".
*
- * @param int $membershipTypeId membership type id
- * @param int $startDate date on which to start counting
- * @param int $endDate date on which to end counting
- * @param bool $isTest if true, membership is for a test site
+ * @param int $membershipTypeId membership type id
+ * @param int $startDate date on which to start counting
+ * @param int $endDate date on which to end counting
+ * @param bool|int $isTest if true, membership is for a test site
*
* @return returns the number of members of type $membershipTypeId
* whose join_date is between $startDate and $endDate and
* whose join_date is before and start_date is within a specified date
* range. Dates match the pattern "yyyy-mm-dd".
*
- * @param int $membershipTypeId membership type id
- * @param int $startDate date on which to start counting
- * @param int $endDate date on which to end counting
- * @param bool $isTest if true, membership is for a test site
+ * @param int $membershipTypeId membership type id
+ * @param int $startDate date on which to start counting
+ * @param int $endDate date on which to end counting
+ * @param bool|int $isTest if true, membership is for a test site
*
* @return returns the number of members of type $membershipTypeId
* whose join_date is before $startDate and
*
* @access public
*
+ * @param $membershipId
+ * @param $lineItem
+ *
* @return void
*/
function processPriceSet($membershipId, $lineItem) {
return $result;
}
- /** The function returns the membershiptypes for a particular contact
+ /**
+ * The function returns the membershiptypes for a particular contact
* who has lifetime membership without end date.
*
- * @param array $contactMembershipType array of allMembershipTypes Key - value pairs
+ * @param $contactID
+ * @param bool $isTest
+ * @param bool $onlyLifeTime
*
+ * @return array
+ * @internal param array $contactMembershipType array of allMembershipTypes Key - value pairs
*/
static function getAllContactMembership($contactID, $isTest = FALSE, $onlyLifeTime = FALSE) {
$contributionParams['currency'] = $config->defaultCurrency;
$contributionParams['receipt_date'] = (CRM_Utils_Array::value('receipt_date', $params)) ? $params['receipt_date'] : 'null';
$contributionParams['source'] = CRM_Utils_Array::value('contribution_source', $params);
- $contributionParams['soft_credit'] = CRM_Utils_Array::value('soft_credit', $params);
$contributionParams['non_deductible_amount'] = 'null';
+ $contributionSoftParams = CRM_Utils_Array::value('soft_credit', $params);
$recordContribution = array(
'contact_id', 'total_amount', 'receive_date', 'financial_type_id',
'payment_instrument_id', 'trxn_id', 'invoice_id', 'is_test',
'contribution_status_id', 'check_number', 'campaign_id', 'is_pay_later',
+ 'membership_id',
);
foreach ($recordContribution as $f) {
$contributionParams[$f] = CRM_Utils_Array::value($f, $params);
$contribution = CRM_Contribute_BAO_Contribution::create($contributionParams, $ids);
+ //CRM-13981, create new soft-credit record as to record payment from differnt person for this membership
+ if (!empty($contributionSoftParams)) {
+ $contributionSoftParams['contribution_id'] = $contribution->id;
+ $contributionSoftParams['currency'] = $contribution->currency;
+ $contributionSoftParams['amount'] = $contribution->total_amount;
+ CRM_Contribute_BAO_ContributionSoft::add($contributionSoftParams);
+ }
+
// store contribution id
$params['contribution_id'] = $contribution->id;
*
* @param $membershipType array with membership type and organization
*
- * @param$ priceSetId priceset id
+ * @param $priceSetId
+ *
+ * @internal param $ $ priceSetId priceset id
* @access public
* @static
*/
$qf->_params['price_' . $fieldID] = CRM_Utils_Array::value('id', $editedResults);
}
+ /**
+ * @todo document me - I seem a bit out of date....
+ */
static function _getActTypes() {
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
self::$_renewalActType = CRM_Utils_Array::key('Membership Renewal', $activityTypes);