/** * Create a lead and convert it to an existing Account and Contact */ public function testConvertLinkingExistingContact() { // Create records $lead = SugarTestLeadUtilities::createLead(); $account = SugarTestAccountUtilities::createAccount(); $contact = SugarTestContactUtilities::createContact(); // ConvertLead to an existing Contact and Account $_REQUEST = array('module' => 'Leads', 'record' => $lead->id, 'isDuplicate' => 'false', 'action' => 'ConvertLead', 'convert_create_Contacts' => 'false', 'report_to_name' => $contact->name, 'reports_to_id' => $contact->id, 'convert_create_Accounts' => 'false', 'account_name' => $account->name, 'account_id' => $account->id, 'handle' => 'save'); // Call display to trigger conversion $vc = new ViewConvertLead(); $vc->display(); // Refresh Lead $leadId = $lead->id; $lead = new Lead(); $lead->retrieve($leadId); // Refresh Contact $contactId = $contact->id; $contact = new Contact(); $contact->retrieve($contactId); // Check if contact it's linked properly $this->assertEquals($contact->id, $lead->contact_id, 'Contact not linked with Lead successfully.'); // Check if account is linked with lead properly $this->assertEquals($account->id, $lead->account_id, 'Account not linked with Lead successfully.'); // Check if account is linked with contact properly $this->assertEquals($account->id, $contact->account_id, 'Account not linked with Contact successfully.'); // Check Lead Status, should be converted $this->assertEquals('Converted', $lead->status, "Lead status should be 'Converted'."); }
public function setUp() { SugarTestHelper::setUp('current_user', array(true, 1)); SugarTestHelper::setUp('app_list_strings'); SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); parent::setUp(); $this->relationships = new DeployedRelationships('Products'); $definition = array('lhs_module' => 'Accounts', 'relationship_type' => 'one-to-many', 'rhs_module' => 'ProjectTask'); $this->relationship = RelationshipFactory::newRelationship($definition); $this->relationships->add($this->relationship); $this->relationships->save(); $this->relationships->build(); SugarTestHelper::setUp('relation', array('Accounts', 'ProjectTask')); $searchDefs = array('layout' => array('advanced_search' => array($this->relationship->getName() . '_name' => array('type' => 'relate', 'link' => true, 'label' => '', 'id' => strtoupper($this->relationship->getJoinKeyLHS()), 'width' => '10%', 'default' => true, 'name' => $this->relationship->getName() . '_name'))), 'templateMeta' => array('maxColumns' => '3', 'maxColumnsBasic' => '4', 'widths' => array('label' => '10', 'field' => '30'))); // Add new field to advanced search layout if (file_exists("custom/modules/ProjectTask/metadata/searchdefs.php")) { $this->_savedSearchDefs = file_get_contents("custom/modules/ProjectTask/metadata/searchdefs.php"); } write_array_to_file("searchdefs['ProjectTask']", $searchDefs, 'custom/modules/ProjectTask/metadata/searchdefs.php'); if (file_exists("modules/ProjectTask/metadata/SearchFields.php")) { $this->_savedSearchFields = file_get_contents("modules/ProjectTask/metadata/SearchFields.php"); } write_array_to_file("searchFields['ProjectTask']", $this->_localSearchFields['ProjectTask'], 'modules/ProjectTask/metadata/SearchFields.php'); // Creates linked test account, project and project task $this->_project = SugarTestProjectUtilities::createProject(); $this->_account = SugarTestAccountUtilities::createAccount(); $projectTaskData = array('project_id' => $this->_project->id, 'parent_task_id' => '', 'project_task_id' => '1', 'percent_complete' => '0', 'name' => 'Test Task 1', 'duration_unit' => 'Days', 'duration' => '1'); $this->_projectTask = SugarTestProjectTaskUtilities::createProjectTask($projectTaskData); $this->_projectTask->{$this->relationship->getName()}->add($this->_account); $this->_projectTask->save(); }
public function setUp() { $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->account = SugarTestAccountUtilities::createAccount(); $this->account->name = "SDizzle Inc"; $this->account->save(); }
/** * Create test user * */ public function setUp() { $this->_soapURL = $GLOBALS['sugar_config']['site_url'] . '/service/v2/soap.php'; SugarTestAccountUtilities::createAccount(); SugarTestAccountUtilities::createAccount(); parent::setUp(); }
/** * @group bug45187 */ public function testActivityModuleLabel() { global $sugar_config; global $app_list_strings; // init $lead = SugarTestLeadUtilities::createLead(); $account = SugarTestAccountUtilities::createAccount(); // simulate module renaming $org_name = $app_list_strings['moduleListSingular']['Contacts']; $app_list_strings['moduleListSingular']['Contacts'] = 'People'; // set the request/post parameters before converting the lead $_REQUEST['module'] = 'Leads'; $_REQUEST['action'] = 'ConvertLead'; $_REQUEST['record'] = $lead->id; unset($_REQUEST['handle']); $_REQUEST['selectedAccount'] = $account->id; $sugar_config['lead_conv_activity_opt'] = 'move'; // call display to trigger conversion $vc = new ViewConvertLead(); $vc->init($lead); $vc->display(); // the activity options dropdown should use the renamed module label $this->expectOutputRegex('/.*People<\\/OPTION>.*/'); // cleanup $app_list_strings['moduleListSingular']['Contacts'] = $org_name; unset($_REQUEST['module']); unset($_REQUEST['action']); unset($_REQUEST['record']); unset($_REQUEST['selectedAccount']); SugarTestAccountUtilities::removeAllCreatedAccounts(); SugarTestLeadUtilities::removeAllCreatedLeads(); }
/** * @ticket 44858 */ public function testGeneratedWhereClauseDoesNotHaveValueOfFieldNotSetInSearchForm() { //test to check that if value of a dropdown field is already set in REQUEST object (from any form such as mass update form instead of search form) //i.e. search is made on empty string, but REQUEST object gets value of that dropdown field from some other form on the same page //then on clicking serach button, value of that field should not be used as filter in where clause $this->markTestIncomplete('This test should actually check that the $whereArray is indeed populated'); return; //array to simulate REQUEST object $requestArray['module'] = 'Accounts'; $requestArray['action'] = 'index'; $requestArray['searchFormTab'] = 'basic_search'; $requestArray['account_type'] = 'Analyst'; //value of a dropdown field set in REQUEST object $requestArray['query'] = 'true'; $requestArray['button'] = 'Search'; $requestArray['globalLinksOpen'] = 'true'; $requestArray['current_user_only_basic'] = 0; $account = SugarTestAccountUtilities::createAccount(); $searchForm = new SearchForm($account, 'Accounts'); require 'modules/Accounts/vardefs.php'; require 'modules/Accounts/metadata/SearchFields.php'; require 'modules/Accounts/metadata/searchdefs.php'; $searchForm->searchFields = $searchFields[$searchForm->module]; $searchForm->searchdefs = $searchdefs[$searchForm->module]; $searchForm->populateFromArray($requestArray, 'basic_search', false); $whereArray = $searchForm->generateSearchWhere(true, $account->module_dir); //echo var_export($whereArray, true); $this->assertEquals(0, count($whereArray)); }
/** * Create test account * */ public function setUp() { $this->_soapURL = $GLOBALS['sugar_config']['site_url'] . '/service/v3_1/soap.php'; $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->acc = SugarTestAccountUtilities::createAccount(); parent::setUp(); }
public function setUp() { $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->contact = SugarTestContactUtilities::createContact(); $this->account = SugarTestAccountUtilities::createAccount(); $override_data = array('parent_type' => 'Accounts', 'parent_id' => $this->account->id); $this->email = SugarTestEmailUtilities::createEmail('', $override_data); }
public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user'); $this->Accounts = SugarTestAccountUtilities::createAccount(); $this->Contacts = SugarTestContactUtilities::createContact(); $this->Leads = SugarTestLeadUtilities::createLead(); }
public function setUp() { SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('current_user', array(true, 1)); $this->account = SugarTestAccountUtilities::createAccount(); $this->account->name = "SDizzle Inc"; $this->account->save(); }
/** * Create account function */ public function createAccount($name, $deleted = 0) { $account = SugarTestAccountUtilities::createAccount(); $account->name = $account->account_name = $name; $account->deleted = $deleted; $account->save(); $GLOBALS['db']->commit(); return $account; }
public function setUp() { require 'include/modules.php'; $GLOBALS['beanList'] = $beanList; $GLOBALS['beanFiles'] = $beanFiles; $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $GLOBALS['current_user']->is_admin = true; $this->account = SugarTestAccountUtilities::createAccount(); }
public function setUp() { global $app_strings, $app_list_strings; $app_strings = return_application_language($GLOBALS['current_language']); $app_list_strings = return_app_list_strings_language($GLOBALS['current_language']); $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->contact = SugarTestContactUtilities::createContact(); $this->account = SugarTestAccountUtilities::createAccount(); $override_data = array('parent_type' => 'Accounts', 'parent_id' => $this->account->id); $this->email = SugarTestEmailUtilities::createEmail('', $override_data); }
public function setUp() { global $beanFiles, $beanList, $current_user; $current_user = SugarTestUserUtilities::createAnonymousUser(); $this->account = SugarTestAccountUtilities::createAccount(); $this->contact = SugarTestContactUtilities::createContact(); $this->account->load_relationship('contacts'); $this->account->contacts->add($this->contact); $this->account2 = SugarTestAccountUtilities::createAccount(); $GLOBALS['db']->commit(); }
public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user'); $this->account = SugarTestAccountUtilities::createAccount(); $this->contact = SugarTestContactUtilities::createContact(); $this->account->load_relationship('contacts'); $this->account->contacts->add($this->contact); $this->account2 = SugarTestAccountUtilities::createAccount(); $GLOBALS['db']->commit(); }
public function testGetNamePlusEmailAddressesForComposeMultipleIds() { $account1 = SugarTestAccountUtilities::createAccount(); $account2 = SugarTestAccountUtilities::createAccount(); $account3 = SugarTestAccountUtilities::createAccount(); $email = new Email(); $addressString = $email->getNamePlusEmailAddressesForCompose('Accounts', array($account1->id, $account2->id, $account3->id)); $this->assertContains("{$account1->name} <{$account1->email1}>", $addressString); $this->assertContains("{$account2->name} <{$account2->email1}>", $addressString); $this->assertContains("{$account3->name} <{$account3->email1}>", $addressString); SugarTestAccountUtilities::removeAllCreatedAccounts(); }
public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user'); $this->_soapURL = $GLOBALS['sugar_config']['site_url'] . '/service/v4_1/soap.php'; parent::_setupTestUser(); parent::setUp(); $this->account = SugarTestAccountUtilities::createAccount(); $this->contact = SugarTestContactUtilities::createContact(); $this->account->load_relationship('contacts'); $this->account->contacts->add($this->contact->id); }
public function setUp() { SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('current_user', array(true, 1)); SugarTestHelper::setUp('app_list_strings'); SugarTestHelper::setUp('mod_strings', array('Administration')); SugarTestHelper::setUp('dictionary'); parent::setUp(); $this->createCustom(); $this->acc = SugarTestAccountUtilities::createAccount(); $this->acc2 = SugarTestAccountUtilities::createAccount(); }
public function setUp() { $beanList = array(); $beanFiles = array(); require 'include/modules.php'; $GLOBALS['beanList'] = $beanList; $GLOBALS['beanFiles'] = $beanFiles; $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $GLOBALS['current_user']->status = 'Active'; $GLOBALS['current_user']->is_admin = 1; $GLOBALS['current_user']->save(); $this->field = get_widget('varchar'); $this->field->id = 'Accountstest_custom_c'; $this->field->name = 'test_custom_c'; $this->field->vanme = 'LBL_TEST_CUSTOM_C'; $this->field->comments = NULL; $this->field->help = NULL; $this->field->custom_module = 'Accounts'; $this->field->type = 'varchar'; $this->field->label = 'LBL_TEST_CUSTOM_C'; $this->field->len = 255; $this->field->required = 0; $this->field->default_value = NULL; $this->field->date_modified = '2009-09-14 02:23:23'; $this->field->deleted = 0; $this->field->audited = 0; $this->field->massupdate = 0; $this->field->duplicate_merge = 0; $this->field->reportable = 1; $this->field->importable = 'true'; $this->field->ext1 = NULL; $this->field->ext2 = NULL; $this->field->ext3 = NULL; $this->field->ext4 = NULL; $this->df = new DynamicField('Accounts'); $this->mod = new Account(); $this->df->setup($this->mod); $this->df->addFieldObject($this->field); $this->df->buildCache('Accounts'); VardefManager::clearVardef(); VardefManager::refreshVardefs('Accounts', 'Account'); $this->mod->field_defs = $GLOBALS['dictionary']['Account']['fields']; $this->_contact = SugarTestContactUtilities::createContact(); $this->_account = SugarTestAccountUtilities::createAccount(); $this->_contact->load_relationship('accounts'); $this->_contact->accounts->add($this->_account->id); $this->_account->test_custom_c = 'Custom Field'; $this->_account->save(); $GLOBALS['db']->commit(); // Making sure we commit any changes }
public function setup() { SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('current_user', array(true, 1)); SugarTestHelper::setUp('app_list_strings'); SugarTestHelper::setUp('mod_strings', array('ModuleBuilder')); parent::setUp(); $this->createCustomField(); $this->getSugarWidgetFieldRelate(); $this->account = SugarTestAccountUtilities::createAccount(); $this->contact1 = SugarTestContactUtilities::createContact(); $this->contact2 = SugarTestContactUtilities::createContact(); }
public function setUp() { global $sugar_config; SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user', array(true, 1)); SugarTestHelper::setUp('app_list_strings'); SugarTestHelper::setUp('app_strings'); $sugar_config['disable_count_query'] = true; for ($i = 0; $i < 3; $i++) { SugarTestAccountUtilities::createAccount(); } $this->query = "SELECT accounts.* FROM accounts WHERE 1=1"; }
public function setUp() { global $beanList, $beanFiles; require 'include/modules.php'; $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(true, 1); $GLOBALS['current_user']->setPreference('max_tabs', '7'); // create vardef to add new relation account - cases $this->addNewRelationships(); // add new tabgroup whit cases module unset($GLOBALS['tabStructure']); $this->group_label = 'LBL_GROUPTAB_' . mktime(); $GLOBALS['tabStructure'][$this->group_label] = array('label' => $this->group_label, 'modules' => array('Cases')); $this->account = SugarTestAccountUtilities::createAccount(); }
public function testAuditForRelatedFields() { $test_account_name = 'test account name after'; $account = SugarTestAccountUtilities::createAccount(); $this->obj->field_defs['account_name']['audited'] = 1; $this->obj->name = 'test'; $this->obj->account_id = $account->id; $this->obj->save(); $this->obj->retrieve(); $this->obj->account_name = $test_account_name; $changes = $this->obj->db->getAuditDataChanges($this->obj); $this->assertEquals($changes['account_name']['after'], $test_account_name); SugarTestAccountUtilities::removeAllCreatedAccounts(); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user'); parent::setUp(); $this->contact = SugarTestContactUtilities::createContact(); $this->contact->load_relationship('opportunities'); foreach ($this->account_names as $account_name) { $account = SugarTestAccountUtilities::createAccount(); $account->name = $account_name; $account->save(false); $opportunity = SugarTestOpportunityUtilities::createOpportunity(null, $account); $this->contact->opportunities->add($opportunity); } }
public function setUp() { $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']); global $sugar_config; $max = $sugar_config['history_max_viewed']; $contacts = array(); for ($i = 0; $i < $max + 1; $i++) { $contacts[$i] = SugarTestContactUtilities::createContact(); SugarTestTrackerUtility::insertTrackerEntry($contacts[$i], 'detailview'); } for ($i = 0; $i < $max + 1; $i++) { $account[$i] = SugarTestAccountUtilities::createAccount(); SugarTestTrackerUtility::insertTrackerEntry($account[$i], 'detailview'); } $GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']); }
/** * setUp * Override the setup from SoapTestCase to also create the seed search data for Accounts and Contacts. */ public function setUp() { $this->_soapURL = $GLOBALS['sugar_config']['site_url'] . '/soap.php'; parent::setUp(); $this->_login(); // Logging in just before the SOAP call as this will also commit any pending DB changes $this->contact = SugarTestContactUtilities::createContact(); $this->contact->contacts_users_id = $GLOBALS['current_user']->id; $this->contact->save(); $this->account = SugarTestAccountUtilities::createAccount(); $this->account->email1 = $this->contact->email1; $this->account->save(); $this->lead = SugarTestLeadUtilities::createLead(); $this->lead->email1 = $this->contact->email1; $this->lead->save(); $GLOBALS['db']->commit(); // Making sure these changes are committed to the database }
public function setUp() { $this->_soapURL = $GLOBALS['sugar_config']['site_url'] . '/service/v2/soap.php'; SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user', array(true, 1)); $this->field = get_widget('varchar'); $this->field->id = 'Accountstest_custom_c'; $this->field->name = 'test_custom_c'; $this->field->vanme = 'LBL_TEST_CUSTOM_C'; $this->field->comments = NULL; $this->field->help = NULL; $this->field->custom_module = 'Accounts'; $this->field->type = 'varchar'; $this->field->label = 'LBL_TEST_CUSTOM_C'; $this->field->len = 255; $this->field->required = 0; $this->field->default_value = NULL; $this->field->date_modified = '2009-09-14 02:23:23'; $this->field->deleted = 0; $this->field->audited = 0; $this->field->massupdate = 0; $this->field->duplicate_merge = 0; $this->field->reportable = 1; $this->field->importable = 'true'; $this->field->ext1 = NULL; $this->field->ext2 = NULL; $this->field->ext3 = NULL; $this->field->ext4 = NULL; $this->df = new DynamicField('Accounts'); $this->mod = new Account(); $this->df->setup($this->mod); $this->df->addFieldObject($this->field); $this->df->buildCache('Accounts'); VardefManager::clearVardef(); VardefManager::refreshVardefs('Accounts', 'Account'); $this->mod->field_defs = $GLOBALS['dictionary']['Account']['fields']; $this->_account = SugarTestAccountUtilities::createAccount(); $this->_account->test_custom_c = 'Custom Field'; $this->_account->save(); $GLOBALS['db']->commit(); // Making sure we commit any changes parent::setUp(); }
public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user'); $this->account = SugarTestAccountUtilities::createAccount(); $this->contact = SugarTestContactUtilities::createContact(); $this->email = SugarTestEmailUtilities::createEmail(); $this->opportunity = SugarTestOpportunityUtilities::createOpportunity('', $this->account); $this->contact->account_id = $this->account->id; $this->contact->save(); $this->opportunity->load_relationship('contacts'); $this->opportunity->contacts->add($this->contact); $this->email->parent_id = $this->contact->id; $this->email->parent_type = $this->contact->module_name; $this->email->save(); if (isset($GLOBALS['app'])) { $this->application = $GLOBALS['app']; } $GLOBALS['app'] = new SugarApplication(); $GLOBALS['app']->controller = new SugarController(); }
public function setUp() { SugarTestHelper::setUp("beanFiles"); SugarTestHelper::setUp("beanList"); SugarTestHelper::setUp("app_list_strings"); SugarTestHelper::setUp("app_strings"); SugarTestHelper::setUp("current_user"); $this->account = SugarTestAccountUtilities::createAccount(); $this->account->name = "Boro SugarTest 58055"; $this->account->save(); $this->contact = SugarTestContactUtilities::createContact(); $this->contact->first_name = "Boro"; $this->contact->last_name = "SugarTest 58055"; $this->contact->email1 = "*****@*****.**"; $this->contact->save(); $this->ie = new InboundEmail(); $this->ie->name = $this->ie->casename = "[CASE:58055] Bug58055 Test"; $this->ie->description = "This is a test for Bug58055"; $this->ie->mailbox_type = "createcase"; $this->ie->groupfolder_id = "non-empty"; $this->ie->from_addr = $this->contact->email1; $this->ie->save(); }
public function testGetEntryWhenContactHasMultipleAccountRelationshipsWorks() { $contact = SugarTestContactUtilities::createContact(); $account1 = SugarTestAccountUtilities::createAccount(); $account2 = SugarTestAccountUtilities::createAccount(); $contact->load_relationship('accounts'); $contact->accounts->add($account1->id); $contact->accounts->add($account2->id); $this->_login(); $parameters = array('session' => $this->_sessionId, 'module_name' => 'Contacts', 'query' => "contacts.id = '{$contact->id}'", 'order_by' => '', 'offset' => 0, 'select_fields' => array('id', 'account_id', 'account_name'), 'max_results' => 250, 'deleted' => 0); $result = $this->_soapClient->call('get_entry_list', $parameters); $account_names = array($account1->name, $account2->name); $account_ids = array($account1->id, $account2->id); /* $this->assertEquals($result['entry_list'][0]['name_value_list'][1]['value'],$account1->name); $this->assertEquals($result['entry_list'][0]['name_value_list'][2]['value'],$account1->id); $this->assertEquals($result['entry_list'][1]['name_value_list'][1]['value'],$account2->name); $this->assertEquals($result['entry_list'][1]['name_value_list'][2]['value'],$account2->id); */ $this->assertTrue(in_array($result['entry_list'][0]['name_value_list'][1]['value'], $account_names)); $this->assertTrue(in_array($result['entry_list'][1]['name_value_list'][1]['value'], $account_names)); $this->assertTrue(in_array($result['entry_list'][0]['name_value_list'][2]['value'], $account_ids)); $this->assertTrue(in_array($result['entry_list'][1]['name_value_list'][2]['value'], $account_ids)); }