X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FCCase%2FSequenceListener.php;h=1bceea8c8f2e670f869d4c9df8839475fb09d548;hb=e1879d34c98fad404278b1611e4c02bed2332eab;hp=5d40b49628b609fd54d176343c1a69df06b42ca0;hpb=493c757190d33b6818048dae6053d22ef153acc9;p=civicrm-core.git diff --git a/Civi/CCase/SequenceListener.php b/Civi/CCase/SequenceListener.php index 5d40b49628..1bceea8c8f 100644 --- a/Civi/CCase/SequenceListener.php +++ b/Civi/CCase/SequenceListener.php @@ -16,7 +16,7 @@ class SequenceListener implements CaseChangeListener { /** * @param bool $reset * Whether to forcibly rebuild the entire container. - * @return \Symfony\Component\DependencyInjection\TaggedContainerInterface + * @return SequenceListener */ public static function singleton($reset = FALSE) { if ($reset || self::$singleton === NULL) { @@ -36,6 +36,7 @@ class SequenceListener implements CaseChangeListener { * @param \Civi\CCase\Event\CaseChangeEvent $event * * @throws \CiviCRM_API3_Exception + * @return void */ public function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event) { /** @var \Civi\CCase\Analyzer $analyzer */ @@ -64,7 +65,15 @@ class SequenceListener implements CaseChangeListener { } } - // OK, the activity has completed every step in the sequence! + //CRM-17452 - Close the case only if all the activities are complete + $activities = $analyzer->getActivities(); + foreach ($activities as $activity) { + if ($activity['status_id'] != $actStatuses['Completed']) { + return; + } + } + + // OK, the all activities have completed civicrm_api3('Case', 'create', array( 'id' => $analyzer->getCaseId(), 'status_id' => 'Closed',