$this->addDate('receive_date', ts('Received'), FALSE, array('formatType' => 'activityDateTime'));
$this->add('select', 'payment_instrument_id',
- ts('Paid By'),
+ ts('Payment Method'),
array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
FALSE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);")
);
}
if (!empty($params['record_contribution']) && empty($params['payment_instrument_id'])) {
- $errors['payment_instrument_id'] = ts('Paid By is a required field.');
+ $errors['payment_instrument_id'] = ts('Payment Method is a required field.');
}
if (!empty($params['is_different_contribution_contact'])) {
$allMemberStatus = CRM_Member_PseudoConstant::membershipStatus();
$allContributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
- $lineItems = NULL;
- if (!empty($this->_lineItem)) {
- $lineItems = $this->_lineItem;
- }
-
if ($this->_id) {
$ids['membership'] = $params['id'] = $this->_id;
}
$this->_params['ip_address'] = CRM_Utils_System::ipAddress();
$this->_params['amount'] = $params['total_amount'];
$this->_params['currencyID'] = $config->defaultCurrency;
- $this->_params['description'] = ts('Office Credit Card Membership Signup Contribution');
+ $this->_params['description'] = ts("Contribution submitted by a staff person using member's credit card for signup");
$this->_params['invoiceID'] = md5(uniqid(rand(), TRUE));
$this->_params['financial_type_id'] = $params['financial_type_id'];
// we do need contribution and recurring records.
$result = NULL;
if (!empty($paymentParams['is_recur'])) {
- $contributionType = new CRM_Financial_DAO_FinancialType();
- $contributionType->id = $params['financial_type_id'];
- $contributionType->find(TRUE);
+ $financialType = new CRM_Financial_DAO_FinancialType();
+ $financialType->id = $params['financial_type_id'];
+ $financialType->find(TRUE);
$contribution = CRM_Contribute_Form_Contribution_Confirm::processFormContribution($this,
$paymentParams,
- $result,
- $this->_contributorContactID,
- $contributionType,
+ NULL,
+ array(
+ 'contact_id' => $this->_contributorContactID,
+ 'line_item' => $lineItem,
+ 'is_test' => $isTest,
+ 'campaign_id' => CRM_Utils_Array::value('campaign_id', $paymentParams),
+ 'contribution_page_id' => CRM_Utils_Array::value('contribution_page_id', $this->_params),
+ 'source' => CRM_Utils_Array::value('source', $paymentParams, CRM_Utils_Array::value('description', $paymentParams)),
+ 'thankyou_date' => CRM_Utils_Array::value('thankyou_date', $paymentParams),
+ 'payment_instrument_id' => $this->_paymentProcessor['payment_instrument_id'],
+ ),
+ $financialType,
TRUE,
FALSE,
- $isTest,
- $lineItems,
$this->_bltID
);
}
}
- if ($result) {
- $this->_params = array_merge($this->_params, $result);
- //assign amount to template if payment was successful
- $this->assign('amount', $params['total_amount']);
- }
-
- // if the payment processor returns a payment_status_id -we assume this
- // applies to the whole contribution.
- // At this stage this form is not processing separate payments.
- if (isset($result['payment_status_id'])) {
- // CRM-16737 $result['contribution_status_id'] is deprecated in favour
- // of payment_status_id as the payment processor only knows whether the payment is complete
- // not whether payment completes the contribution
- $params['contribution_status_id'] = $params['payment_status_id'];
- }
- // do what used to happen previously
- else {
- $params['contribution_status_id'] = !empty($paymentParams['is_recur']) ? 2 : 1;
- }
- if ($params['contribution_status_id'] != array_search('Completed', $allContributionStatus)) {
+ if ($this->_params['payment_status_id'] != array_search('Completed', $allContributionStatus)) {
$params['status_id'] = array_search('Pending', $allMemberStatus);
$params['skipStatusCal'] = TRUE;
// unset send-receipt option, since receipt will be sent when ipn is received.
if (!empty($softParams) && empty($paymentParams['is_recur'])) {
$membershipParams['soft_credit'] = $softParams;
}
+ // This is required to trigger the recording of the membership contribution in the
+ // CRM_Member_BAO_Membership::Create function.
+ // @todo stop setting this & 'teach' the create function to respond to something
+ // appropriate as part of our 2-step always create the pending contribution & then finally add the payment
+ // process -
+ // @see http://wiki.civicrm.org/confluence/pages/viewpage.action?pageId=261062657#Payments&AccountsRoadmap-Movetowardsalwaysusinga2-steppaymentprocess
+ $membershipParams['contribution_status_id'] = CRM_Utils_Array::value('payment_status_id', $result);
+ unset($membershipParams['lineItems']);
$membership = CRM_Member_BAO_Membership::create($membershipParams, $ids);
$params['contribution'] = CRM_Utils_Array::value('contribution', $membershipParams);
unset($params['lineItems']);
$statusMsg = '';
if (($this->_action & CRM_Core_Action::UPDATE)) {
$statusMsg = $this->getStatusMessageForUpdate($membership, $endDate, $receiptSend);
-
}
elseif (($this->_action & CRM_Core_Action::ADD)) {
$statusMsg = $this->getStatusMessageForCreate($endDate, $receiptSend, $membershipTypes, $createdMemberships,
}
CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success');
-
+ //CRM-15187
+ // dusplay message when membership type is changed
+ if (($this->_action & CRM_Core_Action::UPDATE) && $this->_id && !in_array($this->_memType, $this->_memTypeSelected)) {
+ CRM_Core_Session::setStatus(
+ ts('The financial types associated with the old and new membership types are different. You may want to edit the contribution associated with this membership to adjust its financial type.'),
+ ts('Warning')
+ );
+ CRM_Core_Session::setStatus(
+ ts('The cost of the old and new membership types are different. You may want to edit the contribution associated with this membership to adjust its amount.'),
+ ts('Warning')
+ );
+ }
return $createdMemberships;
}
}
}
$statusMsg = implode('<br/>', $statusMsg);
- if ($receiptSend && $mailSent) {
+ if ($receiptSend && !empty($mailSent)) {
$statusMsg .= ' ' . ts('A membership confirmation and receipt has been sent to %1.', array(1 => $this->_contributorEmail));
}
return $statusMsg;