}
- if ($this->_single) {
- $urlPath = 'civicrm/contact/view/participant';
- $urlParams = "reset=1&cid={$this->_contactId}&context=participant";
- if ($this->_context == 'standalone') {
- $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE), TRUE);
- $urlParams = 'reset=1&context=standalone';
- $urlPath = 'civicrm/participant/add';
- }
-
- if ($this->_id) {
- $urlParams .= "&action=update&id={$this->_id}";
- }
- else {
- $urlParams .= "&action=add";
- }
-
- if ($this->_mode) {
- $urlParams .= "&mode={$this->_mode}";
- }
-
- $url = CRM_Utils_System::url($urlPath, $urlParams,
- FALSE, NULL, FALSE
- );
+ if ($this->_single && $this->_context == 'standalone') {
+ $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE);
}
- else {
- $currentPath = CRM_Utils_System::currentPath();
-
- $url = CRM_Utils_System::url($currentPath, '_qf_Participant_display=true',
- FALSE, NULL, FALSE
- );
- }
-
- $this->assign('refreshURL', $url);
$eventFieldParams = array(
'entity' => 'event',
{if $context eq 'standalone' and $outBound_option != 2 }
<script type="text/javascript">
{literal}
-CRM.$(function($) {
- $("#contact_id").change( function( ) {
- checkEmail( );
- } );
- checkEmail( );
-});
-function checkEmail( ) {
- var contactID = cj("#contact_id").val();
- if ( contactID ) {
- var postUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' h=0}{literal}";
- cj.post( postUrl, {contact_id: contactID},
- function ( response ) {
- if ( response ) {
- cj("#email-receipt").show( );
- if ( cj("#send_receipt").is(':checked') ) {
- cj("#notice").show( );
- }
+ CRM.$(function($) {
+ var $form = $("form.{/literal}{$form.formClass}{literal}");
+ $("#contact_id", $form).change(checkEmail);
+ checkEmail();
- cj("#email-address").html( response );
- } else {
- cj("#email-receipt").hide( );
- cj("#notice").hide( );
- }
- }
- );
+ function checkEmail( ) {
+ var data = $("#contact_id", $form).select2('data');
+ if (data && data.extra && data.extra.email && data.extra.email.length) {
+ $("#email-receipt", $form).show();
+ if ($("#send_receipt", $form).is(':checked')) {
+ $("#notice", $form).show();
+ }
+ $("#email-address", $form).html(data.extra.email);
+ }
+ else {
+ $("#email-receipt, #notice", $form).hide();
+ }
}
-}
+ });
{/literal}
</script>
{/if}