Answers.Body: <p>So, I know it's against best practices, but after digging into the code a bit, I've located a (hacky) solution to my problem. When adding a Case Manager via a case view, CRM_Contact_BAO_Relationship::legacyCreateMultiple is executed.</p>
  
  <p>At line 194 there's a check for duplicate relationships. If I comment out the "<em>continue</em>" at line 203 within the dupe check, I can successfully assign the case manager to the case.</p>
  
  <p>I would much rather not have to do a core edit, so I await a better solution.</p>
  
  <p>Edit: I had run into a problem elsewhere that ended up being caused by my hack. I do not recommend implementing my hack as I'm not sure of the implications.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T15:26:54.527Z
Answers.Text: Did you file an issue in Jira for this?
Answers.UserDisplayName: Angela
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T16:13:53.873Z
Answers.Text: This code must not fire if *changing* a contact as a role, but only if filling in a blank.  If a contact is trashed and added, it seems that the problem is encountered.  If a false contact is put in there and *changed* to the "problem contact", the system freely accepts the entry.
Answers.UserDisplayName: Angela
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T16:48:31.973Z
Answers.Text: I can verify that this works for all of the Roles experiencing this problem, but I agree that this is outside of best practices.
Answers.UserDisplayName: Angela
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-07T11:59:39.757Z
Answers.Text: https://github.com/civicrm/civicrm-core/pull/6439 fixes the issue!
Answers.UserDisplayName: jitendra - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-17T19:21:57.087Z
Answers.Text: Jitendra's solution worked for me.
Answers.UserDisplayName: Squishus Tyrannicus
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-29T22:22:42.057Z
Answers.Text: Still facing this issue on CiviCRM 4.6.24 and Drupal 7.53 site. Does it have to do with the configuration?
Answers.UserDisplayName: Sohal Khatwani
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-29T22:34:39.187Z
Answers.Text: If you change the relationship type of case co-ordinator and case manager to all contacts this resolves the error. Not sure if it relates to the exact scenario here but I was also getting the same popup error i.e. The relationship type definition for the case role is not valid for the client and / or staff contact types.
Answers.UserDisplayName: Sohal Khatwani
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-28T11:59:58.390Z
Answers.LastActivityDate: 2015-08-17T19:23:20.797Z
Answers.LastEditDate: 2015-08-17T19:23:20.797Z
Answers.UserDisplayName: Squishus Tyrannicus
Body: <p>Our organization is trying to use CiviCase as a ticketing system. So we have one case type, the "Ticket".</p>
  
  <p>We can have multiple Tickets open for the same client. However, I can't assign the same contact as a "Case Manager" for multiple tickets to the same client.</p>
  
  <p>So let's say client A has 2 open Tickets. On the first Ticket, I assign myself as the Case Manager. That works as expected. However, when I try to assign myself as the Case Manager of the second Ticket for client A, I get an error:</p>
  
  <blockquote>
    <p>The relationship type definition for the case role is not valid for the client and / or staff contact types.</p>
  </blockquote>
  
  <p>If I create 2 cases to the same client, I am automatically assigned as a Case Manager to both of those cases. However, if I remove myself as Case Manager, and try to re-add myself, I get the same error as above.</p>
  
  <p>How can I assign myself (or anybody else) as the Case Manager of multiple cases to the same client.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-27T17:08:55.673Z
Comments.Text: Which version of CiviCRM?
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-27T19:07:56.957Z
Comments.Text: I'm running 4.6.0
Comments.UserDisplayName: Squishus Tyrannicus
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-02T17:44:29.693Z
Comments.Text: We're running up against this after upgrading to 4.6.3. We were able to do it on 4.5 but lost the ability along the way.
Comments.UserDisplayName: pmoz
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-06T15:26:28.210Z
Comments.Text: We are also running up against this, but with *all* Case Roles-- not just the Case Manager.  We have also seen this introduced as a regression-- we upgraded from 4.5.4 to 4.6.4.
Comments.UserDisplayName: Angela
Tags: <civicase><relationships>
Title: How can I make a contact the case manager of several cases with the same client contact?
ThreadText: # How can I make a contact the case manager of several cases with the same client contact?
  
  (Asked by: username_0 on 2015-05-27)
  
  Our organization is trying to use CiviCase as a ticketing system. So we have one case type, the "Ticket".
  
  We can have multiple Tickets open for the same client. However, I can't assign the same contact as a "Case Manager" for multiple tickets to the same client.
  
  So let's say client A has 2 open Tickets. On the first Ticket, I assign myself as the Case Manager. That works as expected. However, when I try to assign myself as the Case Manager of the second Ticket for client A, I get an error:
  
  > The relationship type definition for the case role is not valid for the client and / or staff contact types.
  
  If I create 2 cases to the same client, I am automatically assigned as a Case Manager to both of those cases. However, if I remove myself as Case Manager, and try to re-add myself, I get the same error as above.
  
  How can I assign myself (or anybody else) as the Case Manager of multiple cases to the same client.
  
  **Tags:** civicase, relationships
  
  > **Comments:**
  > **username_1**: Which version of CiviCRM?  
  > **username_0**: I'm running 4.6.0  
  > **username_2**: We're running up against this after upgrading to 4.6.3. We were able to do it on 4.5 but lost the ability along the way.  
  > **username_3**: We are also running up against this, but with *all* Case Roles-- not just the Case Manager.  We have also seen this introduced as a regression-- we upgraded from 4.5.4 to 4.6.4.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-05-28. Score: 2
  
  So, I know it's against best practices, but after digging into the code a bit, I've located a (hacky) solution to my problem. When adding a Case Manager via a case view, CRM\_Contact\_BAO\_Relationship::legacyCreateMultiple is executed.
  
  At line 194 there's a check for duplicate relationships. If I comment out the "*continue*" at line 203 within the dupe check, I can successfully assign the case manager to the case.
  
  I would much rather not have to do a core edit, so I await a better solution.
  
  Edit: I had run into a problem elsewhere that ended up being caused by my hack. I do not recommend implementing my hack as I'm not sure of the implications.
  
  > **Comments:**
  > **username_3**: Did you file an issue in Jira for this?  
  > **username_3**: This code must not fire if *changing* a contact as a role, but only if filling in a blank.  If a contact is trashed and added, it seems that the problem is encountered.  If a false contact is put in there and *changed* to the "problem contact", the system freely accepts the entry.  
  > **username_3**: I can verify that this works for all of the Roles experiencing this problem, but I agree that this is outside of best practices.  
  > **username_4**: https://github.com/civicrm/civicrm-core/pull/6439 fixes the issue!  
  > **username_0**: username_4's solution worked for me.  
  > **username_5**: Still facing this issue on CiviCRM 4.6.24 and Drupal 7.53 site. Does it have to do with the configuration?  
  > **username_5**: If you change the relationship type of case co-ordinator and case manager to all contacts this resolves the error. Not sure if it relates to the exact scenario here but I was also getting the same popup error i.e. The relationship type definition for the case role is not valid for the client and / or staff contact types.  
  
  ---
  
  