X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FEvent%2FForm%2FParticipantFeeSelection.php;h=7ff20fb1ac92e1ec2d55535f496cdaf36343aaf6;hb=a4d42ed6184ae28d52b0273bcb53597b87605f26;hp=2c8e0238e80f1a49c1a017f4db1ee6411aba50de;hpb=c18f31144a0c2b3f54933cf04a26ae1d62335efb;p=civicrm-core.git diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php index 2c8e0238e8..7ff20fb1ac 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -1,9 +1,9 @@ _fromEmails = CRM_Event_BAO_Event::getFromEmailIds($this->_eventId); $this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_participantId, 'contribution_id', 'participant_id'); + if (!$this->_contributionId) { + if ($primaryParticipantId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'registered_by_id')) { + $this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_ParticipantPayment', $primaryParticipantId, 'contribution_id', 'participant_id'); + } + } + if ($this->_contributionId) { $this->_isPaidEvent = TRUE; } @@ -98,6 +104,18 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { $this->assign('paymentInfo', $paymentInfo); $this->assign('feePaid', $this->_paidAmount); + $ids = CRM_Event_BAO_Participant::getParticipantIds($this->_contributionId); + if (count($ids) > 1) { + $total = 0; + foreach ($ids as $val) { + $total += CRM_Price_BAO_LineItem::getLineTotal($val, 'civicrm_participant'); + } + $this->assign('totalLineTotal', $total); + + $lineItemTotal = CRM_Price_BAO_LineItem::getLineTotal($this->_participantId, 'civicrm_participant'); + $this->assign('lineItemTotal', $lineItemTotal); + } + $title = "Change selections for {$this->_contributorDisplayName}"; if ($title) { CRM_Utils_System::setTitle(ts('%1', array(1 => $title))); @@ -179,12 +197,13 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { 'isDefault' => TRUE, ); - $buttons[] = array( - 'type' => 'upload', - 'name' => ts('Save and Record Payment'), - 'subName' => 'new' - ); - + if (CRM_Event_BAO_Participant::isPrimaryParticipant($this->_participantId)) { + $buttons[] = array( + 'type' => 'upload', + 'name' => ts('Save and Record Payment'), + 'subName' => 'new' + ); + } $buttons[] = array( 'type' => 'cancel', 'name' => ts('Cancel'), @@ -194,6 +213,13 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { $this->addFormRule(array('CRM_Event_Form_ParticipantFeeSelection', 'formRule'), $this); } + /** + * @param $fields + * @param $files + * @param $self + * + * @return array + */ static function formRule($fields, $files, $self) { $errors = array(); return $errors; @@ -237,6 +263,11 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { } } + /** + * @param $params + * + * @return mixed + */ function emailReceipt(&$params) { $updatedLineItem = CRM_Price_BAO_LineItem::getLineItems($this->_participantId, 'participant', NULL, FALSE); $lineItem = array();