}
}
// 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();
$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);
}
}
- if (CRM_Utils_Array::value($num, $contributions)) {
- $trxnParams = array('contribution' => $contributions[$num]);
- CRM_Contribute_BAO_Contribution::recordAlwaysAccountsReceivable($trxnParams, 'Participant');
- }
}
}
$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);