Merge remote-tracking branch 'upstream/4.3' into 4.3-master-2013-08-28-20-20-34
authorkurund <kurund@civicrm.org>
Wed, 28 Aug 2013 14:56:49 +0000 (20:26 +0530)
committerkurund <kurund@civicrm.org>
Wed, 28 Aug 2013 14:56:49 +0000 (20:26 +0530)
Conflicts:
sql/civicrm_generated.mysql
tests/phpunit/WebTest/Contact/RelationshipAddTest.php

1  2 
CRM/Contact/BAO/Relationship.php
CRM/Contact/Page/View/Relationship.php
CRM/Contact/Selector.php
CRM/Core/PseudoConstant.php
sql/GenerateData.php
templates/CRM/Contact/Form/Relationship.tpl
tests/phpunit/WebTest/Contact/RelationshipAddTest.php

Simple merge
index c8776ef9f181a65bd4f758590e51aa66320dc9b5,ebe9c15b0710408465d47aca9f5ffe6825ba5626..4d465137a19de9742e491bd740b3f01165516f85
@@@ -918,7 -911,14 +918,6 @@@ SELECT 'civicrm_contact', contact_a.id
  
      $sql = str_replace($replaceSQL, $insertSQL, $sql);
  
 -    // The prevnext_cache does not need to be in order, and the ORDER BY clause
 -    // can break the query if it we're in advanced search and we are using a
 -    // search view that uses fields not in the civicrm_contact table.
 -    // See: 12840.
 -    if(preg_match('/(.*) ORDER BY .*/is',$sql, $matches)) {
 -      $sql = $matches[1];
 -    }
--
      CRM_Core_Error::ignoreException();
      $result = CRM_Core_DAO::executeQuery($sql);
      CRM_Core_Error::setCallback();
Simple merge
Simple merge
index d8f29c6ca896e641447dd8a3b9f151f8adf9aaa2,4c615a88dccd7877a9eb94d55b99ef41f0b323ce..a1b3e1376f4bf808ea4401b8281942b0346f4db4
@@@ -370,4 -370,66 +370,65 @@@ class WebTest_Contact_RelationshipAddTe
      $pageUrl = array('url' => 'contact/view/rel', 'args' => "cid={$contactId[1]}&action=add&reset=1");
      $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl);
    }
 -
 -}
+   
+   function testRelationshipAddCurrentEmployerTest() {
+     $this->webtestLogin();
+     //create a New Individual
+     $firstName = substr(sha1(rand()), 0, 7);
+     $this->webtestAddContact($firstName, "Anderson", "$firstName@anderson.name");
+     // visit relationship tab of the Individual
+     $this->click("css=li#tab_rel a");
+     // wait for add Relationship link
+     $this->waitForElementPresent('link=Add Relationship');
+     $this->click('link=Add Relationship');
+     //choose the created relationship type
+     $this->waitForElementPresent("relationship_type_id");
+     $this->select('relationship_type_id', "label=Employee of");
+     // Because it tends to cause problems, all uses of sleep() must be justified in comments
+     // Sleep should never be used for wait for anything to load from the server
+     // Justification for this instance: wait until new contact dialog select is built
+     sleep(2);
+     // create a new organization
+     $orgName = 'WestsideCoop' . substr(sha1(rand()), 0, 7);
+     $this->webtestNewDialogContact($orgName, "", "info@" . $orgName . ".com", 5);
+     $this->waitForElementPresent("quick-save");
+     //fill in the relationship start date
+     $this->webtestFillDate('start_date', '-2 year');
+     $this->webtestFillDate('end_date', '+1 year');
+     $description = "Current employee test.";
+     $this->type("description", $description);
+     $this->waitForElementPresent("add_current_employee");
+     $this->click("add_current_employee");
+     //save the relationship
+     //$this->click("_qf_Relationship_upload");
+     $this->click("quick-save");
+     $this->waitForElementPresent("current-relationships");
+     //check the status message
+     $this->assertTrue($this->isTextPresent("New relationship created."));
+     $this->waitForElementPresent("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span/a[text()='View']");
+     $this->click("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span/a[text()='View']");
+     $this->waitForPageToLoad($this->getTimeoutMsec());
+     $this->webtestVerifyTabularData(
+       array(
+         'Description' => $description,
+         'Current Employee?' => 'Yes',
+         'Status' => 'Enabled',
+       )
+     );
+     $this->assertTrue($this->isTextPresent("Employee of"),"Employee of relationship type not visible on View Relationship page.");
+   }
 +}