(NFC) (dev/core#878) Simplify copyright header (CRM/*)
[civicrm-core.git] / CRM / Case / Form / CaseView.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
16 */
17
18/**
3819f101 19 * This class generates view mode for CiviCase.
6a488035
TO
20 */
21class CRM_Case_Form_CaseView extends CRM_Core_Form {
c490a46a 22 /**
100fef9d 23 * Check for merge cases.
c490a46a
CW
24 * @var bool
25 */
6a488035
TO
26 private $_mergeCases = FALSE;
27
28 /**
fe482240 29 * Set variables up before form is built.
6a488035
TO
30 */
31 public function preProcess() {
0ee2ad76 32 $this->_showRelatedCases = CRM_Utils_Array::value('relatedCases', $_GET);
6a488035
TO
33
34 $xmlProcessorProcess = new CRM_Case_XMLProcessor_Process();
35 $isMultiClient = $xmlProcessorProcess->getAllowMultipleCaseClients();
36 $this->assign('multiClient', $isMultiClient);
37
38 //pull the related cases.
39 $this->assign('showRelatedCases', FALSE);
40 if ($this->_showRelatedCases) {
41 $relatedCases = $this->get('relatedCases');
42 if (!isset($relatedCases)) {
a3d827a7
CW
43 $cId = CRM_Utils_Request::retrieve('cid', 'Integer');
44 $caseId = CRM_Utils_Request::retrieve('id', 'Integer');
6e19e2ea 45 $relatedCases = CRM_Case_BAO_Case::getRelatedCases($caseId);
6a488035
TO
46 }
47 $this->assign('relatedCases', $relatedCases);
48 $this->assign('showRelatedCases', TRUE);
5ffd5a35 49 CRM_Utils_System::setTitle(ts('Related Cases'));
6a488035
TO
50 return;
51 }
52
6a488035
TO
53 $this->_hasAccessToAllCases = CRM_Core_Permission::check('access all cases and activities');
54 $this->assign('hasAccessToAllCases', $this->_hasAccessToAllCases);
55
0a1a8b63
CW
56 $this->assign('contactID', $this->_contactID = (int) $this->get('cid'));
57 $this->assign('caseID', $this->_caseID = (int) $this->get('id'));
58
59 // Access check.
60 if (!CRM_Case_BAO_Case::accessCase($this->_caseID, FALSE)) {
f28d3b6a 61 CRM_Core_Error::statusBounce(ts('You do not have permission to access this case.'));
0a1a8b63 62 }
6a488035 63
edc80cda 64 $fulltext = CRM_Utils_Request::retrieve('context', 'Alphanumeric');
6a488035
TO
65 if ($fulltext == 'fulltext') {
66 $this->assign('fulltext', $fulltext);
67 }
68
e7e57280 69 $this->assign('contactType', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type'));
0a1a8b63 70 $this->assign('userID', CRM_Core_Session::getLoggedInContactID());
6a488035
TO
71
72 //retrieve details about case
be2fb01f 73 $params = ['id' => $this->_caseID];
6a488035 74
be2fb01f 75 $returnProperties = ['case_type_id', 'subject', 'status_id', 'start_date'];
6a488035
TO
76 CRM_Core_DAO::commonRetrieve('CRM_Case_BAO_Case', $params, $values, $returnProperties);
77
353ffa53 78 $statuses = CRM_Case_PseudoConstant::caseStatus('label', FALSE);
6a488035 79 $caseTypeName = CRM_Case_BAO_Case::getCaseType($this->_caseID, 'name');
353ffa53 80 $caseType = CRM_Case_BAO_Case::getCaseType($this->_caseID);
6a488035 81
be2fb01f 82 $this->_caseDetails = [
6a488035 83 'case_type' => $caseType,
dc047163 84 'case_status' => CRM_Utils_Array::value($values['case_status_id'], $statuses),
6a488035
TO
85 'case_subject' => CRM_Utils_Array::value('subject', $values),
86 'case_start_date' => $values['case_start_date'],
be2fb01f 87 ];
6a488035
TO
88 $this->_caseType = $caseTypeName;
89 $this->assign('caseDetails', $this->_caseDetails);
90
6a488035
TO
91 // add to recently viewed
92
93 $url = CRM_Utils_System::url('civicrm/contact/view/case',
94 "action=view&reset=1&id={$this->_caseID}&cid={$this->_contactID}&context=home"
95 );
96
97 $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactID);
98 $this->assign('displayName', $displayName);
99
b74958a4 100 CRM_Utils_System::setTitle($displayName . ' - ' . $caseType);
6a488035 101
be2fb01f 102 $recentOther = [];
6a488035
TO
103 if (CRM_Core_Permission::checkActionPermission('CiviCase', CRM_Core_Action::DELETE)) {
104 $recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/case',
105 "action=delete&reset=1&id={$this->_caseID}&cid={$this->_contactID}&context=home"
106 );
107 }
108
b74958a4 109 // Add the recently viewed case
6a488035
TO
110 CRM_Utils_Recent::add($displayName . ' - ' . $caseType,
111 $url,
112 $this->_caseID,
113 'Case',
114 $this->_contactID,
115 NULL,
116 $recentOther
117 );
118
6a488035
TO
119 //get the related cases for given case.
120 $relatedCases = $this->get('relatedCases');
121 if (!isset($relatedCases)) {
6e19e2ea 122 $relatedCases = CRM_Case_BAO_Case::getRelatedCases($this->_caseID);
6a488035
TO
123 $relatedCases = empty($relatedCases) ? FALSE : $relatedCases;
124 $this->set('relatedCases', $relatedCases);
125 }
5ffd5a35
CW
126 $this->assign('hasRelatedCases', (bool) $relatedCases);
127 if ($relatedCases) {
be2fb01f 128 $this->assign('relatedCaseLabel', ts('%1 Related Case', [
5d4fcf54
TO
129 'count' => count($relatedCases),
130 'plural' => '%1 Related Cases',
131 ]));
be2fb01f 132 $this->assign('relatedCaseUrl', CRM_Utils_System::url('civicrm/contact/view/case', [
5ffd5a35
CW
133 'id' => $this->_caseID,
134 'cid' => $this->_contactID,
135 'relatedCases' => 1,
136 'action' => 'view',
be2fb01f 137 ]));
5ffd5a35 138 }
6a488035 139
8ffdec17 140 $entitySubType = !empty($values['case_type_id']) ? $values['case_type_id'] : NULL;
6a488035 141 $this->assign('caseTypeID', $entitySubType);
517755e0 142 $groupTree = CRM_Core_BAO_CustomGroup::getTree('Case',
0b330e6d 143 NULL,
6a488035
TO
144 $this->_caseID,
145 NULL,
146 $entitySubType
147 );
e34e6979 148 CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $this->_caseID);
6a488035
TO
149 }
150
151 /**
3819f101 152 * Set default values for the form.
6a488035 153 *
3819f101 154 * @return array;
6a488035 155 */
00be9182 156 public function setDefaultValues() {
be2fb01f 157 $defaults = [];
6a488035
TO
158 return $defaults;
159 }
160
161 /**
fe482240 162 * Build the form object.
6a488035
TO
163 */
164 public function buildQuickForm() {
165 //this call is for show related cases.
166 if ($this->_showRelatedCases) {
167 return;
168 }
169
0004ae05
CW
170 $allowedRelationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType($this->_contactID);
171
5ffd5a35 172 CRM_Core_Resources::singleton()
96ed17aa 173 ->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header')
0004ae05
CW
174 ->addScriptFile('civicrm', 'templates/CRM/Case/Form/CaseView.js', 2, 'html-header')
175 ->addVars('relationshipTypes', CRM_Contact_Form_Relationship::getRelationshipTypeMetadata($allowedRelationshipTypes));
5ffd5a35 176
6a488035 177 $xmlProcessor = new CRM_Case_XMLProcessor_Process();
353ffa53
TO
178 $caseRoles = $xmlProcessor->get($this->_caseType, 'CaseRoles');
179 $reports = $xmlProcessor->get($this->_caseType, 'ActivitySets');
6a488035
TO
180
181 //adding case manager.CRM-4510.
182 $managerRoleId = $xmlProcessor->getCaseManagerRoleId($this->_caseType);
183 if (!empty($managerRoleId)) {
184 $caseRoles[$managerRoleId] = $caseRoles[$managerRoleId] . '<br />' . '(' . ts('Case Manager') . ')';
185 }
186
187 $aTypes = $xmlProcessor->get($this->_caseType, 'ActivityTypes', TRUE);
188
5346744e 189 $allActTypes = CRM_Activity_BAO_Activity::buildOptions('activity_type_id', 'validate');
5ffd5a35 190 $emailActivityType = array_search('Email', $allActTypes);
fd54c68d 191 $pdfActivityType = array_search('Print PDF Letter', $allActTypes);
5ffd5a35 192
e43d5206
CW
193 if ($pdfActivityType) {
194 $this->assign('exportDoc', CRM_Utils_System::url('civicrm/activity/pdf/add',
195 "action=add&context=standalone&reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&atype=$pdfActivityType"));
196 }
197
6a488035 198 // remove Open Case activity type since we're inside an existing case
5ffd5a35 199 if ($openActTypeId = array_search('Open Case', $allActTypes)) {
6a488035
TO
200 unset($aTypes[$openActTypeId]);
201 }
202
abd06efc
CW
203 // Only show "link cases" activity if other cases exist.
204 $linkActTypeId = array_search('Link Cases', $allActTypes);
205 if ($linkActTypeId) {
be2fb01f 206 $count = civicrm_api3('Case', 'getcount', [
0a1a8b63 207 'check_permissions' => TRUE,
be2fb01f 208 'id' => ['!=' => $this->_caseID],
abd06efc 209 'is_deleted' => 0,
be2fb01f 210 ]);
abd06efc
CW
211 if (!$count) {
212 unset($aTypes[$linkActTypeId]);
213 }
6a488035
TO
214 }
215
216 if (!$xmlProcessor->getNaturalActivityTypeSort()) {
217 asort($aTypes);
218 }
219
be2fb01f 220 $activityLinks = ['' => ts('Add Activity')];
5ffd5a35
CW
221 foreach ($aTypes as $type => $label) {
222 if ($type == $emailActivityType) {
223 $url = CRM_Utils_System::url('civicrm/activity/email/add',
224 "action=add&context=standalone&reset=1&caseid={$this->_caseID}&atype=$type",
225 FALSE, NULL, FALSE
226 );
ed92d614 227 }
481a74f4 228 elseif ($type == $pdfActivityType) {
e547f744 229 $url = CRM_Utils_System::url('civicrm/activity/pdf/add',
fd54c68d 230 "action=add&context=standalone&reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&atype=$type",
481a74f4 231 FALSE, NULL, FALSE);
5e54ab6c 232 }
5ffd5a35
CW
233 else {
234 $url = CRM_Utils_System::url('civicrm/case/activity',
235 "action=add&reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&atype=$type",
236 FALSE, NULL, FALSE
237 );
238 }
239 $activityLinks[$url] = $label;
240 }
241
be2fb01f 242 $this->add('select', 'add_activity_type_id', '', $activityLinks, FALSE, ['class' => 'crm-select2 crm-action-menu fa-calendar-check-o twenty']);
6a488035 243 if ($this->_hasAccessToAllCases) {
2a06342c 244 $this->add('select', 'report_id', '',
be2fb01f 245 ['' => ts('Activity Audit')] + $reports,
2a06342c 246 FALSE,
be2fb01f 247 ['class' => 'crm-select2 crm-action-menu fa-list-alt']
6a488035 248 );
2a06342c 249 $this->add('select', 'timeline_id', '',
be2fb01f 250 ['' => ts('Add Timeline')] + $reports,
2a06342c 251 FALSE,
be2fb01f 252 ['class' => 'crm-select2 crm-action-menu fa-list-ol']
6a488035
TO
253 );
254 }
be2fb01f 255 $this->addElement('submit', $this->getButtonName('next'), ' ', ['class' => 'hiddenElement']);
6a488035 256
0a1a8b63 257 $this->buildMergeCaseForm();
6a488035 258
fc7d8951 259 //call activity form
504f0f9c 260 self::activityForm($this, $aTypes);
6a488035
TO
261
262 //get case related relationships (Case Role)
263 $caseRelationships = CRM_Case_BAO_Case::getCaseRoles($this->_contactID, $this->_caseID);
264
265 //save special label because we unset it in the loop
266 $managerLabel = empty($managerRoleId) ? '' : $caseRoles[$managerRoleId];
267
6a488035 268 foreach ($caseRelationships as $key => & $value) {
6a488035 269 if (!empty($managerRoleId)) {
41cf58d3 270 if (substr($managerRoleId, 0, -4) == $value['relation_type'] && substr($managerRoleId, -3) == $value['relationship_direction']) {
6a488035
TO
271 $value['relation'] = $managerLabel;
272 }
273 }
274
275 //calculate roles that don't have relationships
a7488080 276 if (!empty($caseRoles[$value['relation_type']])) {
6a488035
TO
277 unset($caseRoles[$value['relation_type']]);
278 }
279 }
280
6a488035
TO
281 $this->assign('caseRelationships', $caseRelationships);
282
283 //also add client as role. CRM-4438
284 $caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($this->_caseID);
285
286 $this->assign('caseRoles', $caseRoles);
287
6a488035
TO
288 // Retrieve ALL client relationships
289 $relClient = CRM_Contact_BAO_Relationship::getRelationship($this->_contactID,
290 CRM_Contact_BAO_Relationship::CURRENT,
291 0, 0, 0, NULL, NULL, FALSE
292 );
293
294 // Now build 'Other Relationships' array by removing relationships that are already listed under Case Roles
295 // so they don't show up twice.
be2fb01f 296 $clientRelationships = [];
6a488035
TO
297 foreach ($relClient as $r) {
298 if (!array_key_exists($r['id'], $caseRelationships)) {
299 $clientRelationships[] = $r;
300 }
301 }
302 $this->assign('clientRelationships', $clientRelationships);
303
304 // Now global contact list that appears on all cases.
be2fb01f 305 $globalGroupInfo = [];
d79c94d5 306 CRM_Case_BAO_Case::getGlobalContacts($globalGroupInfo);
6a488035
TO
307 $this->assign('globalGroupInfo', $globalGroupInfo);
308
3b1c37fe 309 // List relationship types for adding an arbitrary new role to the case
0004ae05
CW
310 $this->add('select',
311 'role_type',
312 ts('Relationship Type'),
be2fb01f 313 ['' => ts('- select type -')] + $allowedRelationshipTypes,
0004ae05 314 FALSE,
be2fb01f 315 ['class' => 'crm-select2 twenty', 'data-select-params' => '{"allowClear": false}']
0004ae05 316 );
6a488035
TO
317
318 $hookCaseSummary = CRM_Utils_Hook::caseSummary($this->_caseID);
319 if (is_array($hookCaseSummary)) {
320 $this->assign('hookCaseSummary', $hookCaseSummary);
321 }
322
b733747a 323 $allTags = CRM_Core_BAO_Tag::getColorTags('civicrm_case');
6a488035
TO
324
325 if (!empty($allTags)) {
b733747a 326 $this->add('select2', 'case_tag', ts('Tags'), $allTags, FALSE,
be2fb01f 327 ['id' => 'tags', 'multiple' => 'multiple']
6a488035
TO
328 );
329
330 $tags = CRM_Core_BAO_EntityTag::getTag($this->_caseID, 'civicrm_case');
331
6a488035 332 foreach ($tags as $tid) {
b733747a
CW
333 $tagInfo = CRM_Utils_Array::findInTree($tid, $allTags);
334 if ($tagInfo) {
335 $tags[$tid] = $tagInfo;
6fd5424b 336 }
337 else {
338 unset($tags[$tid]);
339 }
6a488035
TO
340 }
341
be2fb01f 342 $this->setDefaults(['case_tag' => implode(',', array_keys($tags))]);
b733747a
CW
343
344 $this->assign('tags', $tags);
6a488035
TO
345 $this->assign('showTags', TRUE);
346 }
347 else {
348 $this->assign('showTags', FALSE);
349 }
350
351 // build tagset widget
352
353 // see if we have any tagsets which can be assigned to cases
354 $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_case');
be2fb01f 355 $tagSetTags = [];
6a488035 356 if ($parentNames) {
79564bd4 357 $this->assign('showTags', TRUE);
be2fb01f 358 $tagSetItems = civicrm_api3('entityTag', 'get', [
79564bd4
CW
359 'entity_id' => $this->_caseID,
360 'entity_table' => 'civicrm_case',
8eecc659 361 'tag_id.parent_id.is_tagset' => 1,
be2fb01f
CW
362 'options' => ['limit' => 0],
363 'return' => ["tag_id.parent_id", "tag_id.parent_id.name", "tag_id.name"],
364 ]);
8eecc659 365 foreach ($tagSetItems['values'] as $tag) {
be2fb01f
CW
366 $tagSetTags += [
367 $tag['tag_id.parent_id'] => [
8eecc659 368 'name' => $tag['tag_id.parent_id.name'],
be2fb01f
CW
369 'items' => [],
370 ],
371 ];
8eecc659 372 $tagSetTags[$tag['tag_id.parent_id']]['items'][] = $tag['tag_id.name'];
79564bd4 373 }
6a488035 374 }
8eecc659 375 $this->assign('tagSetTags', $tagSetTags);
95ef220a 376 CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, 'civicrm_case', $this->_caseID, FALSE, TRUE);
6a488035 377
be2fb01f 378 $this->addButtons([
5d4fcf54
TO
379 [
380 'type' => 'cancel',
381 'name' => ts('Done'),
382 'spacing' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
383 'isDefault' => TRUE,
384 ],
385 ]);
6a488035
TO
386 }
387
388 /**
fe482240 389 * Process the form.
6a488035
TO
390 */
391 public function postProcess() {
392 $params = $this->controller->exportValues($this->_name);
393 $buttonName = $this->controller->getButtonName();
394
395 // user context
396 $url = CRM_Utils_System::url('civicrm/contact/view/case',
397 "reset=1&action=view&cid={$this->_contactID}&id={$this->_caseID}&show=1"
398 );
399 $session = CRM_Core_Session::singleton();
400 $session->pushUserContext($url);
401
8cc574cf 402 if (!empty($params['timeline_id']) && !empty($_POST['_qf_CaseView_next'])) {
be2fb01f 403 civicrm_api3('Case', 'addtimeline', [
ae76ce5e
CW
404 'case_id' => $this->_caseID,
405 'timeline' => $params['timeline_id'],
be2fb01f 406 ]);
ae76ce5e 407
353ffa53 408 $xmlProcessor = new CRM_Case_XMLProcessor_Process();
6a488035 409 $reports = $xmlProcessor->get($this->_caseType, 'ActivitySets');
6a488035 410 CRM_Core_Session::setStatus(ts('Activities from the %1 activity set have been added to this case.',
be2fb01f 411 [1 => $reports[$params['timeline_id']]]
6a488035
TO
412 ), ts('Done'), 'success');
413 }
414 elseif ($this->_mergeCases &&
415 $buttonName == '_qf_CaseView_next_merge_case'
416 ) {
417
418 $mainCaseId = $params['merge_case_id'];
419 $otherCaseId = $this->_caseID;
420
421 //merge two cases.
422 CRM_Case_BAO_Case::mergeCases($this->_contactID, $mainCaseId, NULL, $otherCaseId);
423
424 //redirect user to main case view.
425 $url = CRM_Utils_System::url('civicrm/contact/view/case',
426 "reset=1&action=view&cid={$this->_contactID}&id={$mainCaseId}&show=1"
427 );
428 $session = CRM_Core_Session::singleton();
429 $session->pushUserContext($url);
430 }
6a488035 431 }
85859f88
CW
432
433 /**
434 * Build the activity selector/datatable
435 * @param CRM_Core_Form $form
64bd5a0e
TO
436 * @param array $aTypes
437 * To include acivities related to current case id $form->_caseID.
85859f88 438 */
be2fb01f 439 public static function activityForm($form, $aTypes = []) {
85859f88
CW
440 $caseRelationships = CRM_Case_BAO_Case::getCaseRoles($form->_contactID, $form->_caseID);
441 //build reporter select
be2fb01f 442 $reporters = ["" => ts(' - any reporter - ')];
85859f88
CW
443 foreach ($caseRelationships as $key => & $value) {
444 $reporters[$value['cid']] = $value['name'] . " ( {$value['relation']} )";
445 }
be2fb01f 446 $form->add('select', 'reporter_id', ts('Reporter/Role'), $reporters, FALSE, ['id' => 'reporter_id_' . $form->_caseID]);
85859f88
CW
447
448 // take all case activity types for search filter, CRM-7187
be2fb01f 449 $aTypesFilter = [];
85859f88
CW
450 $allCaseActTypes = CRM_Case_PseudoConstant::caseActivityType();
451 foreach ($allCaseActTypes as $typeDetails) {
be2fb01f 452 if (!in_array($typeDetails['name'], ['Open Case'])) {
85859f88
CW
453 $aTypesFilter[$typeDetails['id']] = CRM_Utils_Array::value('label', $typeDetails);
454 }
455 }
504f0f9c 456 $aTypesFilter = $aTypesFilter + $aTypes;
85859f88 457 asort($aTypesFilter);
be2fb01f 458 $form->add('select', 'activity_type_filter_id', ts('Activity Type'), ['' => ts('- select activity type -')] + $aTypesFilter, FALSE, ['id' => 'activity_type_filter_id_' . $form->_caseID]);
85859f88
CW
459
460 $activityStatus = CRM_Core_PseudoConstant::activityStatus();
be2fb01f 461 $form->add('select', 'status_id', ts('Status'), ["" => ts(' - any status - ')] + $activityStatus, FALSE, ['id' => 'status_id_' . $form->_caseID]);
85859f88 462
ab9eca19
CW
463 // activity date search filters
464 $form->add('datepicker', 'activity_date_low_' . $form->_caseID, ts('Activity Dates - From'), [], FALSE, ['time' => FALSE]);
465 $form->add('datepicker', 'activity_date_high_' . $form->_caseID, ts('To'), [], FALSE, ['time' => FALSE]);
85859f88
CW
466
467 if (CRM_Core_Permission::check('administer CiviCRM')) {
be2fb01f 468 $form->add('checkbox', 'activity_deleted', ts('Deleted Activities'), '', FALSE, ['id' => 'activity_deleted_' . $form->_caseID]);
85859f88
CW
469 }
470 }
96025800 471
0a1a8b63
CW
472 /**
473 * Form elements for merging cases
474 */
475 public function buildMergeCaseForm() {
be2fb01f
CW
476 $otherCases = [];
477 $result = civicrm_api3('Case', 'get', [
0a1a8b63
CW
478 'check_permissions' => TRUE,
479 'contact_id' => $this->_contactID,
480 'is_deleted' => 0,
be2fb01f
CW
481 'id' => ['!=' => $this->_caseID],
482 'return' => ['id', 'start_date', 'case_type_id.title'],
483 ]);
0a1a8b63 484 foreach ($result['values'] as $id => $case) {
be2fb01f 485 $otherCases[$id] = "#$id: {$case['case_type_id.title']} " . ts('(opened %1)', [1 => $case['start_date']]);
0a1a8b63
CW
486 }
487
488 $this->assign('mergeCases', $this->_mergeCases = (bool) $otherCases);
489
490 if ($otherCases) {
491 $this->add('select', 'merge_case_id',
492 ts('Select Case for Merge'),
be2fb01f 493 [
0a1a8b63 494 '' => ts('- select case -'),
be2fb01f 495 ] + $otherCases,
0a1a8b63 496 FALSE,
be2fb01f 497 ['class' => 'crm-select2 huge']
0a1a8b63
CW
498 );
499 $this->addElement('submit',
500 $this->getButtonName('next', 'merge_case'),
501 ts('Merge'),
be2fb01f 502 [
0a1a8b63 503 'class' => 'hiddenElement',
be2fb01f 504 ]
0a1a8b63
CW
505 );
506 }
507 }
508
ed92d614 509}