Merge pull request #5856 from eileenmcnaughton/CRM-16402
[civicrm-core.git] / CRM / Campaign / Form / Task / Interview.php
index 99f77408d3a9a461d9e7d5d517aa574b1496a98c..c9c17f7fc23fbcd2103182ea06c9b974100e889d 100755 (executable)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -69,7 +69,7 @@ class CRM_Campaign_Form_Task_Interview extends CRM_Campaign_Form_Task {
   private $_allowAjaxReleaseButton;
 
   /**
-   * Build all the data structures needed to build the form
+   * Build all the data structures needed to build the form.
    *
    * @return void
    */
@@ -108,8 +108,8 @@ class CRM_Campaign_Form_Task_Interview extends CRM_Campaign_Form_Task {
       $orderByParams = CRM_Utils_Array::value('order_bys', $_POST);
     }
     elseif (CRM_Core_OptionGroup::getValue('activity_type', 'WalkList') == $this->_surveyDetails['activity_type_id']) {
-      $orderByParams =
-        array(
+      $orderByParams
+        array(
           1 => array(
             'column' => 'civicrm_address.street_name',
             'order' => 'ASC',
@@ -280,7 +280,7 @@ WHERE {$clause}
   }
 
   /**
-   * Build the form object
+   * Build the form object.
    *
    *
    * @return void
@@ -288,8 +288,8 @@ WHERE {$clause}
   public function buildQuickForm() {
     $this->assign('surveyTypeId', $this->_surveyTypeId);
 
-    $options =
-      array(
+    $options
+      array(
         '' => ' - none - ',
         'civicrm_address.street_name' => 'Street Name',
         'civicrm_address.street_number%2' => 'Odd / Even Street Number',
@@ -408,8 +408,8 @@ WHERE {$clause}
     }
 
     if (CRM_Core_OptionGroup::getValue('activity_type', 'WalkList') == $this->_surveyDetails['activity_type_id']) {
-      $defaults['order_bys'] =
-        array(
+      $defaults['order_bys']
+        array(
           1 => array(
             'column' => 'civicrm_address.street_name',
             'order' => 'ASC',
@@ -429,8 +429,8 @@ WHERE {$clause}
         );
     }
     else {
-      $defaults['order_bys'] =
-        array(
+      $defaults['order_bys']
+        array(
           1 => array(
             'column' => 'contact_a.sort_name',
             'order' => 'ASC',
@@ -441,7 +441,7 @@ WHERE {$clause}
   }
 
   /**
-   * Process the form after the input has been submitted and validated
+   * Process the form after the input has been submitted and validated.
    *
    *
    * @return void
@@ -498,7 +498,6 @@ WHERE {$clause}
 
     //format custom fields.
     $customParams = CRM_Core_BAO_CustomField::postProcess($params,
-      $surveyFields,
       $activityId,
       'Activity'
     );
@@ -546,8 +545,7 @@ WHERE {$clause}
     $subject = '';
     $surveyTitle = CRM_Utils_Array::value('surveyTitle', $params);
     if ($surveyTitle) {
-      $subject = ts('%1', array(1 => $surveyTitle));
-      $subject .= ' - ';
+      $subject = $surveyTitle . ' - ';
     }
     $subject .= ts('Respondent Interview');
 
@@ -626,7 +624,7 @@ WHERE {$clause}
 
         //create temporary table to store voter ids.
         $tempTableName = CRM_Core_DAO::createTempTableName('civicrm_survey_respondent');
-        CRM_Core_DAO::executeQuery("DROP TABLE IF EXISTS {$tempTableName}");
+        CRM_Core_DAO::executeQuery("DROP TEMPORARY TABLE IF EXISTS {$tempTableName}");
         $query = "
      CREATE TEMPORARY TABLE {$tempTableName} (
             id int unsigned NOT NULL AUTO_INCREMENT,
@@ -662,4 +660,5 @@ INNER JOIN  {$tempTableName} ON ( {$tempTableName}.survey_contact_id = contact.i
       }
     }
   }
+
 }