Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-20543

RelationType in CiviCase XML file matches to label rather than name

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.7
    • Fix Version/s: None
    • Component/s: CiviCase
    • Labels:
      None
    • Versioning Impact:
      Major (incompatible API change)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding
    • Verified?:
      No

      Description

      This bug can be replicated by relabeling a relationship that is required by a CiviCase XML file and then attempting to create such a case from the web interface. For instance, relabeling the Homeless Services Coordinator to Case Coordinator and adding a new housing_support Case should produce, in the log file, a message like :

      Relationship type Case Coordinator, found in case configuration file, is not present in the database

      Here's a portion of the trace :

      #0 .../CRM/Core/Error.php(378): CRM_Core_Error::backtrace("backTrace", TRUE)
      #1 .../CRM/Case/XMLProcessor/Process.php(223): CRM_Core_Error::fatal("Relationship type Case Coordinator, found in case configuration file, is not ...")
      #2 .../CRM/Case/XMLProcessor/Process.php(109): CRM_Case_XMLProcessor_Process->createRelationships("Case Coordinator", (Array:12))
      #3 .../CRM/Case/XMLProcessor/Process.php(57): CRM_Case_XMLProcessor_Process->process(Object(SimpleXMLElement), (Array:12))
      #4 .../CRM/Case/Form/Activity/OpenCase.php(347): CRM_Case_XMLProcessor_Process->run("housing_support", (Array:12))
      #5 .../CRM/Case/Form/Case.php(404): CRM_Case_Form_Activity_OpenCase::endPostProcess(Object(CRM_Case_Form_Case), (Array:24))
      #6 .../CRM/Core/Form.php(447): CRM_Case_Form_Case->postProcess()
      

      It would appear that the source of the problem is the allRelationshipTypes() method from the CRM_Case_XMLProcessor class, on line 114:

      $relationshipInfo = CRM_Core_PseudoConstant::relationshipType('label', TRUE);

      Which should be replaced by:

      $relationshipInfo = CRM_Core_PseudoConstant::relationshipType('name', TRUE);

       Also, on line 59:

      - const REL_TYPE_CNAME = 'label_b_a';
      + const REL_TYPE_CNAME = 'name_b_a';

      I have joined a quick patch, but haven't submitted a PR, and I haven't checked for regressions.

      I have marked this issue Minor because it can be avoided by specifying the relationship label in the CiviCase file or by not renaming relationships, but this is really bad practice since bypassing this bug would create incompatibilities once it is fixed. The best workaround might be to create a new relationship altogether, but IMO that's still at least a major annoyance.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              urlisse Stéphane Lussier
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: