2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
43 var $_large_scale_test;
46 'jim' => 'seed_jim_id',
47 'sarah' => 'seed_sarah_id',
48 'sally' => 'seed_sally_id',
49 'max' => 'seed_max_id',
50 'will' => 'seed_will_id',
51 'chris' => 'seed_chris_id',
53 * Pending fix of demo data mechanism
54 'jim' => 'jim00000-0000-0000-0000-000000000000',
55 'sarah' => 'sarah000-0000-0000-0000-000000000000',
56 'sally' => 'sally000-0000-0000-0000-000000000000',
57 'max' => 'max00000-0000-0000-0000-000000000000',
58 'will' => 'will0000-0000-0000-0000-000000000000',
59 'chris' => 'chris000-0000-0000-0000-000000000000',
64 * Constructor for creating demo data for teams
66 function TeamDemoData($seed_team, $large_scale_test = false)
68 $this->_team = $seed_team;
69 $this->_large_scale_test = $large_scale_test;
75 function create_demo_data() {
76 global $current_language;
77 global $sugar_demodata;
78 foreach($sugar_demodata['teams'] as $v)
80 if (!$this->_team->retrieve($v['team_id']))
81 $this->_team->create_team($v['name'], $v['description'], $v['team_id']);
84 if($this->_large_scale_test)
86 $team_list = $this->_seed_data_get_team_list();
87 foreach($team_list as $team_name)
89 $this->_quick_create($team_name);
93 $this->add_users_to_team();
96 function add_users_to_team() {
97 // Create the west team memberships
98 $this->_team->retrieve("West");
99 $this->_team->add_user_to_team($this->guids['sarah']);
100 $this->_team->add_user_to_team($this->guids['sally']);
101 $this->_team->add_user_to_team($this->guids["max"]);
103 // Create the east team memberships
104 $this->_team->retrieve("East");
105 $this->_team->add_user_to_team($this->guids["will"]);
106 $this->_team->add_user_to_team($this->guids['chris']);
112 function get_random_team()
114 $team_list = $this->_seed_data_get_team_list();
115 $team_list_size = count($team_list);
116 $random_index = mt_rand(0,$team_list_size-1);
118 return $team_list[$random_index];
124 function get_random_teamset()
126 $team_list = $this->_seed_data_get_teamset_list();
127 $team_list_size = count($team_list);
128 $random_index = mt_rand(0,$team_list_size-1);
130 return $team_list[$random_index];
137 function _seed_data_get_teamset_list()
140 $teamsets[] = array("East", "West");
141 $teamsets[] = array("East", "West", "1");
142 $teamsets[] = array("West", "East");
143 $teamsets[] = array("West", "East", "1");
144 $teamsets[] = array("1", "East");
145 $teamsets[] = array("1", "West");
153 function _seed_data_get_team_list()
173 $teams[] = "feather";
181 function _quick_create($name)
183 if (!$this->_team->retrieve($name))
185 $this->_team->create_team($name, $name, $name);