Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
e7112fa7 | 6 | | Copyright CiviCRM LLC (c) 2004-2015 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | /** | |
29 | * | |
30 | * @package CRM | |
e7112fa7 | 31 | * @copyright CiviCRM LLC (c) 2004-2015 |
6a488035 TO |
32 | * $Id$ |
33 | * | |
34 | */ | |
35 | class CRM_Case_XMLProcessor_Report extends CRM_Case_XMLProcessor { | |
36 | ||
37 | /** | |
fe482240 | 38 | * The default variable defined. |
6a488035 TO |
39 | * |
40 | * @var boolean | |
41 | */ | |
42 | protected $_isRedact; | |
43 | ||
4c6ce474 | 44 | /** |
4c6ce474 | 45 | */ |
e547f744 TO |
46 | public function __construct() { |
47 | } | |
6a488035 | 48 | |
4c6ce474 | 49 | /** |
100fef9d CW |
50 | * @param int $clientID |
51 | * @param int $caseID | |
52 | * @param string $activitySetName | |
c490a46a | 53 | * @param array $params |
4c6ce474 EM |
54 | * |
55 | * @return mixed | |
56 | */ | |
00be9182 | 57 | public function run($clientID, $caseID, $activitySetName, $params) { |
6a488035 TO |
58 | $contents = self::getCaseReport($clientID, |
59 | $caseID, | |
60 | $activitySetName, | |
61 | $params, | |
62 | $this | |
63 | ); | |
64 | ||
65 | return CRM_Case_Audit_Audit::run($contents, $clientID, $caseID); | |
66 | } | |
67 | ||
00be9182 | 68 | public function &getRedactionRules() { |
6a488035 | 69 | foreach (array( |
353ffa53 | 70 | 'redactionStringRules', |
acb1052e | 71 | 'redactionRegexRules', |
353ffa53 | 72 | ) as $key => $rule) { |
6a488035 TO |
73 | $$rule = CRM_Case_PseudoConstant::redactionRule($key); |
74 | ||
75 | if (!empty($$rule)) { | |
76 | foreach ($$rule as & $val) { | |
77 | //suffixed with a randomly generated 4-digit number | |
78 | if ($key == 'redactionStringRules') { | |
79 | $val .= rand(10000, 100000); | |
80 | } | |
81 | } | |
82 | ||
83 | if (!empty($this->{'_' . $rule})) { | |
84 | $this->{'_' . $rule} = CRM_Utils_Array::crmArrayMerge($this->{'_' . $rule}, $$rule); | |
85 | } | |
86 | else { | |
87 | $this->{'_' . $rule} = $$rule; | |
88 | } | |
89 | } | |
90 | } | |
91 | } | |
92 | ||
4c6ce474 | 93 | /** |
100fef9d CW |
94 | * @param int $clientID |
95 | * @param int $caseID | |
4c6ce474 EM |
96 | * |
97 | * @return array | |
98 | */ | |
acb1052e | 99 | public function &caseInfo( |
28d4d481 | 100 | $clientID, |
6a488035 TO |
101 | $caseID |
102 | ) { | |
103 | $case = $this->_redactionRegexRules = array(); | |
104 | ||
105 | if (empty($this->_redactionStringRules)) { | |
106 | $this->_redactionStringRules = array(); | |
107 | } | |
108 | ||
109 | if ($this->_isRedact == 1) { | |
110 | $this->getRedactionRules(); | |
111 | } | |
112 | ||
113 | $client = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $clientID, 'display_name'); | |
114 | ||
115 | // add Client to the strings to be redacted across the case session | |
116 | if (!array_key_exists($client, $this->_redactionStringRules)) { | |
117 | $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, | |
118 | array($client => 'name_' . rand(10000, 100000)) | |
119 | ); | |
120 | $clientSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $clientID, 'sort_name'); | |
121 | if (!array_key_exists($clientSortName, $this->_redactionStringRules)) { | |
122 | $this->_redactionStringRules[$clientSortName] = $this->_redactionStringRules[$client]; | |
123 | } | |
124 | } | |
125 | ||
126 | $case['clientName'] = $this->redact($client); | |
127 | ||
128 | $dao = new CRM_Case_DAO_Case(); | |
129 | $dao->id = $caseID; | |
130 | if ($dao->find(TRUE)) { | |
353ffa53 | 131 | $case['subject'] = $dao->subject; |
6a488035 | 132 | $case['start_date'] = $dao->start_date; |
353ffa53 | 133 | $case['end_date'] = $dao->end_date; |
6a488035 TO |
134 | // FIXME: when we resolve if case_type_is single or multi-select |
135 | if (strpos($dao->case_type_id, CRM_Core_DAO::VALUE_SEPARATOR) !== FALSE) { | |
136 | $caseTypeID = substr($dao->case_type_id, 1, -1); | |
137 | } | |
138 | else { | |
139 | $caseTypeID = $dao->case_type_id; | |
140 | } | |
141 | $caseTypeIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR, | |
142 | $dao->case_type_id | |
143 | ); | |
144 | ||
145 | $case['caseType'] = CRM_Case_BAO_Case::getCaseType($caseID); | |
146 | $case['caseTypeName'] = CRM_Case_BAO_Case::getCaseType($caseID, 'name'); | |
147 | $case['status'] = CRM_Core_OptionGroup::getLabel('case_status', $dao->status_id, FALSE); | |
148 | } | |
149 | return $case; | |
150 | } | |
151 | ||
4c6ce474 EM |
152 | /** |
153 | * @param $xml | |
100fef9d | 154 | * @param string $activitySetName |
4c6ce474 EM |
155 | * |
156 | * @return array|bool | |
157 | */ | |
00be9182 | 158 | public function getActivityTypes($xml, $activitySetName) { |
6a488035 TO |
159 | foreach ($xml->ActivitySets as $activitySetsXML) { |
160 | foreach ($activitySetsXML->ActivitySet as $activitySetXML) { | |
161 | if ((string ) $activitySetXML->name == $activitySetName) { | |
162 | $activityTypes = array(); | |
163 | $allActivityTypes = &$this->allActivityTypes(); | |
164 | foreach ($activitySetXML->ActivityTypes as $activityTypesXML) { | |
165 | foreach ($activityTypesXML as $activityTypeXML) { | |
166 | $activityTypeName = (string ) $activityTypeXML->name; | |
167 | $activityTypeInfo = CRM_Utils_Array::value($activityTypeName, $allActivityTypes); | |
168 | if ($activityTypeInfo) { | |
169 | $activityTypes[$activityTypeInfo['id']] = $activityTypeInfo; | |
170 | } | |
171 | } | |
172 | } | |
173 | return empty($activityTypes) ? FALSE : $activityTypes; | |
174 | } | |
175 | } | |
176 | } | |
177 | return FALSE; | |
178 | } | |
179 | ||
4c6ce474 EM |
180 | /** |
181 | * @param $xml | |
100fef9d | 182 | * @param string $activitySetName |
4c6ce474 EM |
183 | * |
184 | * @return null|string | |
185 | */ | |
00be9182 | 186 | public function getActivitySetLabel($xml, $activitySetName) { |
6a488035 TO |
187 | foreach ($xml->ActivitySets as $activitySetsXML) { |
188 | foreach ($activitySetsXML->ActivitySet as $activitySetXML) { | |
189 | if ((string ) $activitySetXML->name == $activitySetName) { | |
190 | return (string ) $activitySetXML->label; | |
191 | } | |
192 | } | |
193 | } | |
194 | return NULL; | |
195 | } | |
196 | ||
4c6ce474 | 197 | /** |
100fef9d CW |
198 | * @param int $clientID |
199 | * @param int $caseID | |
4c6ce474 EM |
200 | * @param $activityTypes |
201 | * @param $activities | |
202 | */ | |
00be9182 | 203 | public function getActivities($clientID, $caseID, $activityTypes, &$activities) { |
6a488035 TO |
204 | // get all activities for this case that in this activityTypes set |
205 | foreach ($activityTypes as $aType) { | |
206 | $map[$aType['id']] = $aType; | |
207 | } | |
208 | ||
209 | // get all core activities | |
210 | $coreActivityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, TRUE); | |
211 | ||
212 | foreach ($coreActivityTypes as $aType) { | |
213 | $map[$aType['id']] = $aType; | |
214 | } | |
215 | ||
216 | $activityTypeIDs = implode(',', array_keys($map)); | |
217 | $query = " | |
218 | SELECT a.*, c.id as caseID | |
219 | FROM civicrm_activity a, | |
220 | civicrm_case c, | |
221 | civicrm_case_activity ac | |
222 | WHERE a.is_current_revision = 1 | |
223 | AND a.is_deleted =0 | |
224 | AND a.activity_type_id IN ( $activityTypeIDs ) | |
225 | AND c.id = ac.case_id | |
226 | AND a.id = ac.activity_id | |
227 | AND ac.case_id = %1 | |
228 | "; | |
229 | ||
230 | $params = array(1 => array($caseID, 'Integer')); | |
231 | $dao = CRM_Core_DAO::executeQuery($query, $params); | |
232 | while ($dao->fetch()) { | |
233 | $activityTypeInfo = $map[$dao->activity_type_id]; | |
234 | $activities[] = $this->getActivity($clientID, | |
235 | $dao, | |
236 | $activityTypeInfo | |
237 | ); | |
238 | } | |
239 | } | |
240 | ||
4c6ce474 | 241 | /** |
100fef9d CW |
242 | * @param int $clientID |
243 | * @param int $activityID | |
4c6ce474 EM |
244 | * @param bool $anyActivity |
245 | * @param int $redact | |
246 | * | |
247 | * @return mixed | |
248 | */ | |
00be9182 | 249 | public function &getActivityInfo($clientID, $activityID, $anyActivity = FALSE, $redact = 0) { |
6a488035 TO |
250 | static $activityInfos = array(); |
251 | if ($redact) { | |
252 | $this->_isRedact = 1; | |
253 | $this->getRedactionRules(); | |
254 | } | |
255 | ||
6a488035 TO |
256 | $index = $activityID . '_' . (int) $anyActivity; |
257 | ||
258 | if ($clientID) { | |
259 | $index = $index . '_' . $clientID; | |
260 | } | |
261 | ||
6a488035 TO |
262 | if (!array_key_exists($index, $activityInfos)) { |
263 | $activityInfos[$index] = array(); | |
264 | $selectCaseActivity = ""; | |
265 | $joinCaseActivity = ""; | |
266 | ||
267 | if ($clientID) { | |
268 | $selectCaseActivity = ", ca.case_id as caseID "; | |
269 | $joinCaseActivity = " INNER JOIN civicrm_case_activity ca ON a.id = ca.activity_id "; | |
270 | } | |
271 | ||
e7e657f0 | 272 | $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); |
9e74e3ce | 273 | $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); |
274 | $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); | |
8ef12e64 | 275 | |
6a488035 | 276 | $query = " |
5a1bd70b | 277 | SELECT a.*, aa.contact_id as assigneeID, at.contact_id as targetID |
6a488035 TO |
278 | {$selectCaseActivity} |
279 | FROM civicrm_activity a | |
280 | {$joinCaseActivity} | |
9e74e3ce | 281 | LEFT JOIN civicrm_activity_contact at ON a.id = at.activity_id AND at.record_type_id = $targetID |
282 | LEFT JOIN civicrm_activity_contact aa ON a.id = aa.activity_id AND aa.record_type_id = $assigneeID | |
6a488035 TO |
283 | WHERE a.id = %1 |
284 | "; | |
285 | $params = array(1 => array($activityID, 'Integer')); | |
286 | $dao = CRM_Core_DAO::executeQuery($query, $params); | |
287 | ||
288 | if ($dao->fetch()) { | |
289 | //if activity type is email get info of all activities. | |
290 | if ($dao->activity_type_id == CRM_Core_OptionGroup::getValue('activity_type', 'Email', 'name')) { | |
291 | $anyActivity = TRUE; | |
292 | } | |
a953bf20 | 293 | $activityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, $anyActivity); |
6a488035 TO |
294 | $activityTypeInfo = NULL; |
295 | ||
296 | if (isset($activityTypes[$dao->activity_type_id])) { | |
297 | $activityTypeInfo = $activityTypes[$dao->activity_type_id]; | |
298 | } | |
299 | if ($activityTypeInfo) { | |
300 | $activityInfos[$index] = $this->getActivity($clientID, $dao, $activityTypeInfo); | |
301 | } | |
302 | } | |
303 | } | |
304 | ||
305 | return $activityInfos[$index]; | |
306 | } | |
307 | ||
4c6ce474 | 308 | /** |
100fef9d | 309 | * @param int $clientID |
4c6ce474 EM |
310 | * @param $activityDAO |
311 | * @param $activityTypeInfo | |
312 | * | |
313 | * @return array | |
314 | */ | |
00be9182 | 315 | public function &getActivity($clientID, $activityDAO, &$activityTypeInfo) { |
6a488035 TO |
316 | if (empty($this->_redactionStringRules)) { |
317 | $this->_redactionStringRules = array(); | |
318 | } | |
319 | ||
320 | $activity = array(); | |
321 | $activity['fields'] = array(); | |
322 | if ($clientID) { | |
323 | $clientID = CRM_Utils_Type::escape($clientID, 'Integer'); | |
324 | if (!in_array($activityTypeInfo['name'], array( | |
353ffa53 | 325 | 'Email', |
acb1052e | 326 | 'Inbound Email', |
353ffa53 TO |
327 | )) |
328 | ) { | |
6a488035 TO |
329 | $activity['editURL'] = CRM_Utils_System::url('civicrm/case/activity', |
330 | "reset=1&cid={$clientID}&caseid={$activityDAO->caseID}&action=update&atype={$activityDAO->activity_type_id}&id={$activityDAO->id}" | |
331 | ); | |
332 | } | |
333 | else { | |
334 | $activity['editURL'] = ''; | |
335 | } | |
336 | ||
337 | $client = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $clientID, 'display_name'); | |
338 | // add Client SortName as well as Display to the strings to be redacted across the case session | |
339 | // suffixed with a randomly generated 4-digit number | |
340 | if (!array_key_exists($client, $this->_redactionStringRules)) { | |
341 | $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, | |
342 | array($client => 'name_' . rand(10000, 100000)) | |
343 | ); | |
344 | ||
345 | $clientSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $clientID, 'sort_name'); | |
346 | if (!array_key_exists($clientSortName, $this->_redactionStringRules)) { | |
347 | $this->_redactionStringRules[$clientSortName] = $this->_redactionStringRules[$client]; | |
348 | } | |
349 | } | |
350 | ||
351 | $activity['fields'][] = array( | |
352 | 'label' => 'Client', | |
353 | 'value' => $this->redact($client), | |
354 | 'type' => 'String', | |
355 | ); | |
356 | } | |
357 | ||
e7e657f0 | 358 | $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); |
034500d4 | 359 | $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); |
360 | $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); | |
6a488035 TO |
361 | if (!empty($activityDAO->targetID)) { |
362 | // Re-lookup the target ID since the DAO only has the first recipient if there are multiple. | |
363 | // Maybe not the best solution. | |
353ffa53 | 364 | $targetNames = CRM_Activity_BAO_ActivityContact::getNames($activityDAO->id, $targetID); |
6a488035 | 365 | $processTarget = FALSE; |
353ffa53 | 366 | $label = ts('With Contact(s)'); |
22d5fc65 | 367 | if (in_array($activityTypeInfo['name'], array('Email', 'Inbound Email'))) { |
6a488035 TO |
368 | $processTarget = TRUE; |
369 | $label = ts('Recipient'); | |
370 | } | |
371 | if (!$processTarget) { | |
372 | foreach ($targetNames as $targetID => $targetName) { | |
373 | if ($targetID != $clientID) { | |
374 | $processTarget = TRUE; | |
375 | break; | |
376 | } | |
377 | } | |
378 | } | |
379 | ||
380 | if ($processTarget) { | |
381 | $targetRedacted = array(); | |
382 | foreach ($targetNames as $targetID => $target) { | |
383 | // add Recipient SortName as well as Display to the strings to be redacted across the case session | |
384 | // suffixed with a randomly generated 4-digit number | |
385 | if (!array_key_exists($target, $this->_redactionStringRules)) { | |
386 | $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, | |
387 | array($target => 'name_' . rand(10000, 100000)) | |
388 | ); | |
389 | $targetSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $targetID, 'sort_name'); | |
390 | if (!array_key_exists($targetSortName, $this->_redactionStringRules)) { | |
391 | $this->_redactionStringRules[$targetSortName] = $this->_redactionStringRules[$target]; | |
392 | } | |
393 | } | |
394 | $targetRedacted[] = $this->redact($target); | |
395 | } | |
396 | ||
397 | $activity['fields'][] = array( | |
398 | 'label' => $label, | |
399 | 'value' => implode('; ', $targetRedacted), | |
400 | 'type' => 'String', | |
401 | ); | |
402 | } | |
403 | } | |
404 | ||
405 | // Activity Type info is a special field | |
406 | $activity['fields'][] = array( | |
22d5fc65 | 407 | 'label' => ts('Activity Type'), |
6a488035 TO |
408 | 'value' => $activityTypeInfo['label'], |
409 | 'type' => 'String', | |
410 | ); | |
411 | ||
412 | $activity['fields'][] = array( | |
22d5fc65 | 413 | 'label' => ts('Subject'), |
6a488035 TO |
414 | 'value' => htmlspecialchars($this->redact($activityDAO->subject)), |
415 | 'type' => 'Memo', | |
416 | ); | |
417 | ||
418 | $creator = $this->getCreatedBy($activityDAO->id); | |
419 | // add Creator to the strings to be redacted across the case session | |
420 | if (!array_key_exists($creator, $this->_redactionStringRules)) { | |
421 | $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, | |
422 | array($creator => 'name_' . rand(10000, 100000)) | |
423 | ); | |
424 | } | |
425 | $activity['fields'][] = array( | |
22d5fc65 | 426 | 'label' => ts('Created By'), |
6a488035 TO |
427 | 'value' => $this->redact($creator), |
428 | 'type' => 'String', | |
429 | ); | |
e7e657f0 | 430 | $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); |
034500d4 | 431 | $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); |
432 | $source_contact_id = CRM_Activity_BAO_Activity::getActivityContact($activityDAO->id, $sourceID); | |
6a488035 | 433 | $reporter = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', |
034500d4 | 434 | $source_contact_id, |
6a488035 TO |
435 | 'display_name' |
436 | ); | |
437 | ||
438 | // add Reporter SortName as well as Display to the strings to be redacted across the case session | |
439 | // suffixed with a randomly generated 4-digit number | |
440 | if (!array_key_exists($reporter, $this->_redactionStringRules)) { | |
441 | $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, | |
442 | array($reporter => 'name_' . rand(10000, 100000)) | |
443 | ); | |
444 | ||
445 | $reporterSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', | |
353ffa53 | 446 | $source_contact_id, |
6a488035 TO |
447 | 'sort_name' |
448 | ); | |
449 | if (!array_key_exists($reporterSortName, $this->_redactionStringRules)) { | |
450 | $this->_redactionStringRules[$reporterSortName] = $this->_redactionStringRules[$reporter]; | |
451 | } | |
452 | } | |
453 | ||
454 | $activity['fields'][] = array( | |
22d5fc65 | 455 | 'label' => ts('Reported By'), |
6a488035 TO |
456 | 'value' => $this->redact($reporter), |
457 | 'type' => 'String', | |
458 | ); | |
459 | ||
460 | if (!empty($activityDAO->assigneeID)) { | |
461 | //allow multiple assignee contacts.CRM-4503. | |
90b05581 | 462 | $assignee_contact_names = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames(array($activityDAO->id), TRUE); |
6a488035 TO |
463 | |
464 | foreach ($assignee_contact_names as & $assignee) { | |
465 | // add Assignee to the strings to be redacted across the case session | |
466 | $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, | |
467 | array($assignee => 'name_' . rand(10000, 100000)) | |
468 | ); | |
469 | $assignee = $this->redact($assignee); | |
470 | } | |
471 | $assigneeContacts = implode(', ', $assignee_contact_names); | |
472 | $activity['fields'][] = array( | |
3bd48a28 | 473 | 'label' => ts('Assigned to'), |
6a488035 TO |
474 | 'value' => $assigneeContacts, |
475 | 'type' => 'String', | |
476 | ); | |
477 | } | |
478 | ||
479 | if ($activityDAO->medium_id) { | |
480 | $activity['fields'][] = array( | |
22d5fc65 | 481 | 'label' => ts('Medium'), |
6a488035 TO |
482 | 'value' => CRM_Core_OptionGroup::getLabel('encounter_medium', |
483 | $activityDAO->medium_id, FALSE | |
484 | ), | |
485 | 'type' => 'String', | |
486 | ); | |
487 | } | |
488 | ||
489 | $activity['fields'][] = array( | |
22d5fc65 | 490 | 'label' => ts('Location'), |
6a488035 TO |
491 | 'value' => $activityDAO->location, |
492 | 'type' => 'String', | |
493 | ); | |
494 | ||
495 | $activity['fields'][] = array( | |
22d5fc65 | 496 | 'label' => ts('Date and Time'), |
6a488035 TO |
497 | 'value' => $activityDAO->activity_date_time, |
498 | 'type' => 'Date', | |
499 | ); | |
500 | ||
501 | $activity['fields'][] = array( | |
22d5fc65 | 502 | 'label' => ts('Details'), |
6a488035 TO |
503 | 'value' => $this->redact(CRM_Utils_String::stripAlternatives($activityDAO->details)), |
504 | 'type' => 'Memo', | |
505 | ); | |
506 | ||
507 | // Skip Duration field if empty (to avoid " minutes" output). Might want to do this for all fields at some point. dgg | |
508 | if ($activityDAO->duration) { | |
509 | $activity['fields'][] = array( | |
22d5fc65 | 510 | 'label' => ts('Duration'), |
6a488035 TO |
511 | 'value' => $activityDAO->duration . ' ' . ts('minutes'), |
512 | 'type' => 'Int', | |
513 | ); | |
514 | } | |
515 | $activity['fields'][] = array( | |
22d5fc65 | 516 | 'label' => ts('Status'), |
6a488035 TO |
517 | 'value' => CRM_Core_OptionGroup::getLabel('activity_status', |
518 | $activityDAO->status_id | |
519 | ), | |
520 | 'type' => 'String', | |
521 | ); | |
522 | ||
523 | $activity['fields'][] = array( | |
22d5fc65 | 524 | 'label' => ts('Priority'), |
6a488035 TO |
525 | 'value' => CRM_Core_OptionGroup::getLabel('priority', |
526 | $activityDAO->priority_id | |
527 | ), | |
528 | 'type' => 'String', | |
529 | ); | |
530 | ||
531 | //for now empty custom groups | |
532 | $activity['customGroups'] = $this->getCustomData($clientID, | |
533 | $activityDAO, | |
534 | $activityTypeInfo | |
535 | ); | |
536 | ||
537 | return $activity; | |
538 | } | |
539 | ||
4c6ce474 | 540 | /** |
100fef9d | 541 | * @param int $clientID |
4c6ce474 EM |
542 | * @param $activityDAO |
543 | * @param $activityTypeInfo | |
544 | * | |
545 | * @return array|null | |
546 | */ | |
00be9182 | 547 | public function getCustomData($clientID, $activityDAO, &$activityTypeInfo) { |
6a488035 TO |
548 | list($typeValues, $options, $sql) = $this->getActivityTypeCustomSQL($activityTypeInfo['id'], '%Y-%m-%d'); |
549 | ||
550 | $params = array(1 => array($activityDAO->id, 'Integer')); | |
551 | ||
552 | $customGroups = array(); | |
553 | foreach ($sql as $tableName => $sqlClause) { | |
554 | $dao = CRM_Core_DAO::executeQuery($sqlClause, $params); | |
555 | if ($dao->fetch()) { | |
556 | $customGroup = array(); | |
557 | foreach ($typeValues[$tableName] as $columnName => $typeValue) { | |
558 | $value = CRM_Core_BAO_CustomField::getDisplayValue($dao->$columnName, | |
559 | $typeValue['fieldID'], | |
560 | $options | |
561 | ); | |
562 | ||
563 | if (CRM_Utils_Array::value('type', $typeValue) == 'Date') { | |
564 | $value = $dao->$columnName; | |
565 | } | |
566 | ||
567 | if ($value) { | |
568 | // Note: this is already taken care in getDisplayValue above, but sometimes | |
569 | // strings like '^A^A' creates problem. So to fix this special case - | |
570 | if (strstr($value, CRM_Core_DAO::VALUE_SEPARATOR)) { | |
571 | $value = trim($value, CRM_Core_DAO::VALUE_SEPARATOR); | |
572 | } | |
573 | if (CRM_Utils_Array::value('type', $typeValue) == 'String' || | |
574 | CRM_Utils_Array::value('type', $typeValue) == 'Memo' | |
575 | ) { | |
576 | $value = $this->redact($value); | |
577 | } | |
578 | elseif (CRM_Utils_Array::value('type', $typeValue) == 'File') { | |
579 | $tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $typeValue, 'entity_table'); | |
580 | $value = CRM_Core_BAO_File::attachmentInfo($tableName, $activityDAO->id); | |
581 | } | |
582 | elseif (CRM_Utils_Array::value('type', $typeValue) == 'Link') { | |
583 | $value = CRM_Utils_System::formatWikiURL($value); | |
584 | } | |
585 | } | |
586 | //$typeValue | |
587 | $customGroup[] = array( | |
588 | 'label' => $typeValue['label'], | |
589 | 'value' => $value, | |
590 | 'type' => $typeValue['type'], | |
dc7c0d62 | 591 | 'fieldID' => $typeValue['fieldID'], |
6a488035 TO |
592 | ); |
593 | } | |
594 | $customGroups[$dao->groupTitle] = $customGroup; | |
595 | } | |
596 | } | |
597 | ||
598 | return empty($customGroups) ? NULL : $customGroups; | |
599 | } | |
600 | ||
4c6ce474 | 601 | /** |
100fef9d | 602 | * @param int $activityTypeID |
4c6ce474 EM |
603 | * @param null $dateFormat |
604 | * | |
605 | * @return mixed | |
606 | */ | |
00be9182 | 607 | public function getActivityTypeCustomSQL($activityTypeID, $dateFormat = NULL) { |
6a488035 TO |
608 | static $cache = array(); |
609 | ||
610 | if (is_null($activityTypeID)) { | |
611 | $activityTypeID = 0; | |
612 | } | |
613 | ||
614 | if (!isset($cache[$activityTypeID])) { | |
615 | $query = " | |
616 | SELECT cg.title as groupTitle, | |
617 | cg.table_name as tableName , | |
618 | cf.column_name as columnName, | |
619 | cf.label as label , | |
620 | cg.id as groupID , | |
621 | cf.id as fieldID , | |
622 | cf.data_type as dataType , | |
623 | cf.html_type as htmlType , | |
624 | cf.option_group_id as optionGroupID | |
625 | FROM civicrm_custom_group cg, | |
626 | civicrm_custom_field cf | |
627 | WHERE cf.custom_group_id = cg.id | |
fb6aa4b9 | 628 | AND cg.extends = 'Activity' |
629 | AND " . CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW, 'cg.'); | |
6a488035 TO |
630 | |
631 | if ($activityTypeID) { | |
632 | $query .= "AND ( cg.extends_entity_column_value IS NULL OR cg.extends_entity_column_value LIKE '%" . CRM_Core_DAO::VALUE_SEPARATOR . "%1" . CRM_Core_DAO::VALUE_SEPARATOR . "%' )"; | |
633 | } | |
634 | else { | |
635 | $query .= "AND cg.extends_entity_column_value IS NULL"; | |
636 | } | |
a5c0c7f2 | 637 | $query .= "ORDER BY cg.weight, cf.weight"; |
6a488035 | 638 | $params = array( |
353ffa53 TO |
639 | 1 => array( |
640 | $activityTypeID, | |
6a488035 | 641 | 'Integer', |
acb1052e | 642 | ), |
353ffa53 | 643 | ); |
6a488035 TO |
644 | $dao = CRM_Core_DAO::executeQuery($query, $params); |
645 | ||
646 | $result = $options = $sql = $groupTitle = array(); | |
647 | while ($dao->fetch()) { | |
648 | if (!array_key_exists($dao->tableName, $result)) { | |
649 | $result[$dao->tableName] = array(); | |
650 | $sql[$dao->tableName] = array(); | |
651 | } | |
652 | $result[$dao->tableName][$dao->columnName] = array( | |
653 | 'label' => $dao->label, | |
654 | 'type' => $dao->dataType, | |
655 | 'fieldID' => $dao->fieldID, | |
656 | ); | |
657 | ||
658 | $options[$dao->fieldID] = array(); | |
659 | $options[$dao->fieldID]['attributes'] = array( | |
660 | 'label' => $dao->label, | |
661 | 'data_type' => $dao->dataType, | |
662 | 'html_type' => $dao->htmlType, | |
663 | ); | |
664 | // since we want to add ISO date format. | |
665 | if ($dateFormat && $dao->htmlType == 'Select Date') { | |
666 | $options[$dao->fieldID]['attributes']['format'] = $dateFormat; | |
667 | } | |
668 | if ($dao->optionGroupID) { | |
669 | $query = " | |
670 | SELECT label, value | |
671 | FROM civicrm_option_value | |
672 | WHERE option_group_id = {$dao->optionGroupID} | |
673 | "; | |
674 | ||
675 | $option = CRM_Core_DAO::executeQuery($query); | |
676 | while ($option->fetch()) { | |
677 | $dataType = $dao->dataType; | |
678 | if ($dataType == 'Int' || $dataType == 'Float') { | |
679 | $num = round($option->value, 2); | |
680 | $options[$dao->fieldID]["$num"] = $option->label; | |
681 | } | |
682 | else { | |
683 | $options[$dao->fieldID][$option->value] = $option->label; | |
684 | } | |
685 | } | |
686 | } | |
687 | ||
688 | $sql[$dao->tableName][] = $dao->columnName; | |
689 | $groupTitle[$dao->tableName] = $dao->groupTitle; | |
690 | } | |
691 | ||
692 | foreach ($sql as $tableName => $values) { | |
693 | $columnNames = implode(',', $values); | |
694 | $sql[$tableName] = " | |
695 | SELECT '{$groupTitle[$tableName]}' as groupTitle, $columnNames | |
696 | FROM $tableName | |
697 | WHERE entity_id = %1 | |
698 | "; | |
699 | } | |
700 | ||
701 | $cache[$activityTypeID] = array($result, $options, $sql); | |
702 | } | |
703 | return $cache[$activityTypeID]; | |
704 | } | |
705 | ||
4c6ce474 | 706 | /** |
100fef9d | 707 | * @param int $activityID |
4c6ce474 EM |
708 | * |
709 | * @return null|string | |
710 | */ | |
00be9182 | 711 | public function getCreatedBy($activityID) { |
6a488035 TO |
712 | $query = " |
713 | SELECT c.display_name | |
714 | FROM civicrm_contact c, | |
715 | civicrm_log l | |
716 | WHERE l.entity_table = 'civicrm_activity' | |
717 | AND l.entity_id = %1 | |
718 | AND l.modified_id = c.id | |
719 | LIMIT 1 | |
720 | "; | |
721 | ||
722 | $params = array(1 => array($activityID, 'Integer')); | |
723 | return CRM_Core_DAO::singleValueQuery($query, $params); | |
724 | } | |
725 | ||
4c6ce474 EM |
726 | /** |
727 | * @param $string | |
728 | * @param bool $printReport | |
729 | * @param array $replaceString | |
730 | * | |
731 | * @return mixed | |
732 | */ | |
c490a46a | 733 | private function redact($string, $printReport = FALSE, $replaceString = array()) { |
6a488035 TO |
734 | if ($printReport) { |
735 | return CRM_Utils_String::redaction($string, $replaceString); | |
736 | } | |
737 | elseif ($this->_isRedact) { | |
738 | $regexToReplaceString = CRM_Utils_String::regex($string, $this->_redactionRegexRules); | |
739 | return CRM_Utils_String::redaction($string, array_merge($this->_redactionStringRules, $regexToReplaceString)); | |
740 | } | |
741 | return $string; | |
742 | } | |
743 | ||
4c6ce474 | 744 | /** |
100fef9d CW |
745 | * @param int $clientID |
746 | * @param int $caseID | |
747 | * @param string $activitySetName | |
c490a46a CW |
748 | * @param array $params |
749 | * @param CRM_Core_Form $form | |
4c6ce474 EM |
750 | * |
751 | * @return mixed | |
752 | */ | |
00be9182 | 753 | public static function getCaseReport($clientID, $caseID, $activitySetName, $params, $form) { |
6a488035 TO |
754 | |
755 | $template = CRM_Core_Smarty::singleton(); | |
756 | ||
757 | $template->assign('caseId', $caseID); | |
758 | $template->assign('clientID', $clientID); | |
759 | $template->assign('activitySetName', $activitySetName); | |
760 | ||
a7488080 | 761 | if (!empty($params['is_redact'])) { |
6a488035 TO |
762 | $form->_isRedact = TRUE; |
763 | $template->assign('_isRedact', 'true'); | |
764 | } | |
765 | else { | |
766 | $form->_isRedact = FALSE; | |
767 | $template->assign('_isRedact', 'false'); | |
768 | } | |
769 | ||
770 | // first get all case information | |
771 | $case = $form->caseInfo($clientID, $caseID); | |
772 | $template->assign_by_ref('case', $case); | |
773 | ||
774 | if ($params['include_activities'] == 1) { | |
775 | $template->assign('includeActivities', 'All'); | |
776 | } | |
777 | else { | |
778 | $template->assign('includeActivities', 'Missing activities only'); | |
779 | } | |
780 | ||
781 | $xml = $form->retrieve($case['caseTypeName']); | |
782 | ||
783 | $activitySetNames = CRM_Case_XMLProcessor_Process::activitySets($xml->ActivitySets); | |
784 | $pageTitle = CRM_Utils_Array::value($activitySetName, $activitySetNames); | |
785 | $template->assign('pageTitle', $pageTitle); | |
786 | ||
787 | if ($activitySetName) { | |
788 | $activityTypes = $form->getActivityTypes($xml, $activitySetName); | |
789 | } | |
790 | else { | |
791 | $activityTypes = CRM_Case_XMLProcessor::allActivityTypes(); | |
792 | } | |
793 | ||
794 | if (!$activityTypes) { | |
795 | return FALSE; | |
796 | } | |
797 | ||
798 | // next get activity set Informtion | |
e547f744 | 799 | $activitySet = array( |
353ffa53 | 800 | 'label' => $form->getActivitySetLabel($xml, $activitySetName), |
6a488035 TO |
801 | 'includeActivities' => 'All', |
802 | 'redact' => 'false', | |
803 | ); | |
804 | $template->assign_by_ref('activitySet', $activitySet); | |
805 | ||
806 | //now collect all the information about activities | |
807 | $activities = array(); | |
808 | $form->getActivities($clientID, $caseID, $activityTypes, $activities); | |
809 | $template->assign_by_ref('activities', $activities); | |
810 | ||
811 | // now run the template | |
812 | $contents = $template->fetch('CRM/Case/XMLProcessor/Report.tpl'); | |
813 | return $contents; | |
814 | } | |
815 | ||
00be9182 | 816 | public static function printCaseReport() { |
353ffa53 TO |
817 | $caseID = CRM_Utils_Request::retrieve('caseID', 'Positive', CRM_Core_DAO::$_nullObject); |
818 | $clientID = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject); | |
819 | $activitySetName = CRM_Utils_Request::retrieve('asn', 'String', CRM_Core_DAO::$_nullObject); | |
820 | $isRedact = CRM_Utils_Request::retrieve('redact', 'Boolean', CRM_Core_DAO::$_nullObject); | |
6a488035 | 821 | $includeActivities = CRM_Utils_Request::retrieve('all', 'Positive', CRM_Core_DAO::$_nullObject); |
353ffa53 TO |
822 | $params = $otherRelationships = $globalGroupInfo = array(); |
823 | $report = new CRM_Case_XMLProcessor_Report($isRedact); | |
6a488035 TO |
824 | if ($includeActivities) { |
825 | $params['include_activities'] = 1; | |
826 | } | |
827 | ||
828 | if ($isRedact) { | |
829 | $params['is_redact'] = 1; | |
830 | $report->_redactionStringRules = array(); | |
831 | } | |
832 | $template = CRM_Core_Smarty::singleton(); | |
833 | ||
834 | //get case related relationships (Case Role) | |
835 | $caseRelationships = CRM_Case_BAO_Case::getCaseRoles($clientID, $caseID); | |
836 | $caseType = CRM_Case_BAO_Case::getCaseType($caseID, 'name'); | |
837 | ||
838 | $xmlProcessor = new CRM_Case_XMLProcessor_Process(); | |
839 | $caseRoles = $xmlProcessor->get($caseType, 'CaseRoles'); | |
840 | foreach ($caseRelationships as $key => & $value) { | |
a7488080 | 841 | if (!empty($caseRoles[$value['relation_type']])) { |
6a488035 TO |
842 | unset($caseRoles[$value['relation_type']]); |
843 | } | |
844 | if ($isRedact) { | |
845 | if (!array_key_exists($value['name'], $report->_redactionStringRules)) { | |
846 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
847 | array($value['name'] => 'name_' . rand(10000, 100000)) | |
848 | ); | |
849 | } | |
850 | $value['name'] = self::redact($value['name'], TRUE, $report->_redactionStringRules); | |
a7488080 | 851 | if (!empty($value['email']) && |
6a488035 TO |
852 | !array_key_exists($value['email'], $report->_redactionStringRules) |
853 | ) { | |
854 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
855 | array($value['email'] => 'email_' . rand(10000, 100000)) | |
856 | ); | |
857 | } | |
858 | ||
859 | $value['email'] = self::redact($value['email'], TRUE, $report->_redactionStringRules); | |
860 | ||
a7488080 | 861 | if (!empty($value['phone']) && |
6a488035 TO |
862 | !array_key_exists($value['phone'], $report->_redactionStringRules) |
863 | ) { | |
864 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
865 | array($value['phone'] => 'phone_' . rand(10000, 100000)) | |
866 | ); | |
867 | } | |
868 | $value['phone'] = self::redact($value['phone'], TRUE, $report->_redactionStringRules); | |
869 | } | |
870 | } | |
871 | ||
872 | $caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($caseID); | |
873 | if ($isRedact) { | |
874 | if (!array_key_exists($caseRoles['client']['sort_name'], $report->_redactionStringRules)) { | |
875 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
876 | array($caseRoles['client']['sort_name'] => 'name_' . rand(10000, 100000)) | |
877 | ); | |
878 | } | |
879 | if (!array_key_exists($caseRoles['client']['display_name'], $report->_redactionStringRules)) { | |
880 | $report->_redactionStringRules[$caseRoles['client']['display_name']] = $report->_redactionStringRules[$caseRoles['client']['sort_name']]; | |
881 | } | |
882 | $caseRoles['client']['sort_name'] = self::redact($caseRoles['client']['sort_name'], TRUE, $report->_redactionStringRules); | |
a7488080 | 883 | if (!empty($caseRoles['client']['email']) && |
6a488035 TO |
884 | !array_key_exists($caseRoles['client']['email'], $report->_redactionStringRules) |
885 | ) { | |
886 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
887 | array($caseRoles['client']['email'] => 'email_' . rand(10000, 100000)) | |
888 | ); | |
889 | } | |
890 | $caseRoles['client']['email'] = self::redact($caseRoles['client']['email'], TRUE, $report->_redactionStringRules); | |
891 | ||
a7488080 | 892 | if (!empty($caseRoles['client']['phone']) && |
6a488035 TO |
893 | !array_key_exists($caseRoles['client']['phone'], $report->_redactionStringRules) |
894 | ) { | |
895 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
896 | array($caseRoles['client']['phone'] => 'phone_' . rand(10000, 100000)) | |
897 | ); | |
898 | } | |
899 | $caseRoles['client']['phone'] = self::redact($caseRoles['client']['phone'], TRUE, $report->_redactionStringRules); | |
900 | } | |
901 | ||
902 | // Retrieve ALL client relationships | |
903 | $relClient = CRM_Contact_BAO_Relationship::getRelationship($clientID, | |
904 | CRM_Contact_BAO_Relationship::CURRENT, | |
905 | 0, 0, 0, NULL, NULL, FALSE | |
906 | ); | |
907 | foreach ($relClient as $r) { | |
908 | if ($isRedact) { | |
909 | if (!array_key_exists($r['name'], $report->_redactionStringRules)) { | |
910 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
911 | array($r['name'] => 'name_' . rand(10000, 100000)) | |
912 | ); | |
913 | } | |
914 | if (!array_key_exists($r['display_name'], $report->_redactionStringRules)) { | |
915 | $report->_redactionStringRules[$r['display_name']] = $report->_redactionStringRules[$r['name']]; | |
916 | } | |
917 | $r['name'] = self::redact($r['name'], TRUE, $report->_redactionStringRules); | |
918 | ||
a7488080 | 919 | if (!empty($r['phone']) && |
6a488035 TO |
920 | !array_key_exists($r['phone'], $report->_redactionStringRules) |
921 | ) { | |
922 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
923 | array($r['phone'] => 'phone_' . rand(10000, 100000)) | |
924 | ); | |
925 | } | |
926 | $r['phone'] = self::redact($r['phone'], TRUE, $report->_redactionStringRules); | |
927 | ||
a7488080 | 928 | if (!empty($r['email']) && |
6a488035 TO |
929 | !array_key_exists($r['email'], $report->_redactionStringRules) |
930 | ) { | |
931 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
932 | array($r['email'] => 'email_' . rand(10000, 100000)) | |
933 | ); | |
934 | } | |
935 | $r['email'] = self::redact($r['email'], TRUE, $report->_redactionStringRules); | |
936 | } | |
937 | if (!array_key_exists($r['id'], $caseRelationships)) { | |
938 | $otherRelationships[] = $r; | |
939 | } | |
940 | } | |
941 | ||
942 | // Now global contact list that appears on all cases. | |
943 | $relGlobal = CRM_Case_BAO_Case::getGlobalContacts($globalGroupInfo); | |
944 | foreach ($relGlobal as & $r) { | |
945 | if ($isRedact) { | |
946 | if (!array_key_exists($r['sort_name'], $report->_redactionStringRules)) { | |
947 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
948 | array($r['sort_name'] => 'name_' . rand(10000, 100000)) | |
949 | ); | |
950 | } | |
951 | if (!array_key_exists($r['display_name'], $report->_redactionStringRules)) { | |
952 | $report->_redactionStringRules[$r['display_name']] = $report->_redactionStringRules[$r['sort_name']]; | |
953 | } | |
954 | ||
955 | $r['sort_name'] = self::redact($r['sort_name'], TRUE, $report->_redactionStringRules); | |
956 | ||
a7488080 | 957 | if (!empty($r['phone']) && |
6a488035 TO |
958 | !array_key_exists($r['phone'], $report->_redactionStringRules) |
959 | ) { | |
960 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
961 | array($r['phone'] => 'phone_' . rand(10000, 100000)) | |
962 | ); | |
963 | } | |
964 | $r['phone'] = self::redact($r['phone'], TRUE, $report->_redactionStringRules); | |
965 | ||
a7488080 | 966 | if (!empty($r['email']) && |
6a488035 TO |
967 | !array_key_exists($r['email'], $report->_redactionStringRules) |
968 | ) { | |
969 | $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, | |
970 | array($r['email'] => 'email_' . rand(10000, 100000)) | |
971 | ); | |
972 | } | |
973 | $r['email'] = self::redact($r['email'], TRUE, $report->_redactionStringRules); | |
974 | } | |
975 | } | |
976 | ||
977 | $template->assign('caseRelationships', $caseRelationships); | |
978 | $template->assign('caseRoles', $caseRoles); | |
979 | $template->assign('otherRelationships', $otherRelationships); | |
980 | $template->assign('globalRelationships', $relGlobal); | |
981 | $template->assign('globalGroupInfo', $globalGroupInfo); | |
982 | $contents = self::getCaseReport($clientID, | |
983 | $caseID, | |
984 | $activitySetName, | |
985 | $params, | |
986 | $report | |
987 | ); | |
988 | $printReport = CRM_Case_Audit_Audit::run($contents, $clientID, $caseID, TRUE); | |
989 | echo $printReport; | |
990 | CRM_Utils_System::civiExit(); | |
991 | } | |
96025800 | 992 | |
6a488035 | 993 | } |