PageRenderTime 62ms CodeModel.GetById 34ms RepoModel.GetById 1ms app.codeStats 0ms

/install/populateSeedData.php

https://github.com/adityasingh93/SuiteCRM
PHP | 513 lines | 396 code | 38 blank | 79 comment | 46 complexity | e66b7cc152653a02062a1fc015da270c MD5 | raw file
Possible License(s): LGPL-2.1, MPL-2.0-no-copyleft-exception
  1. <?php
  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-2013 SugarCRM Inc.
  6. * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
  7. * Copyright (C) 2011 - 2014 Salesagility Ltd.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it under
  10. * the terms of the GNU Affero General Public License version 3 as published by the
  11. * Free Software Foundation with the addition of the following permission added
  12. * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
  13. * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
  14. * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
  15. *
  16. * This program is distributed in the hope that it will be useful, but WITHOUT
  17. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  18. * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  19. * details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License along with
  22. * this program; if not, see http://www.gnu.org/licenses or write to the Free
  23. * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  24. * 02110-1301 USA.
  25. *
  26. * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
  27. * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
  28. *
  29. * The interactive user interfaces in modified source and object code versions
  30. * of this program must display Appropriate Legal Notices, as required under
  31. * Section 5 of the GNU Affero General Public License version 3.
  32. *
  33. * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
  34. * these Appropriate Legal Notices must retain the display of the "Powered by
  35. * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
  36. * reasonably feasible for technical reasons, the Appropriate Legal Notices must
  37. * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
  38. ********************************************************************************/
  39. // load the correct demo data and main application language file depending upon the installer language selected; if
  40. // it's not found fall back on en_us
  41. if(file_exists("include/language/{$current_language}.lang.php")){
  42. require_once("include/language/{$current_language}.lang.php");
  43. }
  44. else {
  45. require_once("include/language/en_us.lang.php");
  46. }
  47. require_once('install/UserDemoData.php');
  48. require_once('install/TeamDemoData.php');
  49. global $sugar_demodata;
  50. if(file_exists("install/demoData.{$current_language}.php")){
  51. require_once("install/demoData.{$current_language}.php");
  52. }
  53. else {
  54. require_once("install/demoData.en_us.php");
  55. }
  56. $last_name_count = count($sugar_demodata['last_name_array']);
  57. $first_name_count = count($sugar_demodata['first_name_array']);
  58. $company_name_count = count($sugar_demodata['company_name_array']);
  59. $street_address_count = count($sugar_demodata['street_address_array']);
  60. $city_array_count = count($sugar_demodata['city_array']);
  61. global $app_list_strings;
  62. global $sugar_config;
  63. $_REQUEST['useEmailWidget'] = "true";
  64. if(empty($app_list_strings)) {
  65. $app_list_strings = return_app_list_strings_language('en_us');
  66. }
  67. /*
  68. * Seed the random number generator with a fixed constant. This will make all installs of the same code have the same
  69. * seed data. This facilitates cross database testing..
  70. */
  71. mt_srand(93285903);
  72. $db = DBManagerFactory::getInstance();
  73. $timedate = TimeDate::getInstance();
  74. // Set the max time to one hour (helps Windows load the seed data)
  75. ini_set("max_execution_time", "3600");
  76. // ensure we have enough memory
  77. $memory_needed = 256;
  78. $memory_limit = ini_get('memory_limit');
  79. if( $memory_limit != "" && $memory_limit != "-1" ){ // if memory_limit is set
  80. rtrim($memory_limit, 'M');
  81. $memory_limit_int = (int) $memory_limit;
  82. if( $memory_limit_int < $memory_needed ){
  83. ini_set("memory_limit", "$memory_needed" . "M");
  84. }
  85. }
  86. $large_scale_test = empty($sugar_config['large_scale_test']) ?
  87. false : $sugar_config['large_scale_test'];
  88. $seed_user = new User();
  89. $user_demo_data = new UserDemoData($seed_user, $large_scale_test);
  90. $user_demo_data->create_demo_data();
  91. $number_contacts = 200;
  92. $number_companies = 50;
  93. $number_leads = 200;
  94. $large_scale_test = empty($sugar_config['large_scale_test']) ? false : $sugar_config['large_scale_test'];
  95. // If large scale test is set to true, increase the seed data.
  96. if($large_scale_test) {
  97. // increase the cuttoff time to 1 hour
  98. ini_set("max_execution_time", "3600");
  99. $number_contacts = 100000;
  100. $number_companies = 15000;
  101. $number_leads = 100000;
  102. }
  103. $possible_duration_hours_arr = array( 0, 1, 2, 3);
  104. $possible_duration_minutes_arr = array('00' => '00','15' => '15', '30' => '30', '45' => '45');
  105. $account_ids = Array();
  106. $accounts = Array();
  107. $opportunity_ids = Array();
  108. // Determine the assigned user for all demo data. This is the default user if set, or admin
  109. $assigned_user_name = "admin";
  110. if(!empty($sugar_config['default_user_name']) &&
  111. !empty($sugar_config['create_default_user']) &&
  112. $sugar_config['create_default_user'])
  113. {
  114. $assigned_user_name = $sugar_config['default_user_name'];
  115. }
  116. // Look up the user id for the assigned user
  117. $seed_user = new User();
  118. $assigned_user_id = $seed_user->retrieve_user_id($assigned_user_name);
  119. $patterns[] = '/ /';
  120. $patterns[] = '/\./';
  121. $patterns[] = '/&/';
  122. $patterns[] = '/\//';
  123. $replacements[] = '';
  124. $replacements[] = '';
  125. $replacements[] = '';
  126. $replacements[] = '';
  127. ///////////////////////////////////////////////////////////////////////////////
  128. //// ACCOUNTS
  129. for($i = 0; $i < $number_companies; $i++) {
  130. $account_name = $sugar_demodata['company_name_array'][mt_rand(0,$company_name_count-1)];
  131. // Create new accounts.
  132. $account = new Account();
  133. $account->name = $account_name;
  134. $account->phone_office = create_phone_number();
  135. $account->assigned_user_id = $assigned_user_id;
  136. $account->emailAddress->addAddress(createEmailAddress(), true);
  137. $account->emailAddress->addAddress(createEmailAddress());
  138. $account->website = createWebAddress();
  139. $account->billing_address_street = $sugar_demodata['street_address_array'][mt_rand(0,$street_address_count-1)];
  140. $account->billing_address_city = $sugar_demodata['city_array'][mt_rand(0,$city_array_count-1)];
  141. if($i % 3 == 1) {
  142. $account->billing_address_state = "NY";
  143. $assigned_user_id = mt_rand(9,10);
  144. if($assigned_user_id == 9) {
  145. $account->assigned_user_name = "seed_will";
  146. $account->assigned_user_id = $account->assigned_user_name."_id";
  147. } else {
  148. $account->assigned_user_name = "seed_chris";
  149. $account->assigned_user_id = $account->assigned_user_name."_id";
  150. }
  151. $account->assigned_user_id = $account->assigned_user_name."_id";
  152. } else {
  153. $account->billing_address_state = "CA";
  154. $assigned_user_id = mt_rand(6,8);
  155. if($assigned_user_id == 6) {
  156. $account->assigned_user_name = "seed_sarah";
  157. } elseif($assigned_user_id == 7) {
  158. $account->assigned_user_name = "seed_sally";
  159. } else {
  160. $account->assigned_user_name = "seed_max";
  161. }
  162. $account->assigned_user_id = $account->assigned_user_name."_id";
  163. }
  164. $account->billing_address_postalcode = mt_rand(10000, 99999);
  165. $account->billing_address_country = 'USA';
  166. $account->shipping_address_street = $account->billing_address_street;
  167. $account->shipping_address_city = $account->billing_address_city;
  168. $account->shipping_address_state = $account->billing_address_state;
  169. $account->shipping_address_postalcode = $account->billing_address_postalcode;
  170. $account->shipping_address_country = $account->billing_address_country;
  171. $account->industry = array_rand($app_list_strings['industry_dom']);
  172. $account->account_type = "Customer";
  173. $account->save();
  174. $account_ids[] = $account->id;
  175. $accounts[] = $account;
  176. // Create a case for the account
  177. $case = new aCase();
  178. $case->account_id = $account->id;
  179. $case->priority = array_rand($app_list_strings['case_priority_dom']);
  180. $case->status = array_rand($app_list_strings['case_status_dom']);
  181. $case->name = $sugar_demodata['case_seed_names'][mt_rand(0,4)];
  182. $case->assigned_user_id = $account->assigned_user_id;
  183. $case->assigned_user_name = $account->assigned_user_name;
  184. $case->save();
  185. // Create a bug for the account
  186. $bug = new Bug();
  187. $bug->account_id = $account->id;
  188. $bug->priority = array_rand($app_list_strings['bug_priority_dom']);
  189. $bug->status = array_rand($app_list_strings['bug_status_dom']);
  190. $bug->name = $sugar_demodata['bug_seed_names'][mt_rand(0,4)];
  191. $bug->assigned_user_id = $account->assigned_user_id;
  192. $bug->assigned_user_name = $account->assigned_user_name;
  193. $bug->save();
  194. $note = new Note();
  195. $note->parent_type = 'Accounts';
  196. $note->parent_id = $account->id;
  197. $seed_data_index = mt_rand(0,3);
  198. $note->name = $sugar_demodata['note_seed_names_and_Descriptions'][$seed_data_index][0];
  199. $note->description = $sugar_demodata['note_seed_names_and_Descriptions'][$seed_data_index][1];
  200. $note->assigned_user_id = $account->assigned_user_id;
  201. $note->assigned_user_name = $account->assigned_user_name;
  202. $note->save();
  203. $call = new Call();
  204. $call->parent_type = 'Accounts';
  205. $call->parent_id = $account->id;
  206. $call->name = $sugar_demodata['call_seed_data_names'][mt_rand(0,3)];
  207. $call->assigned_user_id = $account->assigned_user_id;
  208. $call->assigned_user_name = $account->assigned_user_name;
  209. $call->direction='Outbound';
  210. $call->date_start = create_date(). ' ' . create_time();
  211. $call->duration_hours='0';
  212. $call->duration_minutes='30';
  213. $call->account_id =$account->id;
  214. $call->status='Planned';
  215. $call->save();
  216. //Set the user to accept the call
  217. $seed_user->id = $call->assigned_user_id;
  218. $call->set_accept_status($seed_user,'accept');
  219. //Create new opportunities
  220. $opp = new Opportunity();
  221. $opp->assigned_user_id = $account->assigned_user_id;
  222. $opp->assigned_user_name = $account->assigned_user_name;
  223. $opp->name = substr($account_name." - 1000 units", 0, 50);
  224. $opp->date_closed = create_date();
  225. $opp->lead_source = array_rand($app_list_strings['lead_source_dom']);
  226. $opp->sales_stage = array_rand($app_list_strings['sales_stage_dom']);
  227. // If the deal is already one, make the date closed occur in the past.
  228. if($opp->sales_stage == "Closed Won" || $opp->sales_stage == "Closed Lost")
  229. {
  230. $opp->date_closed = create_past_date();
  231. }
  232. $opp->opportunity_type = array_rand($app_list_strings['opportunity_type_dom']);
  233. $amount = array("10000", "25000", "50000", "75000");
  234. $key = array_rand($amount);
  235. $opp->amount = $amount[$key];
  236. $probability = array("10", "70", "40", "60");
  237. $key = array_rand($probability);
  238. $opp->probability = $probability[$key];
  239. $opp->save();
  240. $opportunity_ids[] = $opp->id;
  241. // Create a linking table entry to assign an account to the opportunity.
  242. $opp->set_relationship('accounts_opportunities', array('opportunity_id'=>$opp->id ,'account_id'=> $account->id), false);
  243. }
  244. $titles = $sugar_demodata['titles'];
  245. $account_max = count($account_ids) - 1;
  246. $first_name_max = $first_name_count - 1;
  247. $last_name_max = $last_name_count - 1;
  248. $street_address_max = $street_address_count - 1;
  249. $city_array_max = $city_array_count - 1;
  250. $lead_source_max = count($app_list_strings['lead_source_dom']) - 1;
  251. $lead_status_max = count($app_list_strings['lead_status_dom']) - 1;
  252. $title_max = count($titles) - 1;
  253. ///////////////////////////////////////////////////////////////////////////////
  254. //// DEMO CONTACTS
  255. for($i=0; $i<$number_contacts; $i++) {
  256. $contact = new Contact();
  257. $contact->first_name = $sugar_demodata['first_name_array'][mt_rand(0,$first_name_max)];
  258. $contact->last_name = $sugar_demodata['last_name_array'][mt_rand(0,$last_name_max)];
  259. $contact->assigned_user_id = $account->assigned_user_id;
  260. $contact->primary_address_street = $sugar_demodata['street_address_array'][mt_rand(0,$street_address_max)];
  261. $contact->primary_address_city = $sugar_demodata['city_array'][mt_rand(0,$city_array_max)];
  262. $contact->lead_source = array_rand($app_list_strings['lead_source_dom']);
  263. $contact->title = $titles[mt_rand(0,$title_max)];
  264. $contact->emailAddress->addAddress(createEmailAddress(), true, true);
  265. $contact->emailAddress->addAddress(createEmailAddress(), false, false, false, true);
  266. $assignedUser = new User();
  267. $assignedUser->retrieve($contact->assigned_user_id);
  268. $contact->assigned_user_id = $assigned_user_id;
  269. $contact->email1 = createEmailAddress();
  270. $key = array_rand($sugar_demodata['street_address_array']);
  271. $contact->primary_address_street = $sugar_demodata['street_address_array'][$key];
  272. $key = array_rand($sugar_demodata['city_array']);
  273. $contact->primary_address_city = $sugar_demodata['city_array'][$key];
  274. $contact->lead_source = array_rand($app_list_strings['lead_source_dom']);
  275. $contact->title = $titles[array_rand($titles)];
  276. $contact->phone_work = create_phone_number();
  277. $contact->phone_home = create_phone_number();
  278. $contact->phone_mobile = create_phone_number();
  279. $account_number = mt_rand(0,$account_max);
  280. $account_id = $account_ids[$account_number];
  281. // Fill in a bogus address
  282. $contacts_account = $accounts[$account_number];
  283. $contact->primary_address_state = $contacts_account->billing_address_state;
  284. $contact->assigned_user_id = $contacts_account->assigned_user_id;
  285. $contact->assigned_user_name = $contacts_account->assigned_user_name;
  286. $contact->primary_address_postalcode = mt_rand(10000,99999);
  287. $contact->primary_address_country = 'USA';
  288. $contact->save();
  289. // Create a linking table entry to assign an account to the contact.
  290. $contact->set_relationship('accounts_contacts', array('contact_id'=>$contact->id ,'account_id'=> $account_id), false);
  291. // This assumes that there will be one opportunity per company in the seed data.
  292. $opportunity_key = array_rand($opportunity_ids);
  293. $contact->set_relationship('opportunities_contacts', array('contact_id'=>$contact->id ,'opportunity_id'=> $opportunity_ids[$opportunity_key], 'contact_role'=>$app_list_strings['opportunity_relationship_type_default_key']), false);
  294. //Create new tasks
  295. $task = new Task();
  296. $key = array_rand($sugar_demodata['task_seed_data_names']);
  297. $task->name = $sugar_demodata['task_seed_data_names'][$key];
  298. //separate date and time field have been merged into one.
  299. $task->date_due = create_date() . ' ' . create_time();
  300. $task->date_due_flag = 0;
  301. $task->assigned_user_id = $contacts_account->assigned_user_id;
  302. $task->assigned_user_name = $contacts_account->assigned_user_name;
  303. $task->priority = array_rand($app_list_strings['task_priority_dom']);
  304. $task->status = array_rand($app_list_strings['task_status_dom']);
  305. $task->contact_id = $contact->id;
  306. if ($contact->primary_address_city == "San Mateo") {
  307. $task->parent_id = $account_id;
  308. $task->parent_type = 'Accounts';
  309. }
  310. $task->save();
  311. //Create new meetings
  312. $meeting = new Meeting();
  313. $key = array_rand($sugar_demodata['meeting_seed_data_names']);
  314. $meeting->name = $sugar_demodata['meeting_seed_data_names'][$key];
  315. $meeting->date_start = create_date(). ' ' . create_time();
  316. //$meeting->time_start = date("H:i",time());
  317. $meeting->duration_hours = array_rand($possible_duration_hours_arr);
  318. $meeting->duration_minutes = array_rand($possible_duration_minutes_arr);
  319. $meeting->assigned_user_id = $assigned_user_id;
  320. $meeting->assigned_user_id = $contacts_account->assigned_user_id;
  321. $meeting->assigned_user_name = $contacts_account->assigned_user_name;
  322. $meeting->description = $sugar_demodata['meeting_seed_data_descriptions'];
  323. $meeting->status = array_rand($app_list_strings['meeting_status_dom']);
  324. $meeting->contact_id = $contact->id;
  325. $meeting->parent_id = $account_id;
  326. $meeting->parent_type = 'Accounts';
  327. // dont update vcal
  328. $meeting->update_vcal = false;
  329. $meeting->save();
  330. // leverage the seed user to set the acceptance status on the meeting.
  331. $seed_user->id = $meeting->assigned_user_id;
  332. $meeting->set_accept_status($seed_user,'accept');
  333. //Create new emails
  334. $email = new Email();
  335. $key = array_rand($sugar_demodata['email_seed_data_subjects']);
  336. $email->name = $sugar_demodata['email_seed_data_subjects'][$key];
  337. $email->date_start = create_date();
  338. $email->time_start = create_time();
  339. $email->duration_hours = array_rand($possible_duration_hours_arr);
  340. $email->duration_minutes = array_rand($possible_duration_minutes_arr);
  341. $email->assigned_user_id = $assigned_user_id;
  342. $email->assigned_user_id = $contacts_account->assigned_user_id;
  343. $email->assigned_user_name = $contacts_account->assigned_user_name;
  344. $email->description = $sugar_demodata['email_seed_data_descriptions'];
  345. $email->status = 'sent';
  346. $email->parent_id = $account_id;
  347. $email->parent_type = 'Accounts';
  348. $email->to_addrs = $contact->emailAddress->getPrimaryAddress($contact);
  349. $email->from_addr = $assignedUser->emailAddress->getPrimaryAddress($assignedUser);
  350. $email->from_addr_name = $email->from_addr;
  351. $email->to_addrs_names = $email->to_addrs;
  352. $email->type = 'out';
  353. $email->save();
  354. $email->load_relationship('contacts');
  355. $email->contacts->add($contact);
  356. $email->load_relationship('accounts');
  357. $email->accounts->add($contacts_account);
  358. }
  359. for($i=0; $i<$number_leads; $i++)
  360. {
  361. $lead = new Lead();
  362. $lead->account_name = $sugar_demodata['company_name_array'][mt_rand(0,$company_name_count-1)];
  363. $lead->first_name = $sugar_demodata['first_name_array'][mt_rand(0,$first_name_max)];
  364. $lead->last_name = $sugar_demodata['last_name_array'][mt_rand(0,$last_name_max)];
  365. $lead->primary_address_street = $sugar_demodata['street_address_array'][mt_rand(0,$street_address_max)];
  366. $lead->primary_address_city = $sugar_demodata['city_array'][mt_rand(0,$city_array_max)];
  367. $lead->lead_source = array_rand($app_list_strings['lead_source_dom']);
  368. $lead->title = $sugar_demodata['titles'][mt_rand(0,$title_max)];
  369. $lead->phone_work = create_phone_number();
  370. $lead->phone_home = create_phone_number();
  371. $lead->phone_mobile = create_phone_number();
  372. $lead->emailAddress->addAddress(createEmailAddress(), true);
  373. // Fill in a bogus address
  374. $lead->primary_address_state = $sugar_demodata['primary_address_state'];
  375. $leads_account = $accounts[$account_number];
  376. $lead->primary_address_state = $leads_account->billing_address_state;
  377. $lead->status = array_rand($app_list_strings['lead_status_dom']);
  378. $lead->lead_source = array_rand($app_list_strings['lead_source_dom']);
  379. if($i % 3 == 1)
  380. {
  381. $lead->billing_address_state = $sugar_demodata['billing_address_state']['east'];
  382. $assigned_user_id = mt_rand(9,10);
  383. if($assigned_user_id == 9)
  384. {
  385. $lead->assigned_user_name = "seed_will";
  386. $lead->assigned_user_id = $lead->assigned_user_name."_id";
  387. }
  388. else
  389. {
  390. $lead->assigned_user_name = "seed_chris";
  391. $lead->assigned_user_id = $lead->assigned_user_name."_id";
  392. }
  393. $lead->assigned_user_id = $lead->assigned_user_name."_id";
  394. }
  395. else
  396. {
  397. $lead->billing_address_state = $sugar_demodata['billing_address_state']['west'];
  398. $assigned_user_id = mt_rand(6,8);
  399. if($assigned_user_id == 6)
  400. {
  401. $lead->assigned_user_name = "seed_sarah";
  402. }
  403. else if($assigned_user_id == 7)
  404. {
  405. $lead->assigned_user_name = "seed_sally";
  406. }
  407. else
  408. {
  409. $lead->assigned_user_name = "seed_max";
  410. }
  411. $lead->assigned_user_id = $lead->assigned_user_name."_id";
  412. }
  413. // If this is a large scale test, switch to the bulk teams 90% of the time.
  414. if ($large_scale_test)
  415. {
  416. if(mt_rand(0,100) < 90) {
  417. $assigned_team = $team_demo_data->get_random_team();
  418. $lead->assigned_user_name = $assigned_team;
  419. } else {
  420. }
  421. }
  422. $lead->primary_address_postalcode = mt_rand(10000,99999);
  423. $lead->primary_address_country = $sugar_demodata['primary_address_country'];
  424. $lead->save();
  425. }
  426. ///
  427. /// SEED DATA FOR EMAIL TEMPLATES
  428. ///
  429. if(!empty($sugar_demodata['emailtemplates_seed_data'])) {
  430. foreach($sugar_demodata['emailtemplates_seed_data'] as $v){
  431. $EmailTemp = new EmailTemplate();
  432. $EmailTemp->name = $v['name'];
  433. $EmailTemp->description = $v['description'];
  434. $EmailTemp->subject = $v['subject'];
  435. $EmailTemp->body = $v['text_body'];
  436. $EmailTemp->body_html = $v['body'];
  437. $EmailTemp->deleted = 0;
  438. $EmailTemp->published = 'off';
  439. $EmailTemp->text_only = 0;
  440. $id =$EmailTemp->save();
  441. }
  442. }
  443. ///
  444. /// SEED DATA FOR PROJECT AND PROJECT TASK
  445. ///
  446. include_once('modules/Project/Project.php');
  447. include_once('modules/ProjectTask/ProjectTask.php');
  448. // Project: Audit Plan
  449. $project = new Project();
  450. $project->name = $sugar_demodata['project_seed_data']['audit']['name'];
  451. $project->description = $sugar_demodata['project_seed_data']['audit']['description'];
  452. $project->assigned_user_id = 1;
  453. $project->estimated_start_date = $sugar_demodata['project_seed_data']['audit']['estimated_start_date'];
  454. $project->estimated_end_date = $sugar_demodata['project_seed_data']['audit']['estimated_end_date'];
  455. $project->status = $sugar_demodata['project_seed_data']['audit']['status'];
  456. $project->priority = $sugar_demodata['project_seed_data']['audit']['priority'];
  457. $audit_plan_id = $project->save();
  458. $project_task_id_counter = 1; // all the project task IDs cannot be 1, so using couter
  459. foreach($sugar_demodata['project_seed_data']['audit']['project_tasks'] as $v){
  460. $project_task = new ProjectTask();
  461. $project_task->assigned_user_id = 1;
  462. $project_task->name = $v['name'];
  463. $project_task->date_start = $v['date_start'];
  464. $project_task->date_finish = $v['date_finish'];
  465. $project_task->project_id = $audit_plan_id;
  466. $project_task->project_task_id = $project_task_id_counter;
  467. $project_task->description = $v['description'];
  468. $project_task->duration = $v['duration'];
  469. $project_task->duration_unit = $v['duration_unit'];
  470. $project_task->percent_complete = $v['percent_complete'];
  471. $communicate_stakeholders_id = $project_task->save();
  472. $project_task_id_counter++;
  473. }
  474. ?>