when deleting activity from case redirect to case

This commit is contained in:
naomi 2022-07-12 09:17:36 +01:00
parent d42d62d300
commit 87219ba009

View File

@ -139,12 +139,9 @@ function _opencase_cases_delete_activity_redirect($form, &$form_state) {
$entity = $form_state->getFormObject()->getEntity(); $entity = $form_state->getFormObject()->getEntity();
// for some reason this fires when deleting an activity type, shouldn't do but.s // for some reason this fires when deleting an activity type, shouldn't do but.s
if ($entity instanceof \Drupal\opencase_entities\Entity\OCActivityType) return; if ($entity instanceof \Drupal\opencase_entities\Entity\OCActivityType) return;
if (!IsEmpty($entity->oc_case)) { $case_id = $entity->oc_case->target_id;
$case_id = $entity->oc_case->target_id; if ($case_id) {
$form_state->setRedirect('entity.oc_case.canonical', ['oc_case' => $case_id]); $form_state->setRedirect('entity.oc_case.canonical', ['oc_case' => $case_id]);
} else {
$target_actor_id = $entity->oc_target->target_id;
$form_state->setRedirect('entity.oc_actor.canonical', ['oc_actor' => $target_actor_id]);
} }
} }
/** /**