X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=sql%2FGenerateData.php;h=dd4554a6accae51a258f95b70cada7c73e891a33;hb=81ebda7b3f14105c999036936cf9fd150579c7b6;hp=f98270e36d3ea0f7fb2db994c577d76fa84e1cba;hpb=f486d2c15665c9b374c89de9255d3e21368cb3a2;p=civicrm-core.git diff --git a/sql/GenerateData.php b/sql/GenerateData.php index f98270e36d..dd4554a6ac 100644 --- a/sql/GenerateData.php +++ b/sql/GenerateData.php @@ -1,7 +1,7 @@ location[$type][$cid])) { @@ -400,6 +407,9 @@ class CRM_GCD { /** * Execute a query unless we are doing a dry run * Note: this wrapper should not be used for SELECT queries + * @param $query + * @param array $params + * @return \CRM_Core_DAO */ private function _query($query, $params = array()) { if (self::ADD_TO_DB) { @@ -409,6 +419,7 @@ class CRM_GCD { /** * Call dao insert method unless we are doing a dry run + * @param $dao */ private function _insert(&$dao) { if (self::ADD_TO_DB) { @@ -422,6 +433,7 @@ class CRM_GCD { /** * Call dao update method unless we are doing a dry run + * @param $dao */ private function _update(&$dao) { if (self::ADD_TO_DB) { @@ -435,6 +447,8 @@ class CRM_GCD { /** * Add core DAO object + * @param $type + * @param $params */ private function _addDAO($type, $params) { $daoName = "CRM_Core_DAO_$type"; @@ -450,6 +464,8 @@ class CRM_GCD { /** * Fetch contact type based on stored mapping + * @param $id + * @return */ private function getContactType($id) { foreach (array('Individual', 'Household', 'Organization') as $type) { @@ -1179,7 +1195,8 @@ class CRM_GCD { } for ($i = 0; $i < self::NUM_ACTIVITY; $i++) { $activityDAO = new CRM_Activity_DAO_Activity(); - $activityTypeID = mt_rand(7, 10); + $activityId = CRM_Core_OptionGroup::values('activity_type', NULL, NULL, NULL, ' AND v.name IN ("Tell A Friend", "Pledge Acknowledgment")'); + $activityTypeID = array_rand($activityId); $activity = CRM_Core_PseudoConstant::activityType(); $activityDAO->activity_type_id = $activityTypeID; $activityDAO->subject = "Subject for $activity[$activityTypeID]"; @@ -1194,21 +1211,13 @@ class CRM_GCD { $activityContactDAO->record_type_id = CRM_Utils_Array::key('Activity Source', $activityContacts); $this->_insert($activityContactDAO); - if (in_array($activityTypeID, array(6, 9))) { + if ($activityTypeID == 9) { $activityContactDAO = new CRM_Activity_DAO_ActivityContact(); $activityContactDAO->activity_id = $activityDAO->id; $activityContactDAO->contact_id = mt_rand(1, 101); $activityContactDAO->record_type_id = CRM_Utils_Array::key('Activity Targets', $activityContacts); $this->_insert($activityContactDAO); } - - if ($activityTypeID == 7) { - $activityContactDAO = new CRM_Activity_DAO_ActivityContact(); - $activityContactDAO->activity_id = $activityDAO->id; - $activityContactDAO->contact_id = mt_rand(1, 101); - $activityContactDAO->record_type_id = CRM_Utils_Array::key('Activity Assignees', $activityContacts); - $this->_insert($activityContactDAO); - } } } } @@ -1691,9 +1700,9 @@ VALUES private function addPCP() { $query = " INSERT INTO `civicrm_pcp` - (contact_id, status_id, title, intro_text, page_text, donate_link_text, page_id, page_type, is_thermometer, is_honor_roll, goal_amount, currency, is_active, pcp_block_id) + (contact_id, status_id, title, intro_text, page_text, donate_link_text, page_id, page_type, is_thermometer, is_honor_roll, goal_amount, currency, is_active, pcp_block_id, is_notify) VALUES - ({$this->Individual[3]}, 2, 'My Personal Civi Fundraiser', 'I''m on a mission to get all my friends and family to help support my favorite open-source civic sector CRM.', '

Friends and family - please help build much needed infrastructure for the civic sector by supporting my personal campaign!

\r\n

You can learn more about CiviCRM here.

\r\n

Then click the Contribute Now button to go to our easy-to-use online contribution form.

', 'Contribute Now', 1, 'contribute', 1, 1, 5000.00, 'USD', 1, 1); + ({$this->Individual[3]}, 2, 'My Personal Civi Fundraiser', 'I''m on a mission to get all my friends and family to help support my favorite open-source civic sector CRM.', '

Friends and family - please help build much needed infrastructure for the civic sector by supporting my personal campaign!

\r\n

You can learn more about CiviCRM here.

\r\n

Then click the Contribute Now button to go to our easy-to-use online contribution form.

', 'Contribute Now', 1, 'contribute', 1, 1, 5000.00, 'USD', 1, 1, 1); "; $this->_query($query); }