| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
private $numStrictIndividual = 0;
private $CSC = array(
- // united states
+ // united states
1228 => array(
// california
1004 => array('San Francisco', 'Los Angeles', 'Palo Alto'),
// new york
1031 => array('New York', 'Albany'),
),
- // india
+ // india
1101 => array(
// maharashtra
1113 => array('Mumbai', 'Pune', 'Nasik'),
// karnataka
1114 => array('Bangalore', 'Mangalore', 'Udipi'),
),
- // poland
+ // poland
1172 => array(
// mazowieckie
1115 => array('Warszawa', 'PÅ‚ock'),
* @return string
*/
- // get a randomly generated string
+ /**
+ * Get a randomly generated string.
+ *
+ * @param int $size
+ */
private function _getRandomString($size = 32) {
$string = "";
* Helper function which randomly populates "note" and
* "date_modified" and inserts it.
*
- * @param CRM_DAO_Note DAO object for Note
+ * @param $note
* @access private
*
- * @return none
- *
*/
private function _insertNote($note) {
$note->note = $this->_getRandomElement($this->note);
$this->_insert($note);
}
- /*******************************************************
+ /**
*
* Start of public functions
*
- *******************************************************/
- // constructor
- function __construct() {
-
+ */
+ public function __construct() {
// initialize all the vars
$this->numIndividual = self::INDIVIDUAL_PERCENT * self::NUM_CONTACT / 100;
$this->numHousehold = self::HOUSEHOLD_PERCENT * self::NUM_CONTACT / 100;
$this->activity_type[] = trim($activity_type);
}
-
// module
foreach ($sampleData->modules->module as $module) {
$this->module[] = trim($module);
$config = CRM_Core_Config::singleton();
}
- /*******************************************************
+ /**
*
* this function creates arrays for the following
*
* contact_task uuid
* contact_note uuid
*
- *******************************************************/
+ */
public function initID() {
// may use this function in future if needed to get
$this->householdIndividual = array_combine($this->household, $this->householdIndividual);
}
- /*******************************************************
+ /**
*
* addDomain()
*
* This method adds NUM_DOMAIN domains and then adds NUM_REVISION
* revisions for each domain with the latest revision being the last one..
*
- *******************************************************/
+ */
public function addDomain() {
/* Add a location for domain 1 */
return $this->prefix[$prefix] . " $first_name $middle_name $last_name " . $this->suffix[$suffix];
}
- /*******************************************************
+ /**
*
* addContact()
*
* contact_type 'Individual' 'Household' 'Organization'
* preferred_communication (random 1 to 3)
*
- *******************************************************/
+ */
public function addContact() {
// add contacts
}
}
- /*******************************************************
+ /**
*
* addIndividual()
*
* greeting_type - randomly select from the enum values
* custom_greeting - "custom greeting $contact_uuid'
*
- *******************************************************/
+ */
public function addIndividual() {
$contact = new CRM_Contact_DAO_Contact();
}
}
- /*******************************************************
+ /**
*
* addHousehold()
*
* nick_name 'nick $contact_uuid'
* primary_contact_uuid = $household_individual[$contact_uuid][0];
*
- *******************************************************/
+ */
public function addHousehold() {
$contact = new CRM_Contact_DAO_Contact();
}
}
- /*******************************************************
+ /**
*
* addOrganization()
*
* sic_code 'sic $contact_uuid'
* primary_contact_id - random individual contact uuid
*
- *******************************************************/
+ */
public function addOrganization() {
$contact = new CRM_Contact_DAO_Contact();
}
}
- /*******************************************************
+ /**
*
* addRelationship()
*
*
* it adds the following fields
*
- *******************************************************/
+ */
public function addRelationship() {
$relationship = new CRM_Contact_DAO_Relationship();
}
}
- /*******************************************************
+ /**
*
* addLocation()
*
* This method adds data to the location table
*
- *******************************************************/
+ */
public function addLocation() {
// strict individuals
foreach ($this->strictIndividual as $contactId) {
// some individuals.
$someIndividual = array_diff($this->individual, $this->strictIndividual);
- $someIndividual = array_slice($someIndividual, 0, (int)(75 * ($this->numIndividual - $this->numStrictIndividual) / 100));
+ $someIndividual = array_slice($someIndividual, 0, (int) (75 * ($this->numIndividual - $this->numStrictIndividual) / 100));
foreach ($someIndividual as $contactId) {
$this->_addLocation(self::HOME, $contactId, FALSE, TRUE);
}
}
}
- /*******************************************************
+ /**
*
* addTagEntity()
*
* This method populates the crm_entity_tag table
*
- *******************************************************/
+ */
public function addEntityTag() {
$entity_tag = new CRM_Core_DAO_EntityTag();
}
}
- /*******************************************************
+ /**
*
* addGroup()
*
* This method populates the crm_entity_tag table
*
- *******************************************************/
+ */
public function addGroup() {
// add the 3 groups first
$numGroup = count($this->group);
// membership status
$groupContact->status = $this->_getRandomElement($this->groupMembershipStatus);
-
$subscriptionHistory = new CRM_Contact_DAO_SubscriptionHistory();
$subscriptionHistory->contact_id = $groupContact->contact_id;
CRM_Core_BAO_Cache::deleteGroup('contact fields');
}
- /*******************************************************
+ /**
*
* addNote()
*
* This method populates the crm_note table
*
- *******************************************************/
+ */
public function addNote() {
$note = new CRM_Core_DAO_Note();
}
}
- /*******************************************************
+ /**
*
* addActivity()
*
* This method populates the crm_activity_history table
*
- *******************************************************/
+ */
public function addActivity() {
$contactDAO = new CRM_Contact_DAO_Contact();
$contactDAO->contact_type = 'Individual';
/**
* @return array
*/
- static function getZipCodeInfo() {
+ public static function getZipCodeInfo() {
$stateID = mt_rand(1000, 5132);
$offset = mt_rand(1, 4132);
*
* @return array
*/
- static function getLatLong($zipCode) {
+ public 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";
return array(NULL, NULL);
}
- function addMembershipType() {
+ public function addMembershipType() {
$organizationDAO = new CRM_Contact_DAO_Contact();
$organizationDAO->id = 5;
$organizationDAO->find(TRUE);
CRM_Core_DAO::executeQuery($membershipType, CRM_Core_DAO::$_nullArray);
}
- function addMembership() {
+ public function addMembership() {
$contact = new CRM_Contact_DAO_Contact();
$contact->query("SELECT id FROM civicrm_contact where contact_type = 'Individual'");
while ($contact->fetch()) {
*
* @return string
*/
- static function repairDate($date) {
+ public static function repairDate($date) {
$dropArray = array('-' => '', ':' => '', ' ' => '');
return strtr($date, $dropArray);
}
- function addMembershipLog() {
+ public function addMembershipLog() {
$membership = new CRM_Member_DAO_Membership();
$membership->query("SELECT id FROM civicrm_membership");
while ($membership->fetch()) {
}
}
- function createEvent() {
+ public function createEvent() {
$event = "INSERT INTO civicrm_address ( contact_id, location_type_id, is_primary, is_billing, street_address, street_number, street_number_suffix, street_number_predirectional, street_name, street_type, street_number_postdirectional, street_unit, supplemental_address_1, supplemental_address_2, supplemental_address_3, city, county_id, state_province_id, postal_code_suffix, postal_code, usps_adc, country_id, geo_code_1, geo_code_2, timezone)
VALUES
( NULL, 1, 1, 1, 'S 14S El Camino Way E', 14, 'S', NULL, 'El Camino', 'Way', NULL, NULL, NULL, NULL, NULL, 'Collinsville', NULL, 1006, NULL, '6022', NULL, 1228, 41.8328, -72.9253, NULL),
";
CRM_Core_DAO::executeQuery($optionGroup, CRM_Core_DAO::$_nullArray);
-
$sql = "SELECT max(id) from civicrm_option_group where name = 'civicrm_event.amount.1'";
$page1 = CRM_Core_DAO::singleValueQuery($sql, CRM_Core_DAO::$_nullArray);
$sql = "SELECT max(id) from civicrm_option_group where name = 'civicrm_event.amount.3'";
$page3 = CRM_Core_DAO::singleValueQuery($sql, CRM_Core_DAO::$_nullArray);
-
$optionValue = "INSERT INTO civicrm_option_value (option_group_id, label, value, is_default, weight, is_optgroup, is_reserved, is_active)
VALUES
($page1, 'Single', '50', 0, 1, 0, 0, 1),
CRM_Core_DAO::executeQuery($event, CRM_Core_DAO::$_nullArray);
}
- function addParticipant() {
+ public function addParticipant() {
// add participant
$participant = new CRM_Event_DAO_Participant();
}
}
- function addPCP() {
+ public function addPCP() {
$query = "
INSERT INTO `civicrm_pcp`
(contact_id, status_id, title, intro_text, page_text, donate_link_text, contribution_page_id, is_thermometer, is_honor_roll, goal_amount, referer, is_active)
CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
}
- function addContribution() {
+ public function addContribution() {
// add contributions
$contribution = new CRM_Contribute_DAO_Contribution();
for ($id = 1; $id <= self::NUM_CONTRIBUTION; $id++) {
$contribution->contact_id = mt_rand(1, self::NUM_CONTACT);
- $contribution->financial_type_id = mt_rand(1, 4);
+ $contribution->financial_type_id = mt_rand(1, 4);
$contribution->contribution_page_id = mt_rand(1, 3);
$contribution->payment_instrument_id = mt_rand(1, 5);
$contribution->receive_date = $this->_getRandomDate();
}
}
- function addSoftContribution() {
+ public function addSoftContribution() {
$pcpRollNickNAme = array('Jones Family', 'Annie and the kids', 'Anonymous', 'Adam Family');
$pcpPersonalNote = array('Helping Hands', 'Annie Helps', 'Anonymous', 'Adam Helps');
}
}
- function addPledge() {
+ public 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
CRM_Core_DAO::executeQuery($pledge, CRM_Core_DAO::$_nullArray);
}
- function addPledgePayment() {
+ public function addPledgePayment() {
$pledgePayment = "INSERT INTO civicrm_pledge_payment
( pledge_id, contribution_id, scheduled_amount, scheduled_date, reminder_date, reminder_count, status_id)
VALUES
CRM_Core_DAO::executeQuery($pledgePayment, CRM_Core_DAO::$_nullArray);
}
- function addMembershipPayment() {
+ public function addMembershipPayment() {
$amount = array('50', '100', '1200');
$contribution = new CRM_Contribute_DAO_Contribution();
for ($id = 1; $id <= 200; $id++) {
$contribution->contact_id = mt_rand(1, self::NUM_CONTACT);
- $contribution->financial_type_id = mt_rand(1, 4);
+ $contribution->financial_type_id = mt_rand(1, 4);
$contribution->payment_instrument_id = mt_rand(1, 5);
$contribution->receive_date = $this->_getRandomDate();
$contribution->total_amount = $this->_getRandomElement($amount);
}
}
}
+
}
/**
$obj1->addPledgePayment();
$obj1->addMembershipPayment();
echo ("Ending data generation on " . date("F dS h:i:s A") . "\n");
-