<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
$mems_by_org = array();
foreach ($contactMemberships as $memid => $mem) {
$mem['member_of_contact_id'] = CRM_Utils_Array::value($mem['membership_type_id'], $memberorgs);
- if (CRM_Utils_Array::value('membership_end_date', $mem)) {
+ if (!empty($mem['membership_end_date'])) {
$mem['membership_end_date'] = CRM_Utils_Date::customformat($mem['membership_end_date']);
}
$mem['membership_type'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType',
}
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
*
* @access public
*
- * @return None
+ * @return void
*/
public function setDefaultValues() {
if ($this->_cdType) {
$defaults['num_terms'] = 1;
- if (CRM_Utils_Array::value('id', $defaults)) {
+ if (!empty($defaults['id'])) {
if ($this->_onlinePendingContributionId) {
$defaults['record_contribution'] = $this->_onlinePendingContributionId;
}
}
}
- if (CRM_Utils_Array::value('record_contribution', $defaults) && !$this->_mode) {
+ //set Soft Credit Type to Gift by default
+ $scTypes = CRM_Core_OptionGroup::values("soft_credit_type");
+ $defaults['soft_credit_type_id'] = CRM_Utils_Array::value(ts('Gift'), array_flip($scTypes));
+
+ if (!empty($defaults['record_contribution']) && !$this->_mode) {
$contributionParams = array('id' => $defaults['record_contribution']);
$contributionIds = array();
//get back original object campaign id.
$defaults['campaign_id'] = $memberCampaignId;
- if (CRM_Utils_Array::value('receive_date', $defaults)) {
+ if (!empty($defaults['receive_date'])) {
list($defaults['receive_date']) = CRM_Utils_Date::setDateDefaults($defaults['receive_date']);
}
// Contribution::getValues() over-writes the membership record's source field value - so we need to restore it.
- if (CRM_Utils_Array::value('membership_source', $defaults)) {
+ if (!empty($defaults['membership_source'])) {
$defaults['source'] = $defaults['membership_source'];
}
}
//CRM-13420
- if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+ if (empty($defaults['payment_instrument_id'])) {
$defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
}
unset($defaults['record_contribution']);
}
- if (CRM_Utils_Array::value('id', $defaults)) {
+ if (!empty($defaults['id'])) {
$subscriptionCancelled = CRM_Member_BAO_Membership::isSubscriptionCancelled($this->_id);
}
$alreadyAutoRenew = FALSE;
- if (CRM_Utils_Array::value('contribution_recur_id', $defaults) && !$subscriptionCancelled) {
+ if (!empty($defaults['contribution_recur_id']) && !$subscriptionCancelled) {
$defaults['auto_renew'] = 1;
$alreadyAutoRenew = TRUE;
}
$this->assign('membership_status_id', CRM_Utils_Array::value('status_id', $defaults));
- if (CRM_Utils_Array::value('is_pay_later', $defaults)) {
+ if (!empty($defaults['is_pay_later'])) {
$this->assign('is_pay_later', TRUE);
}
if ($this->_mode) {
// set default country from config if no country set
$config = CRM_Core_Config::singleton();
- if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $defaults)) {
+ if (empty($defaults["billing_country_id-{$this->_bltID}"])) {
$defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
}
- if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $defaults)) {
+ if (empty($defaults["billing_state_province_id-{$this->_bltID}"])) {
$defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
}
$dates = array('join_date', 'start_date', 'end_date');
foreach ($dates as $key) {
- if (CRM_Utils_Array::value($key, $defaults)) {
+ if (!empty($defaults[$key])) {
list($defaults[$key]) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value($key, $defaults));
}
}
//setting default join date if there is no join date
- if (!CRM_Utils_Array::value('join_date', $defaults)) {
+ if (empty($defaults['join_date'])) {
$defaults['join_date'] = $now;
}
- if (CRM_Utils_Array::value('membership_end_date', $defaults)) {
+ if (!empty($defaults['membership_end_date'])) {
$this->assign('endDate', $defaults['membership_end_date']);
}
/**
* Function to build the form
*
- * @return None
+ * @return void
* @access public
*/
public function buildQuickForm() {
// build price set form.
$buildPriceSet = FALSE;
- if ($this->_priceSetId || CRM_Utils_Array::value('price_set_id', $_POST)) {
- if (CRM_Utils_Array::value('price_set_id', $_POST)) {
+ if ($this->_priceSetId || !empty($_POST['price_set_id'])) {
+ if (!empty($_POST['price_set_id'])) {
$buildPriceSet = TRUE;
}
$getOnlyPriceSetElements = TRUE;
}
if ($this->_context == 'standalone') {
- CRM_Contact_Form_NewContact::buildQuickForm($this);
+ $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE), TRUE);
}
$selOrgMemType[0][0] = $selMemTypeOrg[0] = ts('- select -');
$allMembershipInfo = $membershipType = array();
foreach ($allMemberships as $key => $values) {
- if (CRM_Utils_Array::value('is_active', $values)) {
+ if (!empty($values['is_active'])) {
$membershipType[$key] = CRM_Utils_Array::value('name', $values);
- if ($this->_mode && !CRM_Utils_Array::value('minimum_fee', $values)) {
+ if ($this->_mode && empty($values['minimum_fee'])) {
continue;
}
else {
$memberOfContactId = CRM_Utils_Array::value('member_of_contact_id', $values);
- if (!CRM_Utils_Array::value($memberOfContactId, $selMemTypeOrg)) {
+ if (empty($selMemTypeOrg[$memberOfContactId])) {
$selMemTypeOrg[$memberOfContactId] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
$memberOfContactId,
'display_name',
$selOrgMemType[$memberOfContactId][0] = ts('- select -');
}
- if (!CRM_Utils_Array::value($key, $selOrgMemType[$memberOfContactId])) {
+ if (empty($selOrgMemType[$memberOfContactId][$key])) {
$selOrgMemType[$memberOfContactId][$key] = CRM_Utils_Array::value('name', $values);
}
}
ts('Financial Type'),
array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType()
);
- if ($this->_context != 'standalone') {
- //CRM-10223 - allow contribution to be recorded against different contact
- // causes a conflict in standalone mode so skip in standalone for now
- $this->addElement('checkbox', 'is_different_contribution_contact', ts('Record Payment from a Different Contact?'));
- $this->add('select', 'honor_type_id', ts('Membership payment is : '),
- array('' => ts('-')) + CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id'));
- CRM_Contact_Form_NewContact::buildQuickForm($this, 1, NULL, FALSE, 'contribution_');
- }
+
+ //CRM-10223 - allow contribution to be recorded against different contact
+ // causes a conflict in standalone mode so skip in standalone for now
+ $this->addElement('checkbox', 'is_different_contribution_contact', ts('Record Payment from a Different Contact?'));
+ $this->addSelect('soft_credit_type_id', array('entity' => 'contribution_soft'));
+ $this->addEntityRef('soft_credit_contact_id', ts('Payment From'), array('create' => TRUE));
+
$this->addElement('checkbox',
'send_receipt',
*
* @param array $params (ref.) an assoc array of name/value pairs
*
+ * @param $files
+ * @param $self
+ *
+ * @throws CiviCRM_API3_Exception
* @return mixed true or array of errors
* @access public
* @static
}
}
}
- elseif (!CRM_Utils_Array::value(1, $params['membership_type_id'])) {
+ elseif (empty($params['membership_type_id'][1])) {
$errors['membership_type_id'] = ts('Please select a membership type.');
}
else {
}
}
- //check if contact is selected in standalone mode
- if (isset($params['contact_select_id'][1]) && !$params['contact_select_id'][1]) {
- $errors['contact[1]'] = ts('Please select a contact or create new contact');
- }
-
if (!empty($errors)) {
return $errors;
}
- if ($priceSetId && !$self->_mode && !CRM_Utils_Array::value('record_contribution', $params)) {
+ if ($priceSetId && !$self->_mode && empty($params['record_contribution'])) {
$errors['record_contribution'] = ts('Record Membership Payment is required when you using price set.');
}
- if (!$priceSetId && $self->_mode && !CRM_Utils_Array::value('financial_type_id', $params)) {
+ if (!$priceSetId && $self->_mode && empty($params['financial_type_id'])) {
$errors['financial_type_id'] = ts('Please enter the financial Type.');
}
- if (CRM_Utils_Array::value('record_contribution', $params) && !CRM_Utils_Array::value('payment_instrument_id', $params)) {
+ if (!empty($params['record_contribution']) && empty($params['payment_instrument_id'])) {
$errors['payment_instrument_id'] = ts('Paid By is a required field.');
}
- if (CRM_Utils_Array::value('payment_processor_id', $params)) {
+ if (!empty($params['is_different_contribution_contact'])) {
+ if (empty($params['soft_credit_type_id'])) {
+ $errors['soft_credit_type_id'] = ts('Please Select a Soft Credit Type');
+ }
+ if (empty($params['soft_credit_contact_id'])) {
+ $errors['soft_credit_contact_id'] = ts('Please select a contact');
+ }
+ }
+
+ if (!empty($params['payment_processor_id'])) {
// make sure that credit card number and cvv are valid
CRM_Core_Payment_Form::validateCreditCard($params, $errors);
}
$joinDate = NULL;
- if (CRM_Utils_Array::value('join_date', $params)) {
+ if (!empty($params['join_date'])) {
$joinDate = CRM_Utils_Date::processDate($params['join_date']);
foreach ($self->_memTypeSelected as $memType) {
$startDate = NULL;
- if (CRM_Utils_Array::value('start_date', $params)) {
+ if (!empty($params['start_date'])) {
$startDate = CRM_Utils_Date::processDate($params['start_date']);
}
// if end date is set, ensure that start date is also set
// and that end date is later than start date
- // If selected membership type has duration unit as 'lifetime'
- // and end date is set, then give error
$endDate = NULL;
- if (CRM_Utils_Array::value('end_date', $params)) {
+ if (!empty($params['end_date'])) {
$endDate = CRM_Utils_Date::processDate($params['end_date']);
}
if ($endDate) {
if ($membershipDetails['duration_unit'] == 'lifetime') {
- $errors['end_date'] = ts('The selected Membership Type has a lifetime duration. You cannot specify an End Date for lifetime memberships. Please clear the End Date OR select a different Membership Type.');
+ // Check if status is NOT cancelled or similar. For lifetime memberships, there is no automated
+ // process to update status based on end-date. The user must change the status now.
+ $result = civicrm_api3('MembershipStatus', 'get', array(
+ 'sequential' => 1,
+ 'is_current_member' => 0,
+ ));
+ $tmp_statuses = $result['values'];
+ $status_ids = array();
+ foreach($tmp_statuses as $cur_stat) {
+ $status_ids[] = $cur_stat['id'];
+ }
+ if (empty($params['status_id']) || in_array( $params['status_id'] , $status_ids) == false) {
+ $errors['status_id'] = ts('Please enter a status that does NOT represent a current membership status.');
+ $errors['is_override'] = ts('This must be checked because you set an End Date for a lifetime membership');
+ }
}
else {
if (!$startDate) {
}
//CRM-3724, check for availability of valid membership status.
- if (!CRM_Utils_Array::value('is_override', $params) && !isset($errors['_qf_default'])) {
+ if (empty($params['is_override']) && !isset($errors['_qf_default'])) {
$calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate,
$endDate,
$joinDate,
'today',
- TRUE
+ TRUE,
+ $memType,
+ $params
);
if (empty($calcStatus)) {
$url = CRM_Utils_System::url('civicrm/admin/member/membershipStatus', 'reset=1&action=browse');
}
if (isset($params['is_override']) &&
- $params['is_override'] &&
- !CRM_Utils_Array::value('status_id', $params)
- ) {
+ $params['is_override'] && empty($params['status_id'])) {
$errors['status_id'] = ts('Please enter the status.');
}
}
// validate contribution status for 'Failed'.
- if ($self->_onlinePendingContributionId &&
- CRM_Utils_Array::value('record_contribution', $params) &&
+ if ($self->_onlinePendingContributionId && !empty($params['record_contribution']) &&
(CRM_Utils_Array::value('contribution_status_id', $params) ==
array_search('Failed', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'))
)
*
* @access public
*
- * @return None
+ * @return void
*/
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
$this->_params = $formValues = $this->controller->exportValues($this->_name);
$this->convertDateFieldsToMySQL($formValues);
- $params = $ids = array();
+ $params = $softParams = $ids = array();
$membershipTypeValues = array();
foreach ($this->_memTypeSelected as $memType) {
}
//take the required membership recur values.
- if ($this->_mode && CRM_Utils_Array::value('auto_renew', $this->_params)) {
+ if ($this->_mode && !empty($this->_params['auto_renew'])) {
$params['is_recur'] = $this->_params['is_recur'] = $formValues['is_recur'] = TRUE;
$mapping = array(
'frequency_interval' => 'duration_interval',
$submittedFinancialType = CRM_Utils_Array::value('financial_type_id', $formValues);
if (!empty($lineItem[$priceSetId])) {
foreach ($lineItem[$priceSetId] as &$li) {
- if (CRM_Utils_Array::value('membership_type_id', $li)) {
- if (CRM_Utils_Array::value('membership_num_terms', $li)) {
+ if (!empty($li['membership_type_id'])) {
+ if (!empty($li['membership_num_terms'])) {
$termsByType[$li['membership_type_id']] = $li['membership_num_terms'];
}
}
// fix for CRM-3724
// when is_override false ignore is_admin statuses during membership
// status calculation. similarly we did fix for import in CRM-3570.
- if (!CRM_Utils_Array::value('is_override', $params)) {
+ if (empty($params['is_override'])) {
$params['exclude_is_admin'] = TRUE;
}
$$dateVariable = CRM_Utils_Date::processDate($formValues[$dateField]);
}
- $num_terms = CRM_Utils_Array::value('num_terms', $formValues, 1);
+ $memTypeNumTerms = CRM_Utils_Array::value('num_terms', $formValues);
$calcDates = array();
foreach ($this->_memTypeSelected as $memType) {
- $memTypeNumTerms = CRM_Utils_Array::value($memType, $termsByType, $num_terms);
+ if (empty($memTypeNumTerms)) {
+ $memTypeNumTerms = CRM_Utils_Array::value($memType, $termsByType, 1);
+ }
$calcDates[$memType] = CRM_Member_BAO_MembershipType::getDatesForMembershipType($memType,
$joinDate, $startDate, $endDate, $memTypeNumTerms
);
// Retrieve the name and email of the current user - this will be the FROM for the receipt email
list($userName, $userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($ids['userId']);
- //CRM-10223 - allow contribution to be recorded against different contact
+ //CRM-13981, allow different person as a soft-contributor of chosen type
if ($this->_contributorContactID != $this->_contactID) {
$params['contribution_contact_id'] = $this->_contributorContactID;
- if (CRM_Utils_Array::value('honor_type_id', $this->_params)) {
- $params['honor_type_id'] = $this->_params['honor_type_id'];
- $params['honor_contact_id'] = $params['contact_id'];
+ if (!empty($this->_params['soft_credit_type_id'])) {
+ $softParams['soft_credit_type_id'] = $this->_params['soft_credit_type_id'];
+ $softParams['contact_id'] = $this->_contactID;
}
}
- if (CRM_Utils_Array::value('record_contribution', $formValues)) {
+ if (!empty($formValues['record_contribution'])) {
$recordContribution = array(
'total_amount',
- 'honor_type_id',
'financial_type_id',
'payment_instrument_id',
'trxn_id',
);
}
- if (!CRM_Utils_Array::value('is_override', $params) &&
+ if (empty($params['is_override']) &&
CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Pending', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'))
) {
$allStatus = CRM_Member_PseudoConstant::membershipStatus();
$this->assign('is_pay_later', 1);
}
- if (CRM_Utils_Array::value('send_receipt', $formValues)) {
+ if (!empty($formValues['send_receipt'])) {
$params['receipt_date'] = CRM_Utils_Array::value('receive_date', $formValues);
}
//CRM-10377 if payment is by an alternate contact then we need to set that person
// as the contact in the payment params
if ($this->_contributorContactID != $this->_contactID) {
- if (CRM_Utils_Array::value('honor_type_id', $this->_params)) {
- $paymentParams['honor_contact_id'] = $this->_contactID;
- $paymentParams['honor_type_id'] = $this->_params['honor_type_id'];
+ if (!empty($this->_params['soft_credit_type_id'])) {
+ $softParams['contact_id'] = $params['contact_id'];
+ $softParams['soft_credit_type_id'] = $this->_params['soft_credit_type_id'];
}
}
- if (CRM_Utils_Array::value('send_receipt', $this->_params)) {
+ if (!empty($this->_params['send_receipt'])) {
$paymentParams['email'] = $this->_contributorEmail;
}
// CRM-7137 -for recurring membership,
// we do need contribution and recuring records.
$result = NULL;
- if (CRM_Utils_Array::value('is_recur', $paymentParams)) {
+ if (!empty($paymentParams['is_recur'])) {
$allStatus = CRM_Member_PseudoConstant::membershipStatus();
$contributionType = new CRM_Financial_DAO_FinancialType();
TRUE,
FALSE
);
+
+ //create new soft-credit record, CRM-13981
+ $softParams['contribution_id'] = $contribution->id;
+ $softParams['currency'] = $contribution->currency;
+ $softParams['amount'] = $contribution->total_amount;
+ CRM_Contribute_BAO_ContributionSoft::add($softParams);
+
$paymentParams['contactID'] = $contactID;
$paymentParams['contributionID'] = $contribution->id;
$paymentParams['contributionTypeID'] = $contribution->financial_type_id;
if (is_a($result, 'CRM_Core_Error')) {
//make sure to cleanup db for recurring case.
- if (CRM_Utils_Array::value('contributionID', $paymentParams)) {
+ if (!empty($paymentParams['contributionID'])) {
CRM_Contribute_BAO_Contribution::deleteContribution($paymentParams['contributionID']);
}
- if (CRM_Utils_Array::value('contributionRecurID', $paymentParams)) {
+ if (!empty($paymentParams['contributionRecurID'])) {
CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']);
}
$this->assign('amount', $params['total_amount']);
}
- $params['contribution_status_id'] = CRM_Utils_Array::value('is_recur', $paymentParams) ? 2 : 1;
+ $params['contribution_status_id'] = !empty($paymentParams['is_recur']) ? 2 : 1;
$params['receive_date'] = $now;
$params['invoice_id'] = $this->_params['invoiceID'];
$params['contribution_source'] = ts('%1 Membership Signup: Credit card or direct debit (by %2)',
$params['trxn_id'] = CRM_Utils_Array::value('trxn_id', $result);
$params['payment_instrument_id'] = 1;
$params['is_test'] = ($this->_mode == 'live') ? 0 : 1;
- if (CRM_Utils_Array::value('send_receipt', $this->_params)) {
+ if (!empty($this->_params['send_receipt'])) {
$params['receipt_date'] = $now;
}
else {
}
else {
$params['action'] = $this->_action;
- if ($this->_onlinePendingContributionId &&
- CRM_Utils_Array::value('record_contribution', $formValues)
- ) {
+ if ($this->_onlinePendingContributionId && !empty($formValues['record_contribution'])) {
// update membership as well as contribution object, CRM-4395
$params['contribution_id'] = $this->_onlinePendingContributionId;
$params['componentId'] = $params['id'];
$params['componentName'] = 'contribute';
$result = CRM_Contribute_BAO_Contribution::transitionComponents($params, TRUE);
- if (!empty($result) && CRM_Utils_Array::value('contribution_id', $params)) {
+ if (!empty($result) && !empty($params['contribution_id'])) {
$lineItem = array();
$lineItems = CRM_Price_BAO_LineItem::getLineItems($params['contribution_id'], 'contribution');
$itemId = key($lineItems);
$priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'price_set_id');
$fieldType = NULL;
- if ($itemId && CRM_Utils_Array::value('price_field_id', $lineItems[$itemId])) {
+ if ($itemId && !empty($lineItems[$itemId]['price_field_id'])) {
$fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'html_type');
}
$lineItems[$itemId]['unit_price'] = $params['total_amount'];
$lineItems[$itemId]['line_total'] = $params['total_amount'];
$lineItems[$itemId]['id'] = $itemId;
$lineItem[$priceSetId] = $lineItems;
- CRM_Price_BAO_LineItem::processPriceSet($params['contribution_id'], $lineItem);
+ $contributionBAO = new CRM_Contribute_BAO_Contribution();
+ $contributionBAO->id = $params['contribution_id'];
+ $contributionBAO->find();
+ CRM_Price_BAO_LineItem::processPriceSet($params['contribution_id'], $lineItem, $contributionBAO, 'civicrm_membership');
+
+ //create new soft-credit record, CRM-13981
+ $softParams['contribution_id'] = $params['contribution_id'];
+
+ while ($contributionBAO->fetch()) {
+ $softParams['currency'] = $contributionBAO->currency;
+ $softParams['amount'] = $contributionBAO->total_amount;
+ }
+ CRM_Contribute_BAO_ContributionSoft::add($softParams);
}
//carry updated membership object.
else {
$count = 0;
foreach ($this->_memTypeSelected as $memType) {
- if ($count &&
- CRM_Utils_Array::value('record_contribution', $formValues) &&
+ if ($count && !empty($formValues['record_contribution']) &&
($relateContribution = CRM_Member_BAO_Membership::getMembershipContributionId($membership->id))
) {
$membershipTypeValues[$memType]['relate_contribution_id'] = $relateContribution;
}
$membershipParams = array_merge($params, $membershipTypeValues[$memType]);
- if (CRM_Utils_Array::value('int_amount', $formValues)) {
+ if (!empty($formValues['int_amount'])) {
$init_amount = array();
foreach ($formValues as $key => $value) {
if (strstr($key, 'txt-price')) {
}
$membershipParams['init_amount'] = $init_amount;
}
+
+ if (!empty($softParams)) {
+ $membershipParams['soft_credit'] = $softParams;
+ }
+
$membership = CRM_Member_BAO_Membership::create($membershipParams, $ids);
$this->_membershipIDs[] = $membership->id;
if (!empty($lineItem[$priceSetId])) {
foreach ($lineItem[$priceSetId] as & $priceFieldOp) {
- if (CRM_Utils_Array::value('membership_type_id', $priceFieldOp)) {
+ if (!empty($priceFieldOp['membership_type_id'])) {
$priceFieldOp['start_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'], '%d%f %b, %Y') : '-';
$priceFieldOp['end_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['end_date'], '%d%f %b, %Y') : '-';
$this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE);
$receiptSend = FALSE;
- if (CRM_Utils_Array::value('send_receipt', $formValues)) {
+ if (!empty($formValues['send_receipt'])) {
$receiptSend = TRUE;
$formValues['contact_id'] = $this->_contactID;
$memEndDate = ($membership->end_date) ? $membership->end_date : $endDate;
//get the end date from calculated dates.
- if (!$memEndDate && !CRM_Utils_Array::value('is_recur', $params)) {
+ if (!$memEndDate && empty($params['is_recur'])) {
$memEndDate = CRM_Utils_Array::value('end_date', $calcDates[$memType]);
}
/**
* Function to send email receipt
*
- * @param object $form form object
- * @param array $values submitted values
+ * @param object $form form object
+ * @param $formValues
* @param object $membership object
*
+ * @internal param array $values submitted values
* @return boolean true if mail was sent successfully
* @static
*/
// retrieve 'from email id' for acknowledgement
$receiptFrom = $formValues['from_email_address'];
- if (CRM_Utils_Array::value('payment_instrument_id', $formValues)) {
+ if (!empty($formValues['payment_instrument_id'])) {
$paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
$formValues['paidBy'] = $paymentInstrument[$formValues['payment_instrument_id']];
}
CRM_Core_BAO_UFGroup::getValues($formValues['contact_id'], $customFields, $customValues, FALSE, $members);
if ($form->_mode) {
- if (CRM_Utils_Array::value('billing_first_name', $form->_params)) {
+ if (!empty($form->_params['billing_first_name'])) {
$name = $form->_params['billing_first_name'];
}
- if (CRM_Utils_Array::value('billing_middle_name', $form->_params)) {
+ if (!empty($form->_params['billing_middle_name'])) {
$name .= " {$form->_params['billing_middle_name']}";
}
- if (CRM_Utils_Array::value('billing_last_name', $form->_params)) {
+ if (!empty($form->_params['billing_last_name'])) {
$name .= " {$form->_params['billing_last_name']}";
}
$form->assign('membershipID', CRM_Utils_Array::value('membership_id', $form->_params, CRM_Utils_Array::value('membership_id', $form->_defaultValues)));
- if (CRM_Utils_Array::value('contribution_id', $formValues)) {
+ if (!empty($formValues['contribution_id'])) {
$form->assign('contributionID', $formValues['contribution_id']);
}
elseif (isset($form->_onlinePendingContributionId)) {
$form->assign('contributionID', $form->_onlinePendingContributionId);
}
- if (CRM_Utils_Array::value('contribution_status_id', $formValues)) {
+ if (!empty($formValues['contribution_status_id'])) {
$form->assign('contributionStatusID', $formValues['contribution_status_id']);
$form->assign('contributionStatus', CRM_Contribute_PseudoConstant::contributionStatus($formValues['contribution_status_id'], 'name'));
}
- if (CRM_Utils_Array::value('is_renew', $formValues)) {
+ if (!empty($formValues['is_renew'])) {
$form->assign('receiptType', 'membership renewal');
}
else {