CRM-14200: Tell a friend i18n translation dialog/popups fix.
authorMathieu Lutfy <mathieu@bidon.ca>
Mon, 10 Feb 2014 22:48:56 +0000 (17:48 -0500)
committerMathieu Lutfy <mathieu@bidon.ca>
Mon, 10 Feb 2014 22:48:56 +0000 (17:48 -0500)
CRM/Friend/BAO/Friend.php
CRM/Friend/Form/Contribute.php
CRM/Friend/Form/Event.php
templates/CRM/Friend/Form/Friend.tpl

index b2d74b66a44320620a01c5a9bbc71f640d506dfa..f8d430d5f6786e78f115c92df9a0a0febd50ffec 100644 (file)
@@ -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);
+    }
   }
 
   /**
index ddfc05524e7d22e0f0969a9a56821647fefa2353..64b8957969492195af4d22c71ed8d45f3f7eb5bc 100644 (file)
@@ -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();
   }
index 88920ab78e4778d424e799d23446964801bf002b..24874c3a5bbdb1fe9df694f6d31280de74ee4365 100644 (file)
@@ -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();
   }
index 61dff05551204ad6a7b11775420d0e5b0b268a70..76104afb9c6f13153c34a3b77294d90eb86fcdd7 100644 (file)
@@ -55,7 +55,7 @@
         <tr class="crm-friend-manage-form-block-tf_title">
      <td class="label">{$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}
            </td>
      <td>{$form.tf_title.html}
@@ -64,7 +64,7 @@
         <tr class="crm-friend-manage-form-block-intro">
      <td class="label">{$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}
      </td>
      <td>{$form.intro.html}<br />
@@ -75,7 +75,7 @@
         <tr class="crm-friend-manage-form-block-suggested_message">
      <td class="label">{$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}
      </td>
      <td>{$form.suggested_message.html}<br />
         <tr class="crm-friend-manage-form-block-thankyou_title">
            <td class="label">{$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}</td>
+              {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_tell_friend' field='tf_thankyou_title' id=$friendId}{/if}</td>
      <td>{$form.tf_thankyou_title.html}</td>
         </tr>
         <tr class="crm-friend-manage-form-block-thankyou_text">
      <td class="label">{$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}
      </td>
      <td>{$form.tf_thankyou_text.html}<br />