From: Mathieu Lutfy Date: Mon, 10 Feb 2014 22:48:56 +0000 (-0500) Subject: CRM-14200: Tell a friend i18n translation dialog/popups fix. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=00f9643dd1a263a397b9c861544955607de93f9e;p=civicrm-core.git CRM-14200: Tell a friend i18n translation dialog/popups fix. --- diff --git a/CRM/Friend/BAO/Friend.php b/CRM/Friend/BAO/Friend.php index b2d74b66a4..f8d430d5f6 100644 --- a/CRM/Friend/BAO/Friend.php +++ b/CRM/Friend/BAO/Friend.php @@ -257,6 +257,11 @@ class CRM_Friend_BAO_Friend extends CRM_Friend_DAO_Friend { $form->add('text', 'tf_thankyou_title', ts('Thank-you Title'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'thankyou_title'), TRUE); $form->addWysiwyg('tf_thankyou_text', ts('Thank-you Message'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'thankyou_text'), TRUE); + + if ($form->_friendId) { + // CRM-14200 the i18n dialogs need this for translation + $form->assign('friendId', $form->_friendId); + } } /** diff --git a/CRM/Friend/Form/Contribute.php b/CRM/Friend/Form/Contribute.php index ddfc05524e..64b8957969 100644 --- a/CRM/Friend/Form/Contribute.php +++ b/CRM/Friend/Form/Contribute.php @@ -44,7 +44,7 @@ class CRM_Friend_Form_Contribute extends CRM_Contribute_Form_ContributionPage { * * @var int */ - private $_friendId; + public $_friendId; public function preProcess() { parent::preProcess(); @@ -93,6 +93,13 @@ class CRM_Friend_Form_Contribute extends CRM_Contribute_Form_ContributionPage { * @access public */ public function buildQuickForm() { + if (isset($this->_id)) { + $defaults['entity_table'] = 'civicrm_contribution_page'; + $defaults['entity_id'] = $this->_id; + CRM_Friend_BAO_Friend::getValues($defaults); + $this->_friendId = CRM_Utils_Array::value('id', $defaults); + } + CRM_Friend_BAO_Friend::buildFriendForm($this); parent::buildQuickForm(); } diff --git a/CRM/Friend/Form/Event.php b/CRM/Friend/Form/Event.php index 88920ab78e..24874c3a5b 100644 --- a/CRM/Friend/Form/Event.php +++ b/CRM/Friend/Form/Event.php @@ -44,7 +44,7 @@ class CRM_Friend_Form_Event extends CRM_Event_Form_ManageEvent { * * @var int */ - private $_friendId; + public $_friendId; public function preProcess() { parent::preProcess(); @@ -95,6 +95,13 @@ class CRM_Friend_Form_Event extends CRM_Event_Form_ManageEvent { * @access public */ public function buildQuickForm() { + if (isset($this->_id)) { + $defaults['entity_table'] = 'civicrm_event'; + $defaults['entity_id'] = $this->_id; + CRM_Friend_BAO_Friend::getValues($defaults); + $this->_friendId = CRM_Utils_Array::value('id', $defaults); + } + CRM_Friend_BAO_Friend::buildFriendForm($this); parent::buildQuickForm(); } diff --git a/templates/CRM/Friend/Form/Friend.tpl b/templates/CRM/Friend/Form/Friend.tpl index 61dff05551..76104afb9c 100644 --- a/templates/CRM/Friend/Form/Friend.tpl +++ b/templates/CRM/Friend/Form/Friend.tpl @@ -55,7 +55,7 @@ {$form.tf_title.label} {if $action == 2} - {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_tell_friend' field='title' id=$id} + {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_tell_friend' field='title' id=$friendId} {/if} {$form.tf_title.html} @@ -64,7 +64,7 @@ {$form.intro.label} {if $action == 2} - {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_tell_friend' field='intro' id=$id} + {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_tell_friend' field='intro' id=$friendId} {/if} {$form.intro.html}
@@ -75,7 +75,7 @@ {$form.suggested_message.label} {if $action == 2} - {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_tell_friend' field='suggested_message' id=$id} + {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_tell_friend' field='suggested_message' id=$friendId} {/if} {$form.suggested_message.html}
@@ -93,13 +93,13 @@ {$form.tf_thankyou_title.label} {if $action == 2} - {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_tell_friend' field='tf_thankyou_title' id=$id}{/if} + {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_tell_friend' field='tf_thankyou_title' id=$friendId}{/if} {$form.tf_thankyou_title.html} {$form.tf_thankyou_text.label} {if $action == 2} - {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_tell_friend' field='tf_thankyou_text' id=$id} + {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_tell_friend' field='tf_thankyou_text' id=$friendId} {/if} {$form.tf_thankyou_text.html}