From 725fd9d9f1954ff607500ea0b7cb4fe8dc3c908c Mon Sep 17 00:00:00 2001 From: Nileema Date: Wed, 30 Apr 2014 15:18:18 +0530 Subject: [PATCH] HR-338 Support multiple cases when creating activity --- CRM/Case/Form/Activity.php | 357 +++++++++++--------- CRM/Case/Form/Activity/ChangeCaseStatus.php | 33 +- templates/CRM/Case/Form/Activity.tpl | 27 +- 3 files changed, 227 insertions(+), 190 deletions(-) diff --git a/CRM/Case/Form/Activity.php b/CRM/Case/Form/Activity.php index d6b029081f..6b403517f4 100644 --- a/CRM/Case/Form/Activity.php +++ b/CRM/Case/Form/Activity.php @@ -74,7 +74,8 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { * @access public */ function preProcess() { - $this->_caseId = CRM_Utils_Request::retrieve('caseid', 'Positive', $this); + $caseIds = CRM_Utils_Request::retrieve('caseid', 'String', $this); + $this->_caseId = explode(',', $caseIds); $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); if (!$this->_context) { $this->_context = 'caseActivity'; @@ -98,6 +99,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { } if ($this->_caseId) { $this->assign('caseId', $this->_caseId); + $this->assign('countId', count($this->_caseId)); } if (!$this->_caseId || @@ -133,21 +135,26 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { } } - $this->_caseType = CRM_Case_BAO_Case::getCaseType($this->_caseId, 'name'); + foreach ($this->_caseId as $key => $val) { + $this->_caseType[] = CRM_Case_BAO_Case::getCaseType($val, 'name'); + } $this->assign('caseType', $this->_caseType); $xmlProcessorProcess = new CRM_Case_XMLProcessor_Process(); $isMultiClient = $xmlProcessorProcess->getAllowMultipleCaseClients(); $this->assign('multiClient', $isMultiClient); - $clients = CRM_Case_BAO_Case::getContactNames($this->_caseId); + foreach ($this->_caseId as $key => $val) { + $clients[] = CRM_Case_BAO_Case::getContactNames($val); + } $this->assign('client_names', $clients); + $caseIds = implode(',', $this->_caseId); // set context for pushUserContext and for statusBounce if ($this->_context == 'fulltext') { if ($this->_action == CRM_Core_Action::UPDATE || $this->_action == CRM_Core_Action::DELETE) { $url = CRM_Utils_System::url('civicrm/contact/view/case', - "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$this->_caseId}&show=1&context={$this->_context}" + "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseIds}&show=1&context={$this->_context}" ); } else { @@ -156,7 +163,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { } else { $url = CRM_Utils_System::url('civicrm/contact/view/case', - "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$this->_caseId}&show=1" + "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseIds}&show=1" ); } if (!$this->_activityId) { @@ -164,7 +171,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { if (empty($caseTypes) && ($this->_activityTypeName == 'Change Case Type') && !$this->_caseId) { $url = CRM_Utils_System::url('civicrm/contact/view/case', - "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$this->_caseId}&show=1" + "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseIds}&show=1" ); $session = CRM_Core_Session::singleton(); $session->pushUserContext($url); @@ -173,32 +180,34 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { // check if activity count is within the limit $xmlProcessor = new CRM_Case_XMLProcessor_Process(); - $activityInst = $xmlProcessor->getMaxInstance($this->_caseType); + foreach ($this->_caseType as $key => $val) { + $activityInst = $xmlProcessor->getMaxInstance($val); // If not bounce back and also provide activity edit link - if (isset($activityInst[$this->_activityTypeName])) { - $activityCount = CRM_Case_BAO_Case::getCaseActivityCount($this->_caseId, $this->_activityTypeId); - if ($activityCount >= $activityInst[$this->_activityTypeName]) { - if ($activityInst[$this->_activityTypeName] == 1) { - $atArray = array('activity_type_id' => $this->_activityTypeId); - $activities = CRM_Case_BAO_Case::getCaseActivity($this->_caseId, + if (isset($activityInst[$this->_activityTypeName])) { + $activityCount = CRM_Case_BAO_Case::getCaseActivityCount($val, $this->_activityTypeId); + if ($activityCount >= $activityInst[$this->_activityTypeName]) { + if ($activityInst[$this->_activityTypeName] == 1) { + $atArray = array('activity_type_id' => $this->_activityTypeId); + $activities = CRM_Case_BAO_Case::getCaseActivity($val, $atArray, $this->_currentUserId - ); - $activities = array_keys($activities); - $activities = $activities[0]; - $editUrl = CRM_Utils_System::url('civicrm/case/activity', - "reset=1&cid={$this->_currentlyViewedContactId}&caseid={$this->_caseId}&action=update&id={$activities}" + ); + $activities = array_keys($activities); + $activities = $activities[0]; + $editUrl = CRM_Utils_System::url('civicrm/case/activity', + "reset=1&cid={$this->_currentlyViewedContactId}&caseid={$val}&action=update&id={$activities}" + ); + } + CRM_Core_Error::statusBounce(ts("You can not add another '%1' activity to this case. %2", + array( + 1 => $this->_activityTypeName, + 2 => "Do you want to edit the existing activity ?" + ) + ), + $url ); } - CRM_Core_Error::statusBounce(ts("You can not add another '%1' activity to this case. %2", - array( - 1 => $this->_activityTypeName, - 2 => "Do you want to edit the existing activity ?" - ) - ), - $url - ); } } } @@ -218,42 +227,42 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { function setDefaultValues() { $this->_defaults = parent::setDefaultValues(); $targetContactValues = array(); - - //get all clients. - $clients = CRM_Case_BAO_Case::getContactNames($this->_caseId); - if (isset($this->_activityId) && empty($_POST)) { - if (!CRM_Utils_Array::crmIsEmptyArray($this->_defaults['target_contact'])) { - $targetContactValues = array_combine(array_unique($this->_defaults['target_contact']), - explode(';', trim($this->_defaults['target_contact_value'])) - ); - - //exclude all clients. - foreach ($clients as $clientId => $vals) { - if (array_key_exists($clientId, $targetContactValues)) { - unset($targetContactValues[$clientId]); + foreach ($this->_caseId as $key => $val) { + //get all clients. + $clients = CRM_Case_BAO_Case::getContactNames($val); + if (isset($this->_activityId) && empty($_POST)) { + if (!CRM_Utils_Array::crmIsEmptyArray($this->_defaults['target_contact'])) { + $targetContactValues = array_combine(array_unique($this->_defaults['target_contact']), + explode(';', trim($this->_defaults['target_contact_value'])) + ); + //exclude all clients. + foreach ($clients as $clientId => $vals) { + if (array_key_exists($clientId, $targetContactValues)) { + unset($targetContactValues[$clientId]); + } } } } - } - $this->assign('targetContactValues', empty($targetContactValues) ? FALSE : $targetContactValues); + $this->assign('targetContactValues', empty($targetContactValues) ? FALSE : $targetContactValues); - //return form for ajax - if ($this->_cdType) { - return $this->_defaults; - } + //return form for ajax + if ($this->_cdType) { + return $this->_defaults; + } - if (isset($this->_encounterMedium)) { - $this->_defaults['medium_id'] = $this->_encounterMedium; - } - elseif (empty($this->_defaults['medium_id'])) { - // set default encounter medium CRM-4816 - $medium = CRM_Core_OptionGroup::values('encounter_medium', FALSE, FALSE, FALSE, 'AND is_default = 1'); - if (count($medium) == 1) { - $this->_defaults['medium_id'] = key($medium); + if (isset($this->_encounterMedium)) { + $this->_defaults['medium_id'] = $this->_encounterMedium; + } + elseif (empty($this->_defaults['medium_id'])) { + // set default encounter medium CRM-4816 + $medium = CRM_Core_OptionGroup::values('encounter_medium', FALSE, FALSE, FALSE, 'AND is_default = 1'); + if (count($medium) == 1) { + $this->_defaults['medium_id'] = key($medium); + } } - } - return $this->_defaults; + return $this->_defaults; + } } public function buildQuickForm() { @@ -262,7 +271,11 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { if ($this->_caseType) { $xmlProcessor = new CRM_Case_XMLProcessor_Process(); - $aTypes = $xmlProcessor->get($this->_caseType, 'ActivityTypes', TRUE); + $aTypes = array(); + foreach ($this->_caseType as $key => $val) { + $activityTypes = $xmlProcessor->get($val, 'ActivityTypes', TRUE); + $aTypes = $aTypes + $activityTypes; + } // remove Open Case activity type since we're inside an existing case $openCaseID = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name'); @@ -301,10 +314,21 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { } $this->add('select', 'medium_id', ts('Medium'), $encounterMediums, TRUE); + $i = 0; + foreach ($this->_caseId as $key => $val) { + $this->_relatedContacts[] = CRM_Case_BAO_Case::getRelatedAndGlobalContacts($val); + $contName = CRM_Case_BAO_Case::getContactNames($val); + foreach ($contName as $nkey => $nval) { + array_push($this->_relatedContacts[$i][0] , $this->_relatedContacts[$i][0]['managerOf']= $nval['display_name']); + } + $i++; + } - $this->_relatedContacts = CRM_Case_BAO_Case::getRelatedAndGlobalContacts($this->_caseId); //add case client in send a copy selector.CRM-4438. - $relatedContacts = CRM_Case_BAO_Case::getContactNames($this->_caseId); + foreach ($this->_caseId as $key => $val) { + $relatedContacts[] = CRM_Case_BAO_Case::getContactNames($val); + } + if (!empty($relatedContacts)) { foreach ($relatedContacts as $relatedContact) { $this->_relatedContacts[] = $relatedContact; @@ -462,7 +486,6 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { $params['assignee_contact_id'] = array(); } - if (isset($this->_activityId)) { // activity which hasn't been modified by a user yet if ($this->_defaults['is_auto'] == 1) { @@ -490,12 +513,14 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { // call begin post process, before the activity is created/updated. $this->beginPostProcess($params); - $params['case_id'] = $this->_caseId; - // activity create/update - $activity = CRM_Activity_BAO_Activity::create($params); - - // call end post process, after the activity has been created/updated. - $this->endPostProcess($params, $activity); + foreach ($this->_caseId as $key => $val) { + $params['case_id'] = $val; + // activity create/update + $activity = CRM_Activity_BAO_Activity::create($params); + $vvalue[] = array('case_id' => $val, 'actId' => $activity->id); + // call end post process, after the activity has been created/updated. + $this->endPostProcess($params, $activity); + } } else { // since the params we need to set are very few, and we don't want rest of the @@ -527,13 +552,13 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { // call begin post process, before the activity is created/updated. $this->beginPostProcess($newActParams); - $newActParams['case_id'] = $this->_caseId; - - $activity = CRM_Activity_BAO_Activity::create($newActParams); - - // call end post process, after the activity has been created/updated. - $this->endPostProcess($newActParams, $activity); - + foreach ($this->_caseId as $key => $val) { + $newActParams['case_id'] = $val; + $activity = CRM_Activity_BAO_Activity::create($newActParams); + $vvalue[] = array('case_id'=> $val, 'actId'=> $activity->id); + // call end post process, after the activity has been created/updated. + $this->endPostProcess($newActParams, $activity); + } // copy files attached to old activity if any, to new one, // as long as users have not selected the 'delete attachment' option. if (empty($newActParams['is_delete_attachment'])) { @@ -546,48 +571,48 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { $params = $newActParams; } - if ($activity->id) { - // add tags if exists - $tagParams = array(); - if (!empty($params['tag'])) { - foreach ($params['tag'] as $tag) { - $tagParams[$tag] = 1; + foreach ($vvalue as $vkey => $vval) { + if ($vval['actId']) { + // add tags if exists + $tagParams = array(); + if (!empty($params['tag'])) { + foreach ($params['tag'] as $tag) { + $tagParams[$tag] = 1; + } } - } - //save static tags - CRM_Core_BAO_EntityTag::create($tagParams, 'civicrm_activity', $activity->id); + //save static tags + CRM_Core_BAO_EntityTag::create($tagParams, 'civicrm_activity', $vval['actId']); - //save free tags - if (isset($params['taglist']) && !empty($params['taglist'])) { - CRM_Core_Form_Tag::postProcess($params['taglist'], $activity->id, 'civicrm_activity', $this); + //save free tags + if (isset($params['taglist']) && !empty($params['taglist'])) { + CRM_Core_Form_Tag::postProcess($params['taglist'], $vval['actId'], 'civicrm_activity', $this); + } } - } - // update existing case record if needed - $caseParams = $params; - $caseParams['id'] = $this->_caseId; + // update existing case record if needed + $caseParams = $params; + $caseParams['id'] = $vval['case_id']; + if (!empty($caseParams['case_type_id'])) { + $caseParams['case_type_id'] = CRM_Core_DAO::VALUE_SEPARATOR . $caseParams['case_type_id'] . CRM_Core_DAO::VALUE_SEPARATOR; + } + if (!empty($caseParams['case_status_id'])) { + $caseParams['status_id'] = $caseParams['case_status_id']; + } - if (!empty($caseParams['case_type_id'])) { - $caseParams['case_type_id'] = CRM_Core_DAO::VALUE_SEPARATOR . $caseParams['case_type_id'] . CRM_Core_DAO::VALUE_SEPARATOR; - } - if (!empty($caseParams['case_status_id'])) { - $caseParams['status_id'] = $caseParams['case_status_id']; + // unset params intended for activities only + unset($caseParams['subject'], $caseParams['details'], + $caseParams['status_id'], $caseParams['custom'] + ); + $case = CRM_Case_BAO_Case::create($caseParams); + // create case activity record + $caseParams = array( + 'activity_id' => $vval['actId'], + 'case_id' => $vval['case_id'], + ); + CRM_Case_BAO_Case::processCaseActivity($caseParams); } - // unset params intended for activities only - unset($caseParams['subject'], $caseParams['details'], - $caseParams['status_id'], $caseParams['custom'] - ); - $case = CRM_Case_BAO_Case::create($caseParams); - - // create case activity record - $caseParams = array( - 'activity_id' => $activity->id, - 'case_id' => $this->_caseId, - ); - CRM_Case_BAO_Case::processCaseActivity($caseParams); - // Insert civicrm_log record for the activity (e.g. store the // created / edited by contact id and date for the activity) // Note - civicrm_log is already created by CRM_Activity_BAO_Activity::create() @@ -608,85 +633,83 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { $selectedContacts[] = 'assignee_contact_id'; } - foreach ($selectedContacts as $dnt => $val) { - if (array_key_exists($val, $params) && !CRM_Utils_array::crmIsEmptyArray($params[$val])) { - if ($val == 'contact_check') { - $mailStatus = ts("A copy of the activity has also been sent to selected contacts(s)."); - } - else { - $this->_relatedContacts = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames(array($activity->id), TRUE, FALSE); - $mailStatus .= ' ' . ts("A copy of the activity has also been sent to assignee contacts(s)."); - } - - //build an associative array with unique email addresses. - foreach ($params[$val] as $key => $value) { + foreach ($vvalue as $vkey => $vval) { + foreach ($selectedContacts as $dnt => $val) { + if (array_key_exists($val, $params) && !CRM_Utils_array::crmIsEmptyArray($params[$val])) { if ($val == 'contact_check') { - $id = $key; + $mailStatus = ts("A copy of the activity has also been sent to selected contacts(s)."); } else { - $id = $value; + $this->_relatedContacts = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames(array($vval['actId']), TRUE, FALSE); + $mailStatus .= ' ' . ts("A copy of the activity has also been sent to assignee contacts(s)."); } - - if (isset($id) && array_key_exists($id, $this->_relatedContacts)) { - //if email already exists in array then append with ', ' another role only otherwise add it to array. - if ($contactDetails = CRM_Utils_Array::value($this->_relatedContacts[$id]['email'], $mailToContacts)) { - $caseRole = CRM_Utils_Array::value('role', $this->_relatedContacts[$id]); - $mailToContacts[$this->_relatedContacts[$id]['email']]['role'] = $contactDetails['role'] . ', ' . $caseRole; + //build an associative array with unique email addresses. + foreach ($params[$val] as $key => $value) { + if ($val == 'contact_check') { + $id = $key; } else { - $mailToContacts[$this->_relatedContacts[$id]['email']] = $this->_relatedContacts[$id]; + $id = $value; + } + + if (isset($id) && array_key_exists($id, $this->_relatedContacts) && isset($this->_relatedContacts[$id]['email'])) { + //if email already exists in array then append with ', ' another role only otherwise add it to array. + if ($contactDetails = CRM_Utils_Array::value($this->_relatedContacts[$id]['email'], $mailToContacts)) { + $caseRole = CRM_Utils_Array::value('role', $this->_relatedContacts[$id]); + $mailToContacts[$this->_relatedContacts[$id]['email']]['role'] = $contactDetails['role'] . ', ' . $caseRole; + } + else { + $mailToContacts[$this->_relatedContacts[$id]['email']] = $this->_relatedContacts[$id]; + } } } } } - } - - if (!CRM_Utils_array::crmIsEmptyArray($mailToContacts)) { - //include attachments while sending a copy of activity. - $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_activity', - $activity->id - ); - $ics = new CRM_Activity_BAO_ICalendar($activity); - $ics->addAttachment($attachments, $mailToContacts); - - $result = CRM_Case_BAO_Case::sendActivityCopy($this->_currentlyViewedContactId, - $activity->id, $mailToContacts, $attachments, $this->_caseId - ); - - $ics->cleanup(); + if (!CRM_Utils_array::crmIsEmptyArray($mailToContacts)) { + //include attachments while sending a copy of activity. + $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_activity', + $vval['actId'] + ); - if (empty($result)) { + $ics = new CRM_Activity_BAO_ICalendar($activity); + $ics->addAttachment($attachments, $mailToContacts); + $result = CRM_Case_BAO_Case::sendActivityCopy($this->_currentlyViewedContactId, + $vval['actId'], $mailToContacts, $attachments, $vval['case_id'] + ); + $ics->cleanup(); + if (empty($result)) { + $mailStatus = ''; + } + } + else { $mailStatus = ''; } - } - else { - $mailStatus = ''; - } - // create follow up activity if needed - $followupStatus = ''; - if (!empty($params['followup_activity_type_id'])) { - $followupActivity = CRM_Activity_BAO_Activity::createFollowupActivity($activity->id, $params); + // create follow up activity if needed + $followupStatus = ''; + if (!empty($params['followup_activity_type_id'])) { + $followupActivity = CRM_Activity_BAO_Activity::createFollowupActivity($vval['actId'], $params); - if ($followupActivity) { - $caseParams = array( - 'activity_id' => $followupActivity->id, - 'case_id' => $this->_caseId, - ); - CRM_Case_BAO_Case::processCaseActivity($caseParams); - $followupStatus = ts("A followup activity has been scheduled."); + if ($followupActivity) { + $caseParams = array( + 'activity_id' => $followupActivity->id, + 'case_id' => $vval['case_id'], + ); + CRM_Case_BAO_Case::processCaseActivity($caseParams); + $followupStatus = ts("A followup activity has been scheduled."); + } } - } - CRM_Core_Session::setStatus('', ts("'%1' activity has been %2. %3 %4", - array( - 1 => $this->_activityTypeName, - 2 => $recordStatus, - 3 => $followupStatus, - 4 => $mailStatus - ) - ), 'info'); + CRM_Core_Session::setStatus('', ts("'%1' activity has been %2. %3 %4", + array( + 1 => $this->_activityTypeName, + 2 => $recordStatus, + 3 => $followupStatus, + 4 => $mailStatus + ) + ), 'info'); + } } } diff --git a/CRM/Case/Form/Activity/ChangeCaseStatus.php b/CRM/Case/Form/Activity/ChangeCaseStatus.php index bea25807a5..5439004700 100644 --- a/CRM/Case/Form/Activity/ChangeCaseStatus.php +++ b/CRM/Case/Form/Activity/ChangeCaseStatus.php @@ -66,13 +66,18 @@ class CRM_Case_Form_Activity_ChangeCaseStatus { $form->removeElement('priority_id'); $form->_caseStatus = CRM_Case_PseudoConstant::caseStatus(); - $form->_oldCaseStatus = $form->_defaultCaseStatus = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $form->_caseId, 'status_id'); - if (!array_key_exists($form->_defaultCaseStatus, $form->_caseStatus)) { - $form->_caseStatus[$form->_defaultCaseStatus] = CRM_Core_OptionGroup::getLabel('case_status', - $form->_defaultCaseStatus, - FALSE - ); + foreach ($form->_caseId as $key => $val) { + $form->_oldCaseStatus[] = $form->_defaultCaseStatus[] = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $val, 'status_id'); + } + + foreach ($form->_defaultCaseStatus as $keydefault => $valdefault) { + if (!array_key_exists($valdefault, $form->_caseStatus)) { + $form->_caseStatus[$valdefault] = CRM_Core_OptionGroup::getLabel('case_status', + $valdefault, + FALSE + ); + } } $element = $form->add('select', 'case_status_id', ts('Case Status'), $form->_caseStatus, TRUE @@ -156,13 +161,15 @@ class CRM_Case_Form_Activity_ChangeCaseStatus { $params['priority_id'] = CRM_Core_OptionGroup::getValue('priority', 'Normal', 'name'); $activity->priority_id = $params['priority_id']; - if ($activity->subject == 'null') { - $activity->subject = ts('Case status changed from %1 to %2', array( - 1 => CRM_Utils_Array::value($form->_oldCaseStatus, $form->_caseStatus), - 2 => CRM_Utils_Array::value($params['case_status_id'], $form->_caseStatus) - ) - ); - $activity->save(); + foreach ($form->_oldCaseStatus as $statuskey => $statusval ) { + if ($activity->subject == 'null') { + $activity->subject = ts('Case status changed from %1 to %2', array( + 1 => CRM_Utils_Array::value($statusval, $form->_caseStatus), + 2 => CRM_Utils_Array::value($params['case_status_id'], $form->_caseStatus) + ) + ); + $activity->save(); + } } // FIXME: does this do anything ? diff --git a/templates/CRM/Case/Form/Activity.tpl b/templates/CRM/Case/Form/Activity.tpl index 7019686c90..824c208fc9 100644 --- a/templates/CRM/Case/Form/Activity.tpl +++ b/templates/CRM/Case/Form/Activity.tpl @@ -81,14 +81,17 @@ {ts}Client{/ts} - + - {foreach from=$client_names item=client name=clients} - {$client.display_name}{if not $smarty.foreach.clients.last};   {/if} + {foreach from=$client_names item=client name=clients key=id} + {foreach from=$client_names.$id item=client1} + {$client1.display_name} + {/foreach} + {if not $smarty.foreach.clients.last};   {/if} {/foreach} - {if $action eq 1 or $action eq 2} + {if $action eq 1 or $action eq 2}
» {ts}With other contact(s){/ts} {/if} @@ -201,14 +204,18 @@ {ts}Case Role{/ts} {ts}Name{/ts} {ts}Email{/ts} + {if $countId gt 1}{ts}Target Contact{/ts}{/if} {foreach from=$searchRows item=row key=id} - - {$form.contact_check[$id].html} - {$row.role} - {$row.display_name} - {$row.email} - + {foreach from=$searchRows.$id item=row1 key=id1} + + {$form.contact_check[$id].html} + {$row1.role} + {$row1.display_name} + {$row1.email} + {if $countId gt 1}{$row1.managerOf}{/if} + + {/foreach} {/foreach} {/strip} -- 2.25.1