INFRA-132 - CRM/ - Fix misc oddball syntax
authorTim Otten <totten@civicrm.org>
Fri, 9 Jan 2015 02:31:55 +0000 (18:31 -0800)
committerTim Otten <totten@civicrm.org>
Fri, 9 Jan 2015 03:57:13 +0000 (19:57 -0800)
12 files changed:
CRM/Activity/BAO/ActivityTarget.php
CRM/Contact/BAO/Group.php
CRM/Contact/Form/Edit/Notes.php
CRM/Contribute/Form/AdditionalInfo.php
CRM/Contribute/Form/Contribution.php
CRM/Core/BAO/Mapping.php
CRM/Core/BAO/MessageTemplate.php
CRM/Financial/Form/FinancialAccount.php
CRM/Logging/Differ.php
CRM/Upgrade/Headless.php
CRM/Upgrade/Incremental/php/FourThree.php
CRM/Utils/REST.php

index 97bb4ee482411b18901e530a11d88a106f26fffd..dba9688d2ede00a8755755e77a61e10abf6772e3 100644 (file)
@@ -59,7 +59,7 @@ class CRM_Activity_BAO_ActivityTarget extends CRM_Activity_DAO_ActivityContact {
     $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
 
     $target->copyValues($params);
-    $target->record_type_id = $targetID ;
+    $target->record_type_id = $targetID;
     return $target->save();
   }
 
index 68dfe71cbdb3cf6bd7e5729b7dfb9dfce68b135c..848f5d1fa2ee9f02b6327e6c8ecd64218b77feb2 100644 (file)
@@ -1222,7 +1222,7 @@ WHERE {$whereClause}";
     if ($excludeHidden) {
       $clauses[] = 'groups.is_hidden = 0';
     }
-    ;
+
     $clauses[] = self::getPermissionClause();
 
 
index a5494df6938717626b8aa0bf97fa7e2efaef7d4c..a827078176720db55521011d06d32746bb17f1b0 100644 (file)
@@ -32,7 +32,7 @@
  * $Id$
  *
  */
