- * @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?
// CRM_Contact_BAO_Relationship::relatedMemberships()
if (isset($params['owner_membership_id'])) {
unset($params['max_related']);
// CRM_Contact_BAO_Relationship::relatedMemberships()
if (isset($params['owner_membership_id'])) {
unset($params['max_related']);
// 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']);
// 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
* Function to check the membership extended through relationship
*
* @param int $membershipId membership id
* 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
*
* 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 $defaults (reference ) an assoc array to hold the name / value pairs
* in a hierarchical manner
* @param array $defaults (reference ) an assoc array to hold the name / value pairs
* in a hierarchical manner
- * @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
* Function to return a current membership of given contact
* NB: if more than one membership meets criteria, a randomly selected one is returned.
*
* Function to return a current membership of given contact
* NB: if more than one membership meets criteria, a randomly selected one is returned.
*
* @static
*/
static function getContactMembership($contactID, $memType, $isTest, $membershipId = NULL, $onlySameParentOrg = FALSE) {
* @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".
*
* 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
*
* @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.
*
* 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
- * @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
* whether the given contact has a membership or not. And will add
* the modified dates for membership and in the log table.
*
* 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)
* function to create memberships for related contacts
* takes into account the maximum related memberships
*
* 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
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);
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);
// related membership already exists, so this is just an update
if (isset($params['id'])) {
if ($available > 0) {
// related membership already exists, so this is just an update
if (isset($params['id'])) {
if ($available > 0) {
static function &buildMembershipTypeValues(&$form, $membershipTypeID = NULL) {
$whereClause = " WHERE domain_id = ". CRM_Core_Config::domainID();
static function &buildMembershipTypeValues(&$form, $membershipTypeID = NULL) {
$whereClause = " WHERE domain_id = ". CRM_Core_Config::domainID();
* join_date and start_date are within a specified date range. Dates match
* the pattern "yyyy-mm-dd".
*
* 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
*
* @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".
*
* 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
*
* @return returns the number of members of type $membershipTypeId
* whose join_date is before $startDate and
$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['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);
$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',
$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',
);
foreach ($recordContribution as $f) {
$contributionParams[$f] = CRM_Utils_Array::value($f, $params);
);
foreach ($recordContribution as $f) {
$contributionParams[$f] = CRM_Utils_Array::value($f, $params);
+ //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);
+ }
+
static function _getActTypes() {
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
self::$_renewalActType = CRM_Utils_Array::key('Membership Renewal', $activityTypes);
static function _getActTypes() {
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
self::$_renewalActType = CRM_Utils_Array::key('Membership Renewal', $activityTypes);