}
}
// For single additions - show validation error if the contact has already been registered
- // for this event with the same role.
+ // for this event.
if ($self->_single && ($self->_action & CRM_Core_Action::ADD)) {
- $contactId = $self->_contactId;
+ if ($self->_context == 'standalone') {
+ $contactId = CRM_Utils_Array::value('contact_id', $values);
+ }
+ else {
+ $contactId = $self->_contactId;
+ }
+
$eventId = CRM_Utils_Array::value('event_id', $values);
if (!empty($contactId) && !empty($eventId)) {
$dupeCheck = new CRM_Event_BAO_Participant();
$contributionParams = array();
$lineItem = array();
$additionalParticipantDetails = array();
+ if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+ $eventStartDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'start_date');
+ if ($eventStartDate) {
+ $contributionParams['revenue_recognition_date'] = date('Ymd', strtotime($eventStartDate));
+ }
+ }
if (($this->_id && $this->_action & CRM_Core_Action::UPDATE) && $this->_paymentId) {
$participantBAO = new CRM_Event_BAO_Participant();
$participantBAO->id = $this->_id;
$lineItem[$this->_priceSetId][$lineKey] = $line;
}
CRM_Price_BAO_LineItem::processPriceSet($participants[$num]->id, $lineItem, CRM_Utils_Array::value($num, $contributions, NULL), 'civicrm_participant');
- CRM_Contribute_BAO_Contribution::addPayments($value, $contributions);
+ CRM_Contribute_BAO_Contribution::addPayments($contributions);
}
}
}
$this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params));
}
if ($this->_mode) {
- if (!empty($params['billing_first_name'])) {
- $name = $params['billing_first_name'];
- }
-
- if (!empty($params['billing_middle_name'])) {
- $name .= " {$params['billing_middle_name']}";
- }
-
- if (!empty($params['billing_last_name'])) {
- $name .= " {$params['billing_last_name']}";
- }
- $this->assign('billingName', $name);
-
- // assign the address formatted up for display
- $addressParts = array(
- "street_address-{$this->_bltID}",
- "city-{$this->_bltID}",
- "postal_code-{$this->_bltID}",
- "state_province-{$this->_bltID}",
- "country-{$this->_bltID}",
- );
- $addressFields = array();
- foreach ($addressParts as $part) {
- list($n, $id) = explode('-', $part);
- if (isset($this->_params['billing_' . $part])) {
- $addressFields[$n] = $this->_params['billing_' . $part];
- }
- }
- $this->assign('address', CRM_Utils_Address::format($addressFields));
+ $this->assignBillingName($params);
+ $this->assign('address', CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters(
+ $this->_params,
+ $this->_bltID
+ ));
$date = CRM_Utils_Date::format($params['credit_card_exp_date']);
$date = CRM_Utils_Date::mysqlToIso($date);
}
}
CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success');
-
+ $session = CRM_Core_Session::singleton();
$buttonName = $this->controller->getButtonName();
if ($this->_context == 'standalone') {
if ($buttonName == $this->getButtonName('upload', 'new')) {