-Class CRM_Contact_Form_Edit_Notes {
+class CRM_Contact_Form_Edit_Notes {
 
   /**
    * This function is to build form elements
index f59759cb79f2821fb71c90706a6fdf8ff3eceebc..ec0dc8ef0b34598d272a11ea2ec7ca1915c7be7b 100644 (file)
@@ -377,8 +377,7 @@ class CRM_Contribute_Form_AdditionalInfo {
         $params['product_name'] = $productDAO->name;
         $params['product_sku'] = $productDAO->sku;
 
-        if (empty($params['product_option']) && !empty($form->_options
-[$params['product_name'][0]])) {
+        if (empty($params['product_option']) && !empty($form->_options[$params['product_name'][0]])) {
           $params['product_option'] = $form->_options[$params['product_name'][0]][$params['product_name'][1]];
         }
       }
index ea33e63a00d78c01cf20578a484c387e6f85e75c..affb8d2e2d7458a6277afa424ff168f86810586a 100644 (file)
@@ -1112,7 +1112,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
           $lineItems[$itemId]['tax_rate'] = $financialItemsId[$submittedValues['financial_type_id']];
         }
         else {
-          $lineItems[$itemId]['tax_rate'] = $lineItems[$itemId]['tax_amount'] = "" ;
+          $lineItems[$itemId]['tax_rate'] = $lineItems[$itemId]['tax_amount'] = "";
           $submittedValues['tax_amount'] = 'null';
         }
         if ($lineItems[$itemId]['tax_rate']) {
index 6d68b1384ee8ca0e256de697e4930e8e4b22b52b..14d409a3449fa639d688a2193e5cc838792985f7 100644 (file)
@@ -598,7 +598,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
               // FIX ME: For now let's not expose custom data related to relationship
               $relationshipCustomFields = array();
               //$relationshipCustomFields    = self::getRelationTypeCustomGroupData( $id );
-              //asort( $relationshipCustomFields ) ;
+              //asort($relationshipCustomFields);
 
               $relationshipType = new CRM_Contact_BAO_RelationshipType();
               $relationshipType->id = $id;
index 121a4648e7226056b2312085ca1ccd8aca234205..4786e100a7d643081de88c8d42897fff0d400764 100644 (file)
@@ -508,7 +508,7 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate {
         if (empty($params['attachments'])) {
           $params['attachments'] = array();
         }
-        $params['attachments'][] =  CRM_Utils_Mail::appendPDF('Invoice.pdf', $pdfHtml, $format) ;
+        $params['attachments'][] = CRM_Utils_Mail::appendPDF('Invoice.pdf', $pdfHtml, $format);
       }
       $pdf_filename = '';
       if ($config->doNotAttachPDFReceipt &&
index fdfb27757689fa38c7cfa57f5ec680c8b1fd8e29..5226064accedc63bbf5849943feac49a9b8bd27e 100644 (file)
@@ -148,7 +148,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
         $errorMsg['tax_rate'] = ts('Please enter value for tax rate');
       }
     }
-    if ((CRM_Utils_Array::value('tax_rate', $values) != NULL))  {
+    if ((CRM_Utils_Array::value('tax_rate', $values) != NULL)) {
       if ($values['tax_rate'] < 0 || $values['tax_rate'] >= 100) {
         $errorMsg['tax_rate'] = ts('Tax Rate Should be between 0 - 100');
       }
index 03f9a66f15895602d1427c4db2b1d49904d6c48f..8720a276fa621d2cef23267e5ed4426db4122356 100644 (file)
@@ -217,7 +217,7 @@ WHERE lt.log_conn_id = %1 AND
         // hack: case_type_id column is a varchar with separator. For proper mapping to type labels,
         // we need to make sure separators are trimmed
         if ($diff == 'case_type_id') {
-          foreach (array('original', 'changed') as $var)  {
+          foreach (array('original', 'changed') as $var) {
             if (!empty($$var[$diff])) {
               $holder =& $$var;
               $val = explode(CRM_Case_BAO_Case::VALUE_SEPARATOR, $holder[$diff]);
index a56de4a8beef769162d0d7d6530b9999e798e10f..52db1bc9a0c6a0d2a4ce6f032de65acb822b1d21 100644 (file)
@@ -35,7 +35,6 @@ class CRM_Upgrade_Headless {
    *
    * @param bool $enablePrint
    *
-   * @throws
    * @throws Exception
    * @return array, with keys:
    *   - message: string, HTML-ish blob
index f6cc5ef71494c3d8c330556d2d5d6b2fb51c9289..c56e650680a5327f0860b1b70cd1aaa1172bb412 100644 (file)
@@ -65,7 +65,10 @@ class CRM_Upgrade_Incremental_php_FourThree {
       $count = CRM_Core_DAO::singleValueQuery($sql, array(), TRUE, FALSE);
 
       if ($count > 0) {
-        $error = ts("There is a data integrity issue with this CiviCRM database. It contains %1 contribution records which are linked to contact records that have been deleted. You will need to correct this manually before you can run the upgrade. Use the following MySQL query to identify the problem records: %2 These records will need to be deleted or linked to an existing contact record.", array(1 => $count, 2 => '<em>SELECT ct.* FROM civicrm_contribution ct LEFT JOIN civicrm_contact c ON ct.contact_id = c.id WHERE c.id IS NULL;</em>'));
+        $error = ts("There is a data integrity issue with this CiviCRM database. It contains %1 contribution records which are linked to contact records that have been deleted. You will need to correct this manually before you can run the upgrade. Use the following MySQL query to identify the problem records: %2 These records will need to be deleted or linked to an existing contact record.", array(
+            1 => $count,
+            2 => '<em>SELECT ct.* FROM civicrm_contribution ct LEFT JOIN civicrm_contact c ON ct.contact_id = c.id WHERE c.id IS NULL;</em>',
+          ));
         CRM_Core_Error::fatal($error);
         return FALSE;
       }
@@ -161,12 +164,12 @@ WHERE    entity_value = '' OR entity_value IS NULL
       $reminder = array();
       $list = '';
       while ($dao->fetch()) {
-          $reminder[$dao->id] = $dao->title;
-          $list .= "<li>{$dao->title}</li>";
+        $reminder[$dao->id] = $dao->title;
+        $list .= "<li>{$dao->title}</li>";
       }
       if (!empty($reminder)) {
         $list = "<br /><ul>" . $list . "</ul>";
-        $postUpgradeMessage .=  '<br />'  . ts("Scheduled Reminders must be linked to one or more 'entities' (Events, Event Templates, Activity Types, Membership Types). The following reminders are not configured properly and will not be run. Please review them and update or delete them: %1", array(1 => $list));
+        $postUpgradeMessage .= '<br />' . ts("Scheduled Reminders must be linked to one or more 'entities' (Events, Event Templates, Activity Types, Membership Types). The following reminders are not configured properly and will not be run. Please review them and update or delete them: %1", array(1 => $list));
       }
     }
     if ($rev == '4.3.beta2') {
@@ -227,7 +230,7 @@ WHERE     ceft.entity_id IS NULL;
     }
     if ($rev == '4.3.4') {
       $postUpgradeMessage .= '<br />' . ts('System Administrator Alert: If you are running scheduled jobs using CLI.php, you will need to reconfigure cron tasks to include a password. Scheduled jobs will no longer run if the password is not provided (<a href="%1" target="_blank">learn more</a>).',
-      array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs'));
+          array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs'));
     }
     if ($rev == '4.3.5') {
       $postUpgradeMessage .= '<br />' . ts('Default versions of the following System Workflow Message Templates have been modified to handle new functionality: <ul><li>Events - Registration Confirmation and Receipt (on-line)</li><li>Events - Registration Confirmation and Receipt (off-line)</li></ul> If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages).');
@@ -238,7 +241,7 @@ INNER JOIN civicrm_product cp ON ccp.product_id = cp.id
 WHERE ccp.financial_type_id IS NULL and cp.cost > 0');
       if ($flag) {
         $postUpgradeMessage .= '<br />' . ts('Your database contains one or more premiums which have a cost but are not linked to a financial type. If you are exporting transations to an accounting package, this will result in unbalanced transactions. <a href="%1" target="_blank">You can review steps to correct this situation on the wiki.</a>',
-        array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Fixing+Issues+Caused+by+Missing+Cost+of+Goods+Account+-+4.3+Upgrades'));
+            array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Fixing+Issues+Caused+by+Missing+Cost+of+Goods+Account+-+4.3+Upgrades'));
       }
     }
   }
@@ -379,7 +382,7 @@ ADD COLUMN   premiums_nothankyou_label varchar(255) COLLATE utf8_unicode_ci DEFA
   public function upgrade_4_3_5($rev) {
     // CRM-12156
     $config = CRM_Core_Config::singleton();
-    $dbname  = DB::parseDSN($config->dsn);
+    $dbname = DB::parseDSN($config->dsn);
     $sql = "SELECT DELETE_RULE
 FROM information_schema.REFERENTIAL_CONSTRAINTS
 WHERE CONSTRAINT_NAME = 'FK_civicrm_financial_item_contact_id'
@@ -583,7 +586,7 @@ AND   con.contribution_status_id = {$pendingStatus}
     //create a temp table to hold financial account id related to payment instruments
     $tempTableName1 = CRM_Core_DAO::createTempTableName();
 
-    $sql =  "
+    $sql = "
 CREATE TEMPORARY TABLE {$tempTableName1}
 SELECT     ceft.financial_account_id financial_account_id, cov.value as instrument_id
 FROM       civicrm_entity_financial_account ceft
@@ -851,7 +854,7 @@ ALTER TABLE civicrm_domain ADD contact_id INT( 10 ) UNSIGNED NULL DEFAULT NULL C
 SELECT cd.id, cd.name, ce.email FROM civicrm_domain cd
 LEFT JOIN civicrm_loc_block clb ON clb.id = cd. loc_block_id
 LEFT JOIN civicrm_email ce ON ce.id = clb.email_id ;
-' ;
+';
     $dao = CRM_Core_DAO::executeQuery($query);
     while ($dao->fetch()) {
       $query = "
@@ -892,10 +895,22 @@ WHERE     cc.contact_type = 'Organization' AND cc.organization_name = %1
     $config = CRM_Core_Config::singleton();
     $dbUf = DB::parseDSN($config->dsn);
     $tables = array(
-      'autorenewal_msg_id' => array('tableName' => 'civicrm_membership_type', 'fkey' => 'FK_civicrm_membership_autorenewal_msg_id'),
-      'to_account_id' =>  array('tableName' => 'civicrm_financial_trxn', 'constraintName' => 'civicrm_financial_trxn_ibfk_2'),
-      'from_account_id' => array('tableName' =>  'civicrm_financial_trxn', 'constraintName' => 'civicrm_financial_trxn_ibfk_1'),
-      'contribution_type_id' => array('tableName' => 'civicrm_contribution_recur', 'fkey' => 'FK_civicrm_contribution_recur_contribution_type_id'),
+      'autorenewal_msg_id' => array(
+        'tableName' => 'civicrm_membership_type',
+        'fkey' => 'FK_civicrm_membership_autorenewal_msg_id',
+      ),
+      'to_account_id' => array(
+        'tableName' => 'civicrm_financial_trxn',
+        'constraintName' => 'civicrm_financial_trxn_ibfk_2',
+      ),
+      'from_account_id' => array(
+        'tableName' => 'civicrm_financial_trxn',
+        'constraintName' => 'civicrm_financial_trxn_ibfk_1',
+      ),
+      'contribution_type_id' => array(
+        'tableName' => 'civicrm_contribution_recur',
+        'fkey' => 'FK_civicrm_contribution_recur_contribution_type_id',
+      ),
     );
     $query = "
 SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
@@ -916,7 +931,7 @@ AND TABLE_SCHEMA = %1
       }
       if ($foreignKeyExists || $value['tableName'] == 'civicrm_financial_trxn') {
         if ($value['tableName'] != 'civicrm_contribution_recur' || ($value['tableName'] == 'civicrm_contribution_recur' && $dao->N)) {
-          $constraintName  = $foreignKeyExists ? $fKey : $value['constraintName'];
+          $constraintName = $foreignKeyExists ? $fKey : $value['constraintName'];
           $query = "ALTER TABLE {$value['tableName']} DROP FOREIGN KEY {$constraintName}";
           CRM_Core_DAO::executeQuery($query, $params, TRUE, NULL, FALSE, FALSE);
         }
@@ -1025,9 +1040,9 @@ ORDER BY cft.id ";
     while ($dao->fetch()) {
       if (!array_key_exists($dao->contribution_recur_id, $financialTrxn)) {
         $financialTrxn[$dao->contribution_recur_id] = array(
-           'from_financial_account_id' => $dao->to_financial_account_id,
-           'payment_processor_id' => $dao->payment_processor_id,
-           $dao->contribution_id => 1,
+          'from_financial_account_id' => $dao->to_financial_account_id,
+          'payment_processor_id' => $dao->payment_processor_id,
+          $dao->contribution_id => 1,
         );
         if (!is_null($dao->from_financial_account_id)) {
           $sql = 'UPDATE civicrm_financial_trxn SET from_financial_account_id = NULL WHERE id = %1';
@@ -1037,10 +1052,11 @@ ORDER BY cft.id ";
       }
       elseif (!array_key_exists($dao->contribution_id, $financialTrxn[$dao->contribution_recur_id])) {
         if (($dao->entity_table == 'civicrm_line_item' && $dao->to_financial_account_id == $financialTrxn[$dao->contribution_recur_id]['from_financial_account_id'])
-          || ($dao->entity_table == 'civicrm_financial_trxn' && $dao->from_financial_account_id == $financialTrxn[$dao->contribution_recur_id]['from_financial_account_id'])) {
+          || ($dao->entity_table == 'civicrm_financial_trxn' && $dao->from_financial_account_id == $financialTrxn[$dao->contribution_recur_id]['from_financial_account_id'])
+        ) {
           continue;
         }
-          $subsequentPayments[$dao->contribution_recur_id][$dao->entity_table][] = $dao->financial_trxn_id;
+        $subsequentPayments[$dao->contribution_recur_id][$dao->entity_table][] = $dao->financial_trxn_id;
       }
     }
     foreach ($subsequentPayments as $key => $value) {
@@ -1086,18 +1102,18 @@ ORDER BY cli.id";
     while ($dao->fetch()) {
       if (!array_key_exists($dao->contribution_recur_id, $financialTrxn)) {
         $financialTrxn[$dao->contribution_recur_id] = array(
-           'price_field_id' => $dao->price_field_id,
-           'price_field_value_id' => $dao->price_field_value_id,
-           'label' => strval($dao->label),
-           'financial_account_id' => $dao->financial_account_id,
-           $dao->contribution_id => 1,
+          'price_field_id' => $dao->price_field_id,
+          'price_field_value_id' => $dao->price_field_value_id,
+          'label' => strval($dao->label),
+          'financial_account_id' => $dao->financial_account_id,
+          $dao->contribution_id => 1,
         );
       }
       else {
         if ($dao->price_field_value_id == $financialTrxn[$dao->contribution_recur_id]['price_field_value_id']) {
           continue;
         }
-         $subsequentPayments[$dao->contribution_recur_id][] = $dao->line_item_id;
+        $subsequentPayments[$dao->contribution_recur_id][] = $dao->line_item_id;
       }
     }
     foreach ($subsequentPayments as $key => $value) {
@@ -1112,7 +1128,7 @@ cfi.description = %5,
 cli.financial_type_id = %6
 WHERE cfi.entity_table = 'civicrm_line_item'
 AND cli.entity_table = 'civicrm_contribution' AND cli.id IN (" . implode(',', $value) . ');';
-      $params =  array(
+      $params = array(
         1 => array($financialTrxn[$key]['label'], 'String'),
         2 => array($financialTrxn[$key]['price_field_id'], 'Integer'),
         3 => array($financialTrxn[$key]['price_field_value_id'], 'Integer'),
@@ -1212,7 +1228,7 @@ AND cli.entity_table = 'civicrm_contribution' AND cli.id IN (" . implode(',', $v
   public function task_4_3_x_checkConstraints(CRM_Queue_TaskContext $ctx) {
     CRM_Core_DAO::executeQuery('ALTER TABLE `civicrm_financial_account` CHANGE `contact_id` `contact_id` INT( 10 ) UNSIGNED NULL DEFAULT NULL');
     $config = CRM_Core_Config::singleton();
-    $dbname  = DB::parseDSN($config->dsn);
+    $dbname = DB::parseDSN($config->dsn);
     $constraintArray = array(
       "'FK_civicrm_financial_account_contact_id'",
       "'FK_civicrm_financial_item_contact_id'",
@@ -1234,7 +1250,8 @@ AND CONSTRAINT_SCHEMA = %1";
     $onDelete = CRM_Core_DAO::executeQuery($sql, $params, TRUE, FALSE);
     while ($onDelete->fetch()) {
       if (($onDelete->TABLE_NAME != 'civicrm_financial_item' && $onDelete->DELETE_RULE != 'SET NULL') ||
-        ($onDelete->TABLE_NAME == 'civicrm_financial_item' && $onDelete->DELETE_RULE != 'CASCADE')) {
+        ($onDelete->TABLE_NAME == 'civicrm_financial_item' && $onDelete->DELETE_RULE != 'CASCADE')
+      ) {
         $tableName = 'civicrm_financial_type';
         $onDeleteOption = ' SET NULL ';
         $columnName = 'financial_type_id';
index a499f62e01c11912beabffc02cc5327b462628a4..15ac43d4b40dfed5837aff2a0c24c6c49d5ffb79 100644 (file)
@@ -500,7 +500,7 @@ class CRM_Utils_REST {
     $smarty->assign_by_ref("request", $param);
 
     if  (! array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) ||
-      $_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest" )  {
+      $_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest" ) {
 
       $smarty->assign('tplFile', $tpl);
       $config = CRM_Core_Config::singleton();