Skip to content

Commit

Permalink
Merge pull request #14738 from civicrm/5.16
Browse files Browse the repository at this point in the history
5.16 to master
  • Loading branch information
eileenmcnaughton authored Jul 4, 2019
2 parents ac68453 + 31fe2c0 commit 5a28b9c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -3891,6 +3891,7 @@ public static function checkStatusValidation($values, &$fields, &$errors) {
'In Progress' => ['Cancelled', 'Completed', 'Failed'],
'Refunded' => ['Cancelled', 'Completed'],
'Partially paid' => ['Completed'],
'Pending refund' => ['Completed', 'Refunded'],
];

if (!in_array($contributionStatuses[$fields['contribution_status_id']],
Expand Down Expand Up @@ -4013,6 +4014,7 @@ public static function recordAdditionalPayment($contributionId, $trxnsData, $pay
elseif ($paymentType == 'refund') {
$trxnsData['total_amount'] = -$trxnsData['total_amount'];
$trxnsData['participant_id'] = $participantId;
$trxnsData['contribution_id'] = $contributionId;
return civicrm_api3('Payment', 'create', $trxnsData)['id'];
}
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/AdditionalPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public static function formRule($fields, $files, $self) {
if ($self->_paymentType == 'refund' && $fields['total_amount'] != abs($self->_refund)) {
$errors['total_amount'] = ts('Refund amount must equal refund due amount.');
}
$netAmt = $fields['total_amount'] - CRM_Utils_Array::value('fee_amount', $fields, 0);
$netAmt = (float) $fields['total_amount'] - (float) CRM_Utils_Array::value('fee_amount', $fields, 0);
if (!empty($fields['net_amount']) && $netAmt != $fields['net_amount']) {
$errors['net_amount'] = ts('Net amount should be equal to the difference between payment amount and fee amount.');
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Form/EventFees.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public static function buildQuickForm(&$form) {
$form->_pId, 'contribution_id', 'participant_id'
)
) {
$form->_online = TRUE;
$form->_online = !$form->isBackOffice;
}
}

Expand Down
5 changes: 1 addition & 4 deletions CRM/Event/Form/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public function preProcess() {
$this->_id = NULL;
}
else {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
}

if ($this->_id) {
Expand Down Expand Up @@ -594,9 +594,6 @@ public function setDefaultValues() {
* @throws \CiviCRM_API3_Exception
*/
public function buildQuickForm() {
if ($this->_id) {
$this->add('hidden', 'id', $this->_id);
}

$participantStatuses = CRM_Event_PseudoConstant::participantStatus();
$partiallyPaidStatusId = array_search('Partially paid', $participantStatuses);
Expand Down
3 changes: 3 additions & 0 deletions templates/CRM/Event/Form/Participant.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@
{if $urlPathVar}
dataUrl += '&' + '{$urlPathVar}';
{/if}
{if $isBackOffice}
dataUrl += '&' + 'is_backoffice=1';
{/if}
{literal}
var eventId = $('[name=event_id], #event_id', $form).val();
Expand Down

0 comments on commit 5a28b9c

Please sign in to comment.