public function preProcess() { $this->_participantId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->_eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_participantId, 'event_id'); $this->_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) { $this->_isPaidEvent = TRUE; } $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, TRUE); list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId); $this->assign('displayName', $this->_contributorDisplayName); $this->assign('email', $this->_contributorEmail); $this->_participantStatus = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'status_id'); //set the payment mode - _mode property is defined in parent class $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this); $this->assign('contactId', $this->_contactId); $this->assign('id', $this->_participantId); $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_participantId, 'event'); $this->_paidAmount = $paymentInfo['paid']; $this->assign('paymentInfo', $paymentInfo); CRM_Core_Resources::singleton()->addSetting(array('feePaid' => $this->_paidAmount)); $title = "Change selections for {$this->_contributorDisplayName}"; if ($title) { CRM_Utils_System::setTitle(ts('%1', array(1 => $title))); } }
public function preProcess() { $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE); $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail(); $this->_formType = CRM_Utils_Array::value('formType', $_GET); $enitityType = NULL; if ($this->_component == 'event') { $enitityType = 'participant'; $this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'contribution_id', 'participant_id'); } $eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id'); $this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($eventId); $paymentInfo = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($this->_id, $enitityType); $paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component); $this->_amtPaid = $paymentDetails['paid']; $this->_amtTotal = $paymentDetails['total']; if (!empty($paymentInfo['refund_due'])) { $paymentAmt = $this->_refund = $paymentInfo['refund_due']; $this->_paymentType = 'refund'; } elseif (!empty($paymentInfo['amount_owed'])) { $paymentAmt = $this->_owed = $paymentInfo['amount_owed']; $this->_paymentType = 'owed'; } else { CRM_Core_Error::fatal(ts('No payment information found for this record')); } //set the payment mode - _mode property is defined in parent class $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this); if (!empty($this->_mode) && $this->_paymentType == 'refund') { CRM_Core_Error::fatal(ts('Credit card payment is not for Refund payments use')); } list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId); if (!$this->_refund) { $this->assignProcessors(); // also check for billing information // get the billing location type $this->assignBillingType(); } $this->assign('contributionMode', $this->_mode); $this->assign('contactId', $this->_contactId); $this->assign('component', $this->_component); $this->assign('id', $this->_id); $this->assign('paymentType', $this->_paymentType); $this->assign('paymentAmt', abs($paymentAmt)); $this->_paymentProcessor = array('billing_mode' => 1); $title = $this->_refund ? "Refund for {$this->_contributorDisplayName}" : "Payment from {$this->_contributorDisplayName}"; if ($title) { CRM_Utils_System::setTitle(ts('%1', array(1 => $title))); } }
/** * Set variables up before form is built. * * @param CRM_Core_Form $form */ public static function preProcess(&$form) { //as when call come from register.php if (!$form->_eventId) { $form->_eventId = CRM_Utils_Request::retrieve('eventId', 'Positive', $form); } $form->_pId = CRM_Utils_Request::retrieve('participantId', 'Positive', $form); $form->_discountId = CRM_Utils_Request::retrieve('discountId', 'Positive', $form); $form->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($form->_eventId); //CRM-6907 set event specific currency. if ($form->_eventId && ($currency = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $form->_eventId, 'currency'))) { CRM_Core_Config::singleton()->defaultCurrency = $currency; } }
public function preProcess() { $this->_participantId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->_eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_participantId, 'event_id'); $this->_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; } $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, TRUE); list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId); $this->assign('displayName', $this->_contributorDisplayName); $this->assign('email', $this->_contributorEmail); $this->_participantStatus = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'status_id'); //set the payment mode - _mode property is defined in parent class $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this); $this->assign('contactId', $this->_contactId); $this->assign('id', $this->_participantId); $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_participantId, 'event'); $this->_paidAmount = $paymentInfo['paid']; $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))); } }
public function preProcess() { $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE); $this->_view = CRM_Utils_Request::retrieve('view', 'String', $this, FALSE); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE); $this->assign('component', $this->_component); $this->assign('id', $this->_id); $this->assign('suppressPaymentFormButtons', $this->isBeingCalledFromSelectorContext()); if ($this->_view == 'transaction' && $this->_action & CRM_Core_Action::BROWSE) { $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, TRUE); $transactionRows = $paymentInfo['transaction']; $title = ts('View Payment'); if ($this->_component == 'event') { $info = CRM_Event_BAO_Participant::participantDetails($this->_id); $title .= " - {$info['title']}"; } CRM_Utils_System::setTitle($title); $this->assign('transaction', TRUE); $this->assign('rows', $transactionRows); return; } $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail(); $this->_formType = CRM_Utils_Array::value('formType', $_GET); $enitityType = NULL; if ($this->_component == 'event') { $enitityType = 'participant'; $this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'contribution_id', 'participant_id'); } $eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id'); $this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($eventId); $paymentInfo = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($this->_id, $enitityType); $paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, FALSE, TRUE); $this->_amtPaid = $paymentDetails['paid']; $this->_amtTotal = $paymentDetails['total']; if (!empty($paymentInfo['refund_due'])) { $paymentAmt = $this->_refund = $paymentInfo['refund_due']; $this->_paymentType = 'refund'; } elseif (!empty($paymentInfo['amount_owed'])) { $paymentAmt = $this->_owed = $paymentInfo['amount_owed']; $this->_paymentType = 'owed'; } else { CRM_Core_Error::fatal(ts('No payment information found for this record')); } //set the payment mode - _mode property is defined in parent class $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this); if (!empty($this->_mode) && $this->_paymentType == 'refund') { CRM_Core_Error::fatal(ts('Credit card payment is not for Refund payments use')); } list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId); $this->assignPaymentRelatedVariables(); $this->assign('contributionMode', $this->_mode); $this->assign('contactId', $this->_contactId); $this->assign('paymentType', $this->_paymentType); $this->assign('paymentAmt', abs($paymentAmt)); $this->setPageTitle($this->_refund ? ts('Refund') : ts('Payment')); }