예제 #1
0
 public function tearDown()
 {
     SugarTestHelper::tearDown();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }
예제 #2
0
 /**
  * @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();
 }
예제 #3
0
 public function tearDown()
 {
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestLeadUtilities::removeAllCreatedLeads();
     SugarTestLeadUtilities::removeCreatedLeadsEmailAddresses();
     unset($this->form);
     unset($this->lead1);
 }
예제 #4
0
 public function testBadQuery()
 {
     $lead = SugarTestLeadUtilities::createLead();
     $this->_login();
     $result = $this->_soapClient->call('get_entry_list', array('session' => $this->_sessionId, "module_name" => 'Leads', "query" => "leads.id = '{$lead->id}'", '', 0, array(), array(array('name' => 'email_addresses', 'value' => array('id', 'email_address', 'opt_out', 'primary_address')))));
     $this->assertEquals('primary_address', $result['relationship_list'][0][0]['records'][0][3]['name']);
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }
예제 #5
0
 public function tearDown()
 {
     SugarTestLeadUtilities::removeAllCreatedLeads();
     parent::tearDown();
 }
예제 #6
0
 public function tearDown()
 {
     return;
     $GLOBALS['current_user'] = $this->saved_current_user;
     if ($this->remove_beans) {
         $this->campaign->mark_deleted($this->campaign->id);
         $this->prospectlist->mark_deleted($this->prospectlist->id);
         SugarTestContactUtilities::removeAllCreatedContacts();
         SugarTestLeadUtilities::removeAllCreatedLeads();
     }
     if ($this->clear_database) {
         $sql = 'DELETE FROM email_marketing WHERE campaign_id = \'' . $this->campaign->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM emailman WHERE campaign_id = \'' . $this->campaign->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM campaign_log WHERE campaign_id = \'' . $this->campaign->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM prospect_lists_prospects WHERE prospect_list_id=\'' . $this->prospectlist->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM prospect_lists_prospects WHERE prospect_list_id=\'' . $this->prospectlist2->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM prospect_lists WHERE id = \'' . $this->prospectlist->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM prospect_lists WHERE id = \'' . $this->prospectlist2->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM prospect_list_campaigns WHERE campaign_id = \'' . $this->campaign->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM campaigns WHERE id = \'' . $this->campaign->id . '\'';
         $GLOBALS['db']->query($sql);
     }
 }
예제 #7
0
 public function testConversionAndDoNothing()
 {
     global $sugar_config;
     // init
     $lead = SugarTestLeadUtilities::createLead();
     $account = SugarTestAccountUtilities::createAccount();
     $meeting = SugarTestMeetingUtilities::createMeeting();
     SugarTestMeetingUtilities::addMeetingParent($meeting->id, $lead->id);
     $relation_id = SugarTestMeetingUtilities::addMeetingLeadRelation($meeting->id, $lead->id);
     $_REQUEST['record'] = $lead->id;
     // set the request/post parameters before converting the lead
     $_REQUEST['module'] = 'Leads';
     $_REQUEST['action'] = 'ConvertLead';
     $_REQUEST['record'] = $lead->id;
     $_REQUEST['handle'] = 'save';
     $_REQUEST['selectedAccount'] = $account->id;
     $sugar_config['lead_conv_activity_opt'] = 'none';
     // call display to trigger conversion
     $vc = new ViewConvertLead();
     $vc->display();
     // refresh meeting
     $meeting_id = $meeting->id;
     $meeting = new Meeting();
     $meeting->retrieve($meeting_id);
     // refresh lead
     $lead_id = $lead->id;
     $lead = new Lead();
     $lead->retrieve($lead_id);
     // retrieve the new contact id from the conversion
     $contact_id = $lead->contact_id;
     // 1. Lead's contact_id should not be null
     $this->assertNotNull($contact_id, 'Lead has null contact id after conversion.');
     // 2. Lead status should be 'Converted'
     $this->assertEquals('Converted', $lead->status, "Lead atatus should be 'Converted'.");
     // 3. parent_type of the original meeting should be Leads
     $this->assertEquals('Leads', $meeting->parent_type, 'Meeting parent should be Leads');
     // 4. parent_id of the original meeting should be contact id
     $this->assertEquals($lead_id, $meeting->parent_id, 'Meeting parent id should be lead id.');
     // 5. record should NOT be deleted from meetings_leads table
     $sql = "select id from meetings_leads where meeting_id='{$meeting->id}' and lead_id='{$lead->id}' and deleted=0";
     $result = $GLOBALS['db']->query($sql);
     $row = $GLOBALS['db']->fetchByAssoc($result);
     $this->assertFalse(empty($row), "Meeting-Lead relationship is removed.");
     // 6. record should NOT be added to meetings_contacts table
     $sql = "select meeting_id from meetings_contacts where contact_id='{$contact_id}' and deleted=0";
     $result = $GLOBALS['db']->query($sql);
     $row = $GLOBALS['db']->fetchByAssoc($result);
     $this->assertFalse($row, "Meeting-Contact relationship should not be added.");
     // clean up
     unset($_REQUEST['record']);
     $GLOBALS['db']->query("delete from meetings where parent_id='{$lead->id}' and parent_type= 'Leads'");
     $GLOBALS['db']->query("delete from meetings where parent_id='{$contact_id}' and parent_type= 'Contacts'");
     $GLOBALS['db']->query("delete from contacts where id='{$contact_id}'");
     $GLOBALS['db']->query("delete from meetings_leads where meeting_id='{$meeting->id}' and lead_id= '{$lead_id}'");
     $GLOBALS['db']->query("delete from meetings_contacts where contact_id= '{$contact_id}'");
     SugarTestMeetingUtilities::deleteMeetingLeadRelation($relation_id);
     SugarTestMeetingUtilities::removeMeetingContacts();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }
예제 #8
0
 public function tearDown()
 {
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     unset($GLOBALS['current_user']);
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }
예제 #9
0
 /**
  * @group bug44831
  */
 public function testJSInjection()
 {
     $this->markTestIncomplete('Marked as skipped for now... too problematic');
     return;
     require_once 'include/utils/layout_utils.php';
     $_SERVER['REQUEST_METHOD'] = "POST";
     $lead = SugarTestLeadUtilities::createLead();
     $lead->name = 'LeadName';
     $lead->save();
     $_REQUEST['module'] = 'Leads';
     $_REQUEST['action'] = 'EditView';
     $_REQUEST['record'] = $lead->id;
     require_once 'include/MVC/Controller/ControllerFactory.php';
     require_once 'include/MVC/View/ViewFactory.php';
     $GLOBALS['app']->controller = ControllerFactory::getController($_REQUEST['module']);
     //ob_start();
     $GLOBALS['app']->controller->execute();
     //$tStr = ob_get_clean();
     // First of all, need to be sure that I'm actually dealing with my new custom DetailView Layout
     $this->expectOutputRegex('/.*HiddenPlaceHolder.*/');
     // Then check inclusion of LeadJS1.js
     $this->expectOutputRegex('/.*<script src=\\"custom\\/modules\\/Leads\\/javascript\\/LeadJS1\\.js.*\\"><\\/script>.*/');
     // Then check inclusion of LeadJS2.js
     $this->expectOutputRegex('/.*<script src=\\"custom\\/modules\\/Leads\\/javascript\\/LeadJS2\\.js.*\\"><\\/script>.*/');
     //unset($GLOBALS['app']->controller);
     unset($_REQUEST['module']);
     unset($_REQUEST['action']);
     unset($_REQUEST['record']);
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }
예제 #10
0
 /**
  * @group bug39787
  */
 public function testOpportunityNameValueFilled()
 {
     $lead = SugarTestLeadUtilities::createLead();
     $lead->opportunity_name = 'SBizzle Dollar Store';
     $lead->save();
     $_REQUEST['module'] = 'Leads';
     $_REQUEST['action'] = 'ConvertLead';
     $_REQUEST['record'] = $lead->id;
     // Check that the opportunity name doesn't get populated when it's not in the Leads editview layout
     require_once 'include/MVC/Controller/ControllerFactory.php';
     require_once 'include/MVC/View/ViewFactory.php';
     $GLOBALS['app']->controller = ControllerFactory::getController($_REQUEST['module']);
     ob_start();
     $GLOBALS['app']->controller->execute();
     $output = ob_get_clean();
     $matches_one = array();
     $pattern = '/SBizzle Dollar Store/';
     preg_match($pattern, $output, $matches_one);
     $this->assertTrue(count($matches_one) == 0, "Opportunity name got carried over to the Convert Leads page when it shouldn't have.");
     // Add the opportunity_name to the Leads EditView
     SugarTestStudioUtilities::addFieldToLayout('Leads', 'editview', 'opportunity_name');
     // Check that the opportunity name now DOES get populated now that it's in the Leads editview layout
     ob_start();
     $GLOBALS['app']->controller = ControllerFactory::getController($_REQUEST['module']);
     $GLOBALS['app']->controller->execute();
     $output = ob_get_clean();
     $matches_two = array();
     $pattern = '/SBizzle Dollar Store/';
     preg_match($pattern, $output, $matches_two);
     $this->assertTrue(count($matches_two) > 0, "Opportunity name did not carry over to the Convert Leads page when it should have.");
     SugarTestStudioUtilities::removeAllCreatedFields();
     unset($GLOBALS['app']->controller);
     unset($_REQUEST['module']);
     unset($_REQUEST['action']);
     unset($_REQUEST['record']);
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }