Update Export.php
authordanbrellis <danbrellis@gmail.com>
Wed, 10 Aug 2016 19:01:02 +0000 (15:01 -0400)
committerGitHub <noreply@github.com>
Wed, 10 Aug 2016 19:01:02 +0000 (15:01 -0400)
Moves the call to strpos() under an "if" statement to make sure the needle in strpos() is not an empty string.

CRM/Export/BAO/Export.php

index 6077d1a83d594f5fcc71f13fb83c964996addd69..a69674b353dcdbecf3b6422faac8ac277e9f039b 100644 (file)
@@ -706,14 +706,14 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
 
     $queryString .= $groupBy;
 
-    // always add contact_a.id to the ORDER clause
-    // so the order is deterministic
-    //CRM-15301
-    if (strpos('contact_a.id', $order) === FALSE) {
-      $order .= ", contact_a.id";
-    }
-
     if ($order) {
+      // always add contact_a.id to the ORDER clause
+      // so the order is deterministic
+      //CRM-15301
+      if (strpos('contact_a.id', $order) === FALSE) {
+        $order .= ", contact_a.id";
+      }
+      
       list($field, $dir) = explode(' ', $order, 2);
       $field = trim($field);
       if (!empty($returnProperties[$field])) {