fixed generated data
[civicrm-core.git] / sql / GenerateReportData.php
index cfb65c2de6e3e995ddf7e5cf8e34e5da3af19ae9..b7e83ccb0a35da264b75ccb5a2c29a0c7d54a882 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -111,6 +111,10 @@ require_once 'CRM/Contact/DAO/Relationship.php';
 require_once 'CRM/Event/DAO/Participant.php';
 require_once 'CRM/Contribute/DAO/ContributionSoft.php';
 require_once 'CRM/Member/DAO/MembershipPayment.php';
+
+/**
+ * Class CRM_GCD
+ */
 class CRM_GCD {
 
   /*******************************************************
@@ -255,24 +259,43 @@ class CRM_GCD {
     return $string;
   }
 
+  /**
+   * @return string
+   */
   private function _getRandomChar() {
     return chr(mt_rand(65, 90));
   }
 
+  /**
+   * @return int
+   */
   private function getRandomBoolean() {
     return mt_rand(0, 1);
   }
 
+  /**
+   * @param $array1
+   *
+   * @return mixed
+   */
   private function _getRandomElement(&$array1) {
     return $array1[mt_rand(1, count($array1)) - 1];
   }
 
+  /**
+   * @param $array1
+   *
+   * @return int
+   */
   private function _getRandomIndex(&$array1) {
     return mt_rand(1, count($array1));
   }
 
 
   // country state city combo
+  /**
+   * @return array
+   */
   private function _getRandomCSC() {
     $array1 = array();
 
@@ -347,6 +370,9 @@ class CRM_GCD {
 
 
   // insert data into db's
+  /**
+   * @param $dao
+   */
   private function _insert(&$dao) {
     if (self::ADD_TO_DB) {
       if (!$dao->insert()) {
@@ -358,6 +384,9 @@ class CRM_GCD {
   }
 
   // update data into db's
+  /**
+   * @param $dao
+   */
   private function _update($dao) {
     if (self::ADD_TO_DB) {
       if (!$dao->update()) {
@@ -523,6 +552,11 @@ class CRM_GCD {
     }
   }
 
+  /**
+   * @param $id
+   *
+   * @return string
+   */
   public function getContactType($id) {
     if (in_array($id, $this->individual)) {
       return 'Individual';
@@ -613,6 +647,9 @@ class CRM_GCD {
     }
   }
 
+  /**
+   * @return string
+   */
   public function randomName() {
     $prefix      = $this->_getRandomIndex($this->prefix);
     $first_name  = ucfirst($this->_getRandomElement($this->firstName));
@@ -861,6 +898,12 @@ class CRM_GCD {
     }
   }
 
+  /**
+   * @param $locationTypeId
+   * @param $contactId
+   * @param bool $domain
+   * @param bool $isPrimary
+   */
   private function _addLocation($locationTypeId, $contactId, $domain = FALSE, $isPrimary = TRUE) {
     $this->_addAddress($locationTypeId, $contactId, $isPrimary);
 
@@ -882,6 +925,13 @@ class CRM_GCD {
     }
   }
 
+  /**
+   * @param $locationTypeId
+   * @param $contactId
+   * @param bool $isPrimary
+   * @param null $locationBlockID
+   * @param int $offset
+   */
   private function _addAddress($locationTypeId, $contactId, $isPrimary = FALSE, $locationBlockID = NULL, $offset = 1) {
     $addressDAO = new CRM_Core_DAO_Address();
 
@@ -910,11 +960,24 @@ class CRM_GCD {
     $this->_insert($addressDAO);
   }
 
+  /**
+   * @param $sortName
+   *
+   * @return mixed
+   */
   private function _sortNameToEmail($sortName) {
     $email = preg_replace("([^a-zA-Z0-9_-]*)", "", $sortName);
     return $email;
   }
 
+  /**
+   * @param $locationTypeId
+   * @param $contactId
+   * @param $phoneType
+   * @param bool $isPrimary
+   * @param null $locationBlockID
+   * @param int $offset
+   */
   private function _addPhone($locationTypeId, $contactId, $phoneType, $isPrimary = FALSE, $locationBlockID = NULL, $offset = 1) {
     if ($contactId % 3) {
       $phone = new CRM_Core_DAO_Phone();
@@ -927,6 +990,14 @@ class CRM_GCD {
     }
   }
 
+  /**
+   * @param $locationTypeId
+   * @param $contactId
+   * @param $sortName
+   * @param bool $isPrimary
+   * @param null $locationBlockID
+   * @param int $offset
+   */
   private function _addEmail($locationTypeId, $contactId, $sortName, $isPrimary = FALSE, $locationBlockID = NULL, $offset = 1) {
     if ($contactId % 2) {
       $email = new CRM_Core_DAO_Email();
@@ -1116,7 +1187,7 @@ class CRM_GCD {
     $contactDAO->find();
 
     $count = 0;
-    $activityContacts = CRM_Core_PseudoConstant::activityContacts('name');
+    $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
 
     while ($contactDAO->fetch()) {
       if ($count++ > 2) {
@@ -1160,6 +1231,9 @@ class CRM_GCD {
     }
   }
 
+  /**
+   * @return array
+   */
   static function getZipCodeInfo() {
     $stateID = mt_rand(1000, 5132);
     $offset = mt_rand(1, 4132);
@@ -1174,6 +1248,11 @@ class CRM_GCD {
     return array();
   }
 
+  /**
+   * @param $zipCode
+   *
+   * @return array
+   */
   static function getLatLong($zipCode) {
     $query = "http://maps.google.com/maps?q=$zipCode&output=js";
     $userAgent = "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0";
@@ -1233,11 +1312,11 @@ class CRM_GCD {
     $membershipTypeNames = array('Student', 'General');
     $statuses            = array(3, 4);
 
-    $membership = " 
-INSERT INTO civicrm_membership
+    $membership = "
+ INSERT INTO civicrm_membership
         (contact_id, membership_type_id, join_date, start_date, end_date, source, status_id)
-VALUES 
-";
+VALUES
+ ";
     $activity = "
 INSERT INTO civicrm_activity
         (source_contact_id, source_record_id, activity_type_id, subject, activity_date_time, duration, location, phone_id, phone_number, details, priority_id,parent_id, is_test, status_id)
@@ -1297,6 +1376,11 @@ VALUES
     CRM_Core_DAO::executeQuery($activity, CRM_Core_DAO::$_nullArray);
   }
 
+  /**
+   * @param $date
+   *
+   * @return string
+   */
   static function repairDate($date) {
     $dropArray = array('-' => '', ':' => '', ' ' => '');
     return strtr($date, $dropArray);
@@ -1530,8 +1614,8 @@ VALUES
 
   function addPledge() {
     $pledge = "INSERT INTO civicrm_pledge
-        (contact_id, financial_type_id, contribution_page_id, amount, frequency_unit, frequency_interval, frequency_day, installments, start_date, create_date, acknowledge_date, modified_date, cancel_date, end_date, honor_contact_id, honor_type_id, status_id, is_test) 
-        VALUES 
+        (contact_id, financial_type_id, contribution_page_id, amount, frequency_unit, frequency_interval, frequency_day, installments, start_date, create_date, acknowledge_date, modified_date, cancel_date, end_date, honor_contact_id, honor_type_id, status_id, is_test)
+        VALUES
        (71, 1, 1, 500.00, 'month', 1, 1, 1, '2010-07-01 21:19:02', '2010-06-26 00:00:00', NULL, NULL, NULL,'2010-07-01 00:00:00', NULL, NULL, 1, 0),
        (43, 1, 1, 800.00, 'month', 3, 1, 4, '2010-07-01 10:11:09', '2010-06-23 10:11:14', '2010-06-23 10:11:18', NULL, NULL, '2010-04-01 10:11:40', NULL, NULL, 5, 0),
        (32, 1, 1, 600.00, 'month', 1, 1, 3, '2010-06-01 10:12:35', '2010-05-14 10:12:44', '2010-05-14 10:12:52', NULL, NULL, '2010-08-01 10:13:11', NULL, NULL, 5, 0);
@@ -1540,9 +1624,9 @@ VALUES
   }
 
   function addPledgePayment() {
-    $pledgePayment = "INSERT INTO civicrm_pledge_payment 
-        ( pledge_id, contribution_id, scheduled_amount, scheduled_date, reminder_date, reminder_count, status_id) 
-       VALUES 
+    $pledgePayment = "INSERT INTO civicrm_pledge_payment
+        ( pledge_id, contribution_id, scheduled_amount, scheduled_date, reminder_date, reminder_count, status_id)
+       VALUES
          (1, 10, 500.00, '2010-07-01 13:03:45', null, 0, 1),
          (2, 11, 200.00, '2010-07-01 10:59:35', null, 0, 1),
          (2, null, 200.00, '2010-10-01 10:59:35',null, 0, 2),
@@ -1572,7 +1656,7 @@ VALUES
     for ($i = 0; $i < 3; $i++) {
       $contributionsArray = $membershipArray = array();
       $contributionSQL = "
-            SELECT  id 
+            SELECT  id
                 FROM    civicrm_contribution
                 WHERE   contribution_page_id IS NULL AND
                         total_amount = {$amount[$i]} limit 0, 50 ";
@@ -1584,8 +1668,8 @@ VALUES
       }
       $j = $i + 1;
       $membershipSQL = "
-            SELECT  id  
-                FROM  civicrm_membership 
+            SELECT  id
+                FROM  civicrm_membership
                 WHERE civicrm_membership.membership_type_id = {$j} limit 0, 50";
       $membershipDAO = CRM_Core_DAO::executeQuery($membershipSQL, CRM_Core_DAO::$_nullArray);
 
@@ -1603,10 +1687,18 @@ VALUES
   }
 }
 
+/**
+ * @param null $str
+ *
+ * @return bool
+ */
 function user_access($str = NULL) {
   return TRUE;
 }
 
+/**
+ * @return array
+ */
 function module_list() {
   return array();
 }