diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php index e7478f8b1310de74db35e4ceccccb1eca04fb1dd..3e80eb7615da505ff7ff5a7ccaa28d868a4d1852 100644 --- a/CRM/Pledge/Form/Pledge.php +++ b/CRM/Pledge/Form/Pledge.php @@ -96,7 +96,6 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { list($this->userDisplayName, $this->userEmail ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID); - $this->assign('displayName', $this->userDisplayName); } $this->setPageTitle(ts('Pledge')); @@ -153,6 +152,9 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { $this->assign('installments', $defaults['installments']); } else { + if ($this->_contactID) { + $defaults['contact_id'] = $this->_contactID; + } // default values. $defaults['create_date'] = date('Y-m-d'); $defaults['start_date'] = date('Y-m-d'); @@ -211,11 +213,9 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { return; } - if ($this->_context == 'standalone') { - $this->addEntityRef('contact_id', ts('Contact'), [ - 'create' => TRUE, - 'api' => ['extra' => ['email']], - ], TRUE); + $contactField = $this->addEntityRef('contact_id', ts('Contact'), ['create' => TRUE, 'api' => ['extra' => ['email']]], TRUE); + if ($this->_context != 'standalone') { + $contactField->freeze(); } $showAdditionalInfo = FALSE; @@ -545,12 +545,6 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { // send Acknowledgment mail. CRM_Pledge_BAO_Pledge::sendAcknowledgment($this, $params); - if (!isset($this->userEmail)) { - list($this->userDisplayName, - $this->userEmail - ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID); - } - $statusMsg .= ' ' . ts("An acknowledgment email has been sent to %1.<br />", [1 => $this->userEmail]); // build the payment urls. diff --git a/templates/CRM/Pledge/Form/Pledge.tpl b/templates/CRM/Pledge/Form/Pledge.tpl index 461f8a8122c0ec842c430be1be1aa127e3007b7a..7c006e99e57e9decdc0b69b93ed8f3f39d942b1b 100644 --- a/templates/CRM/Pledge/Form/Pledge.tpl +++ b/templates/CRM/Pledge/Form/Pledge.tpl @@ -51,17 +51,10 @@ </div> {else} <table class="form-layout-compressed"> - {if $context eq 'standalone'} <tr class="crm-pledge-form-contact-id"> <td class="label">{$form.contact_id.label}</td> <td>{$form.contact_id.html}</td> </tr> - {else} - <tr class="crm-pledge-form-block-displayName"> - <td class="font-size12pt right"><strong>{ts}Pledge by{/ts}</strong></td> - <td class="font-size12pt"><strong>{$displayName}</strong></td> - </tr> - {/if} <tr class="crm-pledge-form-block-amount"> <td class="label">{$form.amount.label}</td> <td>