-- CRM-12682 applied patch and made some modifications
authorRavish Nair <ravish.nair@webaccess.co.in>
Thu, 30 May 2013 13:04:14 +0000 (18:34 +0530)
committerRavish Nair <ravish.nair@webaccess.co.in>
Thu, 30 May 2013 13:04:14 +0000 (18:34 +0530)
CRM/Contact/Form/Task/PDFLetterCommon.php
templates/CRM/Contact/Form/Task/PDFLetterCommon.tpl
templates/CRM/Mailing/Form/InsertTokens.tpl

index fa33e96194d5e7f19cbc5912a0b49c183483e523..c865c1ceb2bc5e17d70842eaf34d21eb430a7297 100644 (file)
@@ -74,6 +74,16 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
    * @return void
    */
   static function buildQuickForm(&$form) {
+    //Added for CRM-12682: Add activity subject and campaign fields
+    CRM_Campaign_BAO_Campaign::addCampaign($form);
+    $form->add(
+      'text',
+      'subject',
+      ts('Activity Subject'),
+      array('size' => 45, 'maxlength' => 255),
+      FALSE
+    );
+
     $form->add('static', 'pdf_format_header', NULL, ts('Page Format'));
     $form->add(
       'select',
@@ -354,6 +364,8 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
   }
 
   function createActivities($form, $html_message, $contactIds) {
+    //Added for CRM-12682: Add activity subject and campaign fields
+    $formValues     = $form->controller->exportValues($form->getName());
 
     $session        = CRM_Core_Session::singleton();
     $userID         = $session->get('userID');
@@ -363,6 +375,8 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
       'name'
     );
     $activityParams = array(
+      'subject' => $formValues['subject'],
+      'campaign_id' => $formValues['campaign_id'],
       'source_contact_id' => $userID,
       'activity_type_id' => $activityTypeID,
       'activity_date_time' => date('YmdHis'),
index 9fd17bee78a23d596337b21c06947d629f77a1ab..da7e5a51bdc9e867ca8a14af33e844c837b9d1db 100644 (file)
 {if $form.template.html}
 <table class="form-layout-compressed">
     <tr>
-        <td class="label-left">{$form.template.label}</td>
+      <td class="label-left">{$form.template.label}</td>
       <td>{$form.template.html}</td>
     </tr>
+    <tr>
+      <td class="label-left">{$form.subject.label}</td>
+      <td>{$form.subject.html}</td>
+    </tr>
+    <tr>
+      <td class="label-left">{$form.campaign_id.label}</td>
+      <td>{$form.campaign_id.html}</td>
+    </tr>
 </table>
 {/if}
 
index 0357845123ba48fee24ac3b5eebfc90d165263e7..448d2776f5757b854e4a7d5e174686623f4415f8 100644 (file)
@@ -107,9 +107,9 @@ function selectValue( val ) {
   document.getElementsByName("updateTemplate")[0].checked = false;
   showSaveUpdateChkBox();
   if ( !val ) {
+    document.getElementById("subject").value ="";
     if ( !isPDF ) {
       document.getElementById(text_message).value ="";
-      document.getElementById("subject").value ="";
     }
     if ( editor == "ckeditor" ) {
       oEditor = CKEDITOR.instances[html_message];
@@ -147,9 +147,8 @@ function selectValue( val ) {
   var dataUrl = {/literal}"{crmURL p='civicrm/ajax/template' h=0 }"{literal};
 
   cj.post( dataUrl, {tid: val}, function( data ) {
+    cj("#subject").val( data.subject );
     if ( !isPDF ) {
-      cj("#subject").val( data.subject );
-
       if ( data.msg_text ) {
         cj("#"+text_message).val( data.msg_text );
         cj("div.text").show();