$params['skipLineItem'] = TRUE;
$params['partial_payment_total'] = $contributionDAO->total_amount;
$params['partial_amount_pay'] = $trxnsData['total_amount'];
+ $trxnsData['trxn_date'] = !empty($trxnsData['trxn_date']) ? $trxnsData['trxn_date'] : date('YmdHis');
// record the entry
$financialTrxn = CRM_Contribute_BAO_Contribution::recordFinancialAccounts($params, $trxnsData);
$contributionUpdate['id'] = $contributionId;
$contributionUpdate['contribution_status_id'] = $statusId;
$contributionUpdate['skipLineItem'] = TRUE;
- $contributionDetails = self::add($contributionUpdate);
+ // note : not using the self::add method,
+ // the reason because it performs 'status change' related code execution for financial records
+ // which in 'Partial Paid' => 'Completed' is not useful, instead specific financial record updates
+ // are coded below i.e. just updating financial_item status to 'Paid'
+ $contributionDetails = CRM_Core_DAO::setFieldValue('CRM_Contribute_BAO_Contribution', $contributionId, 'contribution_status_id', $statusId);
if ($participantId) {
// update participant status
$participantId = $this->_id;
}
$submittedValues = $this->controller->exportValues($this->_name);
+ $submittedValues['trxn_date'] = CRM_Utils_Date::processDate($submittedValues['trxn_date'], $submittedValues['trxn_date_time']);
if ($this->_mode) {
// process credit card
$this->fromEmailId = $submittedValues['from_email_address'];
$sendReceipt = self::emailReceipt($this, $submittedValues);
}
+
+ $statusMsg = ts('The payment record has been processed.');
+ if (CRM_Utils_Array::value('is_email_receipt', $this->_$submittedValues) && $sendReceipt) {
+ $statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.');
+ }
+ CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success');
+
+ $session = CRM_Core_Session::singleton();
+ $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view',
+ "reset=1&cid={$this->_contactId}&selectedChild=participant"
+ ));
}
}
$statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.');
}
CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success');
+ $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view',
+ "reset=1&cid={$this->_contactId}&selectedChild=participant"
+ ));
}
}
return;
}
+ $participantStatus = CRM_Event_PseudoConstant::participantStatus();
// set the contact, when contact is selected
if (CRM_Utils_Array::value('contact_select_id', $params)) {
$this->_contactId = $params['contact_select_id'][1];
$params['fee_level'] = $params['amount_level'];
$contributionParams['total_amount'] = $params['amount'];
- if ($this->_quickConfig && CRM_Utils_Array::value('total_amount', $params)) {
+ if ($this->_quickConfig && CRM_Utils_Array::value('total_amount', $params)
+ && $params['status_id'] != array_search('Partially paid', $participantStatus)) {
$params['fee_amount'] = $params['total_amount'];
} else {
//fix for CRM-3086
$contributionParams['is_pay_later'] = 1;
}
- // CRM-13964 partial_payment_total
- if ($amountOwed > $params['total_amount']) {
- // the owed amount
- $contributionParams['partial_payment_total'] = $amountOwed;
- // the actual amount paid
- $contributionParams['partial_amount_pay'] = $params['total_amount'];
+ if ($params['status_id'] == array_search('Partially paid', $participantStatus)) {
+ // CRM-13964 partial_payment_total
+ if ($amountOwed > $params['total_amount']) {
+ // the owed amount
+ $contributionParams['partial_payment_total'] = $amountOwed;
+ // the actual amount paid
+ $contributionParams['partial_amount_pay'] = $params['total_amount'];
+ }
}
if ($this->_single) {
if (empty($ids)) {
foreach ($this->_lineItem as $key => $value) {
if (is_array($value) && $value != 'skip') {
foreach ($value as $lineKey => $line) {
- /* //10117 update the line items for participants if contribution amount is recorded */
- /* if ($this->_quickConfig && CRM_Utils_Array::value('total_amount', $params )) { */
- /* $line['unit_price'] = $line['line_total'] = $params['total_amount']; */
- /* } */
+ //10117 update the line items for participants if contribution amount is recorded
+ if ($this->_quickConfig && CRM_Utils_Array::value('total_amount', $params )
+ && $params['status_id'] != array_search('Partially paid', $participantStatus)
+ ) {
+ $line['unit_price'] = $line['line_total'] = $params['total_amount'];
+ }
$lineItem[$this->_priceSetId][$lineKey] = $line;
}
CRM_Price_BAO_LineItem::processPriceSet($participants[$num]->id, $lineItem, CRM_Utils_Array::value($num, $contributions, NULL), 'civicrm_participant');