From 7deb374ee50e5199efeca205829d73147da2bddc Mon Sep 17 00:00:00 2001 From: yashodha Date: Wed, 18 Sep 2019 15:14:10 +0530 Subject: [PATCH] (dev/core#1065) Pledge in Edit mode needs to be shown consistently --- CRM/Pledge/Form/Pledge.php | 16 +++++----------- templates/CRM/Pledge/Form/Pledge.tpl | 7 ------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php index e7478f8b13..3d19bf37b0 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; } + $contactField = $this->addEntityRef('contact_id', ts('Contact'), ['create' => TRUE, 'api' => ['extra' => ['email']]], TRUE); if ($this->_context == 'standalone') { - $this->addEntityRef('contact_id', ts('Contact'), [ - 'create' => TRUE, - 'api' => ['extra' => ['email']], - ], TRUE); + $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.
", [1 => $this->userEmail]); // build the payment urls. diff --git a/templates/CRM/Pledge/Form/Pledge.tpl b/templates/CRM/Pledge/Form/Pledge.tpl index 461f8a8122..7c006e99e5 100644 --- a/templates/CRM/Pledge/Form/Pledge.tpl +++ b/templates/CRM/Pledge/Form/Pledge.tpl @@ -51,17 +51,10 @@ {else} - {if $context eq 'standalone'} - {else} - - - - - {/if}
{$form.contact_id.label} {$form.contact_id.html}
{ts}Pledge by{/ts}{$displayName}
{$form.amount.label} -- 2.25.1