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

CaseType.create - Stale definition retained in memory

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Core Team Contract
    • Verified?:
      No

      Description

      If you modify the "definition" of a CaseType, the new definition doesn't fully take effect until a new page-request. For example, in this snippet, the timeline entry does not appear on the newly created case.

       

      addToTimeline('housing_support', array('name' => 'Case Task', 'reference_activity' => 'Open Case', 'reference_offset' => '9', 'reference_select' => 'newest'));

      civicrm_api3('Case', 'create', array(...'housing_support'...));

       

      function addToTimeline($caseType, $timelineEntry) {
        $caseType = civicrm_api3('CaseType', 'getsingle', array('name' => $caseType));

        foreach ($caseType['definition']['activitySets'] as &$actSet) {
          if ($actSet['name'] === 'standard_timeline') {
            $actSet['activityTypes'][] = $timelineEntry;
            }
          }

        civicrm_api3('CaseType', 'create', array(
          'id' => $caseType['id'],
          'definition' => $caseType['definition'],
        ));
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              timotten Tim Otten
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: