| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* Static field for all the membership information that we can potentially import
*
* @var array
- * @static
*/
static $_importableFields = NULL;
* The array that holds all the db ids.
*
* @return CRM_Member_BAO_Membership
- * @static
*/
public static function add(&$params, $ids = array()) {
$oldStatus = $oldType = NULL;
* be returned
*
* @return CRM_Member_BAO_Membership|null the found object or null
- * @static
*/
public static function &getValues(&$params, &$values, $active = FALSE) {
if (empty($params)) {
*
* @throws CRM_Core_Exception
*
- * @return CRM_Member_BAO_Membership
- * @static
+ * @return CRM_Member_BAO_Membership|CRM_Core_Error
*/
public static function create(&$params, &$ids, $skipRedirect = FALSE, $activityType = 'Membership Signup') {
// always calculate status if is_override/skipStatusCal is not true.
*
* @param int $action
*
- * @return Array
+ * @return array
* array of contact_id of all related contacts.
- * @static
*/
public static function checkMembershipRelationship($membershipId, $contactId, $action = CRM_Core_Action::ADD) {
$contacts = array();
* in a hierarchical manner
*
* @return CRM_Member_BAO_Membership
- * @static
*/
public static function retrieve(&$params, &$defaults) {
$membership = new CRM_Member_DAO_Membership();
* @param int $membershipId
* Membership id that needs to be deleted.
*
- * @static
*
- * @return $results no of deleted Membership on success, false otherwise
+ * @return int $results id of deleted Membership on success, false otherwise
*/
public static function del($membershipId) {
//delete related first and then delete parent.
* @param int $membershipId
* Membership id that needs to be deleted.
*
- * @static
*
- * @return $results no of deleted Membership on success, false otherwise
+ * @return int $results id of deleted Membership on success, false otherwise
*/
public static function deleteMembership($membershipId) {
// CRM-12147, retrieve membership data before we delete it for hooks
* @param int $contactId
*
* @return null
- * @static
*/
public static function deleteRelatedMemberships($ownerMembershipId, $contactId = NULL) {
if (!$ownerMembershipId && !$contactId) {
- return;
+ return FALSE;
}
$membership = new CRM_Member_DAO_Membership();
*
* @return array
* array of memberships based on status
- * @static
*/
public static function activeMembers($memberships, $status = 'active') {
$actives = array();
* @return bool
* Is this a separate membership payment
*
- * @static
*/
- static function buildMembershipBlock(
+ public static function buildMembershipBlock(
&$form,
$pageID,
$cid,
*
* @return array|null
*
- * @static
*/
public static function getMembershipBlock($pageID) {
$membershipBlock = array();
* True if only Memberships with same parent org as the $memType wanted, false otherwise.
*
* @return array|bool
- * @static
*/
public static function getContactMembership($contactID, $memType, $isTest, $membershipId = NULL, $onlySameParentOrg = FALSE) {
$dao = new CRM_Member_DAO_Membership();
*
* @return array
* array of importable Fields
- * @static
*/
public static function &importableFields($contactType = 'Individual', $status = TRUE) {
if (!self::$_importableFields) {
* Get all exportable fields
*
* @retun array return array of all exportable fields
- * @static
*/
public static function &exportableFields() {
$expFieldMembership = CRM_Member_DAO_Membership::export();
* @param \CRM_Contribute_BAO_Contribution|\CRM_Contribute_DAO_Contribution $contribution
*
* @return void
- * @static
*/
static public function updateRecurMembership(CRM_Member_DAO_Membership $membership, CRM_Contribute_BAO_Contribution $contribution) {
*
* @throws CRM_Core_Exception
*
- * @static
*/
- static function renewMembershipFormWrapper(
+ public static function renewMembershipFormWrapper(
$contactID,
$membershipTypeID,
$is_test,
* to be customised, null otherwise
*
* @return void
- * @static
*/
public static function fixMembershipStatusBeforeRenew(&$currentMembership, $changeToday) {
$today = NULL;
*
* @return int
* contribution page id
- * @static
*/
public static function getContributionPageId($membershipID) {
$query = "
* Owner Membership Id.
* @param array $params
* Formatted array of key => value.
- * @static
*/
public static function updateRelatedMemberships($ownerMembershipId, $params) {
$membership = new CRM_Member_DAO_Membership();
*
* @return array
* the list of membership fields
- * @static
*/
public static function getMembershipFields($mode = NULL) {
$fields = CRM_Member_DAO_Membership::export();
*
* @return null|string
* sort name of the contact if found
- * @static
*/
public static function sortName($id) {
$id = CRM_Utils_Type::escape($id, 'Integer');
*
* @return null|array
* array of memberships if created
- * @static
*/
public static function createRelatedMemberships(&$params, &$dao, $reset = FALSE) {
static $relatedContactIds = array();
if ($reset) {
// not sure why a static var is in use here - we need a way to reset it from the test suite
$relatedContactIds = array();
- return;
+ return FALSE;
}
$membership = new CRM_Member_DAO_Membership();
CRM_Member_BAO_Membership::create($params, $relMemIds);
$available--;
}
- else { // we have run out of inherited memberships, so delete extras
+ else {
+ // we have run out of inherited memberships, so delete extras
self::deleteMembership($params['id']);
}
// we need to first check if there will remain inherited memberships, so queue it up
*
* @param int $membershipId
*
- * @return boolean
- * true if deleted false otherwise
+ * @return object
+ * $membershipPayment deleted membership payment object
*/
public static function deleteMembershipPayment($membershipId) {
- $membesrshipPayment = new CRM_Member_DAO_MembershipPayment();
- $membesrshipPayment->membership_id = $membershipId;
- $membesrshipPayment->find();
+ $membershipPayment = new CRM_Member_DAO_MembershipPayment();
+ $membershipPayment->membership_id = $membershipId;
+ $membershipPayment->find();
- while ($membesrshipPayment->fetch()) {
- CRM_Contribute_BAO_Contribution::deleteContribution($membesrshipPayment->contribution_id);
- CRM_Utils_Hook::pre('delete', 'MembershipPayment', $membesrshipPayment->id, $membesrshipPayment);
+ while ($membershipPayment->fetch()) {
+ CRM_Contribute_BAO_Contribution::deleteContribution($membershipPayment->contribution_id);
+ CRM_Utils_Hook::pre('delete', 'MembershipPayment', $membershipPayment->id, $membershipPayment);
$membesrshipPayment->delete();
- CRM_Utils_Hook::post('delete', 'MembershipPayment', $membesrshipPayment->id, $membesrshipPayment);
+ CRM_Utils_Hook::post('delete', 'MembershipPayment', $membershipPayment->id, $membershipPayment);
}
- return $membesrshipPayment;
+ return $membershipPayment;
}
/**
* @param bool $activeOnly
*
* @return null|string
- * @static
*/
public static function getContactMembershipCount($contactID, $activeOnly = FALSE) {
$select = "SELECT count(*) FROM civicrm_membership ";
*
* @param bool $isNotCancelled
*
- * @return boolean
- * @static
+ * @return bool
*/
public static function isCancelSubscriptionSupported($mid, $isNotCancelled = TRUE) {
$cacheKeyString = "$mid";
*
* @return string
* contribution status
- * @static
*/
public static function isSubscriptionCancelled($mid) {
$sql = "
* @return CRM_Contribute_BAO_Contribution
*/
public static function processSecondaryFinancialTransaction($contactID, &$form, $tempParams, $isTest, $lineItems, $minimumFee, $financialTypeID) {
- $contributionType = new CRM_Financial_DAO_FinancialType();
- $contributionType->id = $financialTypeID;
- if (!$contributionType->find(TRUE)) {
+ $financialType = new CRM_Financial_DAO_FinancialType();
+ $financialType->id = $financialTypeID;
+ if (!$financialType->find(TRUE)) {
CRM_Core_Error::fatal(ts("Could not find a system table"));
}
$tempParams['amount'] = $minimumFee;
if ($form->_contributeMode == 'express') {
$result = $payment->doExpressCheckout($tempParams);
+ if (is_a($result, 'CRM_Core_Error')) {
+ throw new CRM_Core_Exception(CRM_Core_Error::getMessages($result));
+ }
}
else {
- $result = $payment->doDirectPayment($tempParams);
+ $result = $payment->doPayment($tempParams, 'contribute');
}
}
- if (is_a($result, 'CRM_Core_Error')) {
- throw new CRM_Core_Exception(CRM_Core_Error::getMessages($result));
- }
- else {
- //assign receive date when separate membership payment
- //and contribution amount not selected.
- if ($form->_amount == 0) {
- $now = date('YmdHis');
- $form->_params['receive_date'] = $now;
- $receiveDate = CRM_Utils_Date::mysqlToIso($now);
- $form->set('params', $form->_params);
- $form->assign('receive_date', $receiveDate);
- }
-
- $form->set('membership_trx_id', $result['trxn_id']);
- $form->set('membership_amount', $minimumFee);
-
- $form->assign('membership_trx_id', $result['trxn_id']);
- $form->assign('membership_amount', $minimumFee);
-
- // we don't need to create the user twice, so lets disable cms_create_account
- // irrespective of the value, CRM-2888
- $tempParams['cms_create_account'] = 0;
-
- $pending = $form->_params['is_pay_later'] ? (($minimumFee > 0.0) ? TRUE : FALSE) : FALSE;
-
- //set this variable as we are not creating pledge for
- //separate membership payment contribution.
- //so for differentiating membership contribution from
- //main contribution.
- $form->_params['separate_membership_payment'] = 1;
- $membershipContribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($form,
- $tempParams,
- $result,
- $contactID,
- $contributionType,
- $pending,
- TRUE,
- $isTest,
- $lineItems
- );
- return $membershipContribution;
+ //assign receive date when separate membership payment
+ //and contribution amount not selected.
+ if ($form->_amount == 0) {
+ $now = date('YmdHis');
+ $form->_params['receive_date'] = $now;
+ $receiveDate = CRM_Utils_Date::mysqlToIso($now);
+ $form->set('params', $form->_params);
+ $form->assign('receive_date', $receiveDate);
}
+
+ $form->set('membership_trx_id', $result['trxn_id']);
+ $form->set('membership_amount', $minimumFee);
+
+ $form->assign('membership_trx_id', $result['trxn_id']);
+ $form->assign('membership_amount', $minimumFee);
+
+ // we don't need to create the user twice, so lets disable cms_create_account
+ // irrespective of the value, CRM-2888
+ $tempParams['cms_create_account'] = 0;
+
+ $pending = $form->_params['is_pay_later'] ? (($minimumFee > 0.0) ? TRUE : FALSE) : FALSE;
+
+ //set this variable as we are not creating pledge for
+ //separate membership payment contribution.
+ //so for differentiating membership contribution from
+ //main contribution.
+ $form->_params['separate_membership_payment'] = 1;
+ $membershipContribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($form,
+ $tempParams,
+ $result,
+ $contactID,
+ $financialType,
+ $pending,
+ TRUE,
+ $isTest,
+ $lineItems
+ );
+ return $membershipContribution;
}
/**
* (param in process of being removed - try to use params) array of ids.
*
* @return CRM_Contribute_BAO_Contribution
- * @static
*/
public static function recordMembershipContribution(&$params, $ids = array()) {
$membershipId = $params['membership_id'];
* Array with membership type and organization.
* @param int $priceSetId
*
- * @static
*/
public static function createLineItems(&$qf, $membershipType, &$priceSetId) {
$qf->_priceSetId = $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_membership_type_amount', 'id', 'name');
*
* @return array
* Array of membership type
- * @static
*/
public static function getContactsCancelledMembership($contactID, $isTest = FALSE) {
if (!$contactID) {
}
return $cancelledMembershipIds;
}
+
}