Skip to content
Snippets Groups Projects
Commit c69fdfbb authored by Eileen's avatar Eileen
Browse files

Fix Group Organization BAO not to error if the unique pairing up group_id &...

Fix Group Organization BAO not to error if the unique pairing up group_id & organization_id is passed in without the id
parent 35071ccc
Branches
No related tags found
No related merge requests found
......@@ -59,6 +59,9 @@ class CRM_Contact_BAO_GroupOrganization extends CRM_Contact_DAO_GroupOrganizatio
}
$groupOrganization = new CRM_Contact_DAO_GroupOrganization();
$groupOrganization->copyValues($formatedValues);
// we have ensured we have group_id & organization_id so we can do a find knowing that
// this can only find a matching record
$groupOrganization->find(TRUE);
$groupOrganization->save();
return $groupOrganization;
}
......
......@@ -64,4 +64,4 @@ function group_organization_create_expectedresult(){
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/
\ No newline at end of file
*/
......@@ -58,4 +58,4 @@ function group_organization_delete_expectedresult(){
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/
\ No newline at end of file
*/
......@@ -58,4 +58,4 @@ function group_organization_get_expectedresult(){
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/
\ No newline at end of file
*/
......@@ -155,6 +155,17 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase {
$result = $this->callAPIAndDocument('group_organization', 'create', $params, __FUNCTION__, __FILE__);
}
/**
* CRM-13841 - Load Group Org before save
*/
public function testGroupOrganizationCreateTwice() {
$params = array(
'organization_id' => $this->_orgID,
'group_id' => $this->_groupID, );
$result = $this->callAPISuccess('group_organization', 'create', $params);
$result2 = $this->callAPISuccess('group_organization', 'create', $params);
$this->assertEquals($result['values'], $result2['values']);
}
/**
* check with empty params array
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